[gs-cvs] rev 7504 - trunk/gs/lib

leonardo at ghostscript.com leonardo at ghostscript.com
Thu Dec 14 05:54:09 PST 2006


Author: leonardo
Date: 2006-12-14 05:54:09 -0800 (Thu, 14 Dec 2006)
New Revision: 7504

Modified:
   trunk/gs/lib/gs_cidcm.ps
   trunk/gs/lib/gs_res.ps
   trunk/gs/lib/gs_resmp.ps
Log:
Fix (Resource machinery) : Place temporary 'resourceforall' data into the local VM.

DETAILS :

This is an improved version of the 7449 change, 
which has been unwinded in the revision 7487,

The old code placed them into global VM,
rather some their elements may be in local VM.
Fixes the cash06 diff in PS3 CET 30-07-3.

Thanks to L. Peter Deutsch for locating the wrong code parts.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/lib/gs_cidcm.ps
===================================================================
--- trunk/gs/lib/gs_cidcm.ps	2006-12-13 21:18:20 UTC (rev 7503)
+++ trunk/gs/lib/gs_cidcm.ps	2006-12-14 13:54:09 UTC (rev 7504)
@@ -365,31 +365,31 @@
   % These dictionaries must be created dynamically, to allow for a possible 
   % recursive call to resourceforall from the resourceforall procedure.
   currentglobal false setglobal
-  20 dict 20 dict 20 dict
+  20 dict 20 dict 20 dict                  % (templ) proc (scr) g <<CIDFont>> <<CMap>> <<Fonts>>
+  
 
-  4 -1 roll setglobal                     % (templ) proc (scr) <<CIDFont>> <<CMap>> <<Fonts>>
-
   % Store resource identifiers into local dictionaries
   % A resource instance can have a key that is not a name or a string. In this
   % case, resourceforall passes the key directly to proc instead of copying it
   % into the scratch string. This case can arise only for a resource instance
   % defined in virtual memory by a previous defineresource
 
-  % Discard non-string keys of CIDFont and CMap because <CIDFontName>- -<CMapName>
+  % Discard non-string keys of CIDFont and CMap because <CIDFontName>-<CMapName>
   % is only defined for names.
 
   { /.DisableResourceOrdering pop % gs_resmp accesses this through execstack - don't remove !
 
-    5 index [ 2 index {exch //null put} aload pop ] cvx bind 5 index //ResourceForAll exec
+    6 index [ 2 index {exch //null put} aload pop ] cvx bind 6 index //ResourceForAll exec
 
     (*) [ 3 index {exch dup type /stringtype eq { cvn dup put } { pop pop } ifelse } aload pop
-        ] cvx bind 5 index /CMap resourceforall
+        ] cvx bind 6 index /CMap resourceforall
 
     (*) [ 4 index {exch dup type /stringtype eq { cvn dup put } { pop pop } ifelse } aload pop
-        ] cvx bind 5 index /CIDFont resourceforall
+        ] cvx bind 6 index /CIDFont resourceforall
 
     exit
   } loop % This loop is a pattern for execstack_lookup - don't remove !
+  4 -1 roll setglobal                     % (templ) proc (scr) <<CIDFont>> <<CMap>> <<Fonts>>
 
   %% Make the list of fonts in the form (/Name status) :
 
@@ -435,7 +435,6 @@
 
   % Make the enumerator and apply it :
   /MappedCategoryRedefiner /ProcSet findresource /MakeResourceEnumerator get exec exec
-
 } bind def
 
 

Modified: trunk/gs/lib/gs_res.ps
===================================================================
--- trunk/gs/lib/gs_res.ps	2006-12-13 21:18:20 UTC (rev 7503)
+++ trunk/gs/lib/gs_res.ps	2006-12-14 13:54:09 UTC (rev 7504)
@@ -336,12 +336,6 @@
  { 3 -1 roll //.rfnstring cvs concatstrings exch copy
  } bind def
 
-% Define a procedure for making a packed array in local VM.
-/.localpackedarray {	% <obj1> ... <objn> <n> .localpackedarray <packedarray>
-  .currentglobal false .setglobal 1 index 2 add 1 roll
-  packedarray exch .setglobal
-} bind def
-
 % Define the Generic category.
 
 /Generic mark
@@ -478,19 +472,19 @@
 		% Construct a new procedure to hold the arguments.
 		% All objects constructed here must be in local VM to avoid
 		% a possible invalidaccess.
-	currentdict 4 .localpackedarray	% [template proc scratch resdict]
+	currentdict 4 .localvmpackedarray	% [template proc scratch resdict]
 		% We must pop the resource dictionary off the dict stack
 		% when doing the actual iteration, and restore it afterwards.
 	.currentglobal not {
 	  .LocalInstances length 0 ne {
 		% We must do local instances, and do them first.
-	    //.localresourceforall {exec} 0 get 3 .localpackedarray cvx
+	    //.localresourceforall {exec} 0 get 3 .localvmpackedarray cvx
 	    .LocalInstances exch {forall} 0 get 1 index 0 get
 	    currentdict end 3 .execn begin
 	  } if
 	} if
 		% Do global instances next.
-	//.globalresourceforall {exec} 0 get 3 .localpackedarray cvx
+	//.globalresourceforall {exec} 0 get 3 .localvmpackedarray cvx
 	.Instances exch cvx {forall} 0 get 1 index 0 get
 	currentdict end 3 .execn begin
         mark                                             % args [
@@ -530,7 +524,7 @@
           2 index 2 get { cvs 0 } aload pop 5 index
           //.externalresourceforall {exec} 0 get
           % }
-        7 .localpackedarray cvx
+        7 .localvmpackedarray cvx
         3 2 roll pop % args
 	{ forall } 0 get
   	currentdict end 2 .execn begin

Modified: trunk/gs/lib/gs_resmp.ps
===================================================================
--- trunk/gs/lib/gs_resmp.ps	2006-12-13 21:18:20 UTC (rev 7503)
+++ trunk/gs/lib/gs_resmp.ps	2006-12-14 13:54:09 UTC (rev 7504)
@@ -135,9 +135,14 @@
   % bind it dynamically with a temporary dictionary, which contains
   % local variables for the currently executing instance of resourceforall.
 
+  % Always place the enumerator in local VM,
+  % because its elements may be in local VM.
+
+  currentglobal 4 1 roll
+  false setglobal
   currentdict                    % Category
   6 dict begin % the temporary dictionary
-    /Category exch def           %
+    /Category exch def
     /InstancesStatus exch def
     /scr exch def
     /proc exch def
@@ -145,7 +150,7 @@
     //InstanceEnumeratorPattern //BindWithCurrentdict exec     % Enumerator
     /status 0 def % variable for the current status to enumerate - do not bind with it !
   end
-
+  exch setglobal
 } bind def
 
 /execstack_lookup     % <object> execstack_lookup <object1>
@@ -309,13 +314,13 @@
     } bind def
 
     /ResourceForAll  % <template> <proc> <scratch> ResourceForAll -
-    { RESMPDEBUG { (resmp ResourceForAll beg ) print 2 index = } if
+    { RESMPDEBUG { (resmp ResourceForAll beg ) print CategoryName =string cvs print ( ) print 2 index = } if
       % Create InstancesStatus dictionary :
       20 dict % IS - Instances Status
       4 1 roll                            % <<IS>> (templ) {proc} (sctarch)
-                                          % <<IS>> bOrder (templ) {proc} (sctarch)
       % Check if we are under another ResourceForAll :
       /.DisableResourceOrdering //execstack_lookup exec null eq 4 1 roll
+                                          % <<IS>> bOrder (templ) {proc} (sctarch)
 
       % Put underlying resources to the InstancesStatus dictionary :
       currentdict % the category



More information about the gs-cvs mailing list