Skip to content

Commit e39b209

Browse files
committed
CogVM source as per VMMaker.oscog-eem.2463
Plugins: BitBltSimulation Fix a bug where the copyBits primitive read past the end of the source bitmap. sourceSkewAndPointerInit would sometimes compute preload true and skew true before then setting skew to -32. There was a hack fix in copyLoop, but the real bug in copyLoop was the inner loop special case for rule 3 (over, or STORE). It must fall back to the loop beginning "thisWord := self srcLongAt: sourceIndex." when preload is false, only using the loop beginning "self dstLongAt: destIndex put: prevWord." when preload and: [hDr = 1] is true. Simplify the preload calculation in sourceSkewAndPointerInit by computing a mask similar to mask1 and comparing it against mask1 to see that no bits would be lost (if the mask computed for source is larger than mask1 then a preload is necessary). Hence simplify the unskew and skewMask setup in copyLoop. Improve the performance of primitiveDisplayString by pulling the lockSurfaces and unlockSurfaces implicit in copyBits out of the loop and replacing copyBits with copyBitsLockedAndClipped in the loop. Fix primitivePixelValueAt so that it simulates correctly. Other plugins: Remove null implementations of initialiseModule and/or shutdownModule. The loader/unloader invokes these only if they exist, consequently null versions are simply a waste of time and space.
1 parent 9d6ee95 commit e39b209

File tree

95 files changed

+3284
-2024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3284
-2024
lines changed

image/VM Simulation Workspace.text

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"To build the spurreader or spurreader-64 images used in the examples below run one of buildspurtrunkreaderimage.sh buildspurtrunkreader64image.shThe reader images include a simple REPL loop that reads a chunk-format expression from stdin, evaluates it and writes the printString of the result to stdout. In the simulator you are prompted for input via an input widget and writes output to the Transcript. e.g. try 3+4!. On the Transcript you should seesqueak> 7squeak> " "Run the Cog VM simulator on a Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)"[| cos |cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" ObjectMemory Spur32BitCoMemoryManager "ISA ARMv5" "ISA IA32")."cos initializeThreadSupport."cos desiredNumStackPages: 8.cos openOn: 'spurreader.image'.cos openAsMorph; run]."Run the Stack VM simulator on a Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)"[| cos |cos := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager).cos desiredNumStackPages: 8.cos openOn: 'spurreader.image'.cos openAsMorph; run]."Run the Cog VM simulator on a Cog image (by default the Squeak 4.5 image:). Note the plethora of optional debug features in comments."[| cos proc opts |cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit")."cos initializeThreadSupport."cos desiredNumStackPages: 8.cos openOn: 'Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image'.false ifTrue: [cos systemAttributes at: 2 put: '-doit'; at: 3 put: 'ShootoutTests runAllToTranscript. Smalltalk quitPrimitive']."cos cogit breakPC: 16r2697.""cos cogit traceStores: true.""cos cogit sendTrace: 6." "trace prims & print""cos cogit singleStep: true.""cos cogit printInstructions: true.""cos linkSends: false.""cos enableCog: false.""cos setBreakSelector: 'standardIOStreamNamed:forWrite:'.""cos cogit setBreakMethod: 16rCE1630.""cos cogit cog: 16rAB0B28 + cos startOfMemory selector: 16r31F280 + cos startOfMemory." "e.g. jit a specific method without simulating"cos openAsMorph; run]."Run the Stack VM simulator on a 64-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)"[| cos |cos := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur64BitMemoryManager).cos desiredNumStackPages: 8.cos openOn: 'spurreader-64.image'.cos openAsMorph; run]."Run the Cog VM simulator on a 64-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)"[| cos |cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" ObjectMemory Spur64BitCoMemoryManager "ISA ARMv5" "ISA IA32")."cos initializeThreadSupport."cos desiredNumStackPages: 8.cos openOn: 'spurreader-64.image'.cos openAsMorph; run]
1+
"To build the spurreader or spurreader-64 images used in the examples below run one of buildspurtrunkreaderimage.sh buildspurtrunkreader64image.shThe reader images include a simple REPL loop that reads a chunk-format expression from stdin, evaluates it and writes the printString of the result to stdout. In the simulator you are prompted for input via an input widget and writes output to the Transcript. e.g. try 3+4!. On the Transcript you should seesqueak> 7squeak> " "Run the Cog VM simulator on a Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)"[| cos |cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" ObjectMemory Spur32BitCoMemoryManager "ISA ARMv5" "ISA IA32")."cos initializeThreadSupport."cos desiredNumStackPages: 8. "Speeds up scavenging when simulating. Set to e.g. 64 for something like the real VM."cos openOn: 'spurreader.image'.cos openAsMorph; run]."Run the Stack VM simulator on a Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)"[| sis |sis := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager).sis desiredNumStackPages: 8. "Speeds up scavenging when simulating. Set to e.g. 64 for something like the real VM."sis assertValidExecutionPointersAtEachStep: false. "Set this to true to turn on an expensive assert that checks for valid stack, frame pointers etc on each bytecode. Useful when you're adding new bytecodes or exotic execution primitives."sis openOn: 'spurreader.image'.sis openAsMorph; run]."Run the Cog VM simulator on a Cog image (by default the Squeak 4.5 image:). Note the plethora of optional debug features in comments."[| cos proc opts |cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit")."cos initializeThreadSupport."cos desiredNumStackPages: 8.cos openOn: 'Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image'.false ifTrue: [cos systemAttributes at: 2 put: '-doit'; at: 3 put: 'ShootoutTests runAllToTranscript. Smalltalk quitPrimitive']."cos cogit breakPC: 16r2697.""cos cogit traceStores: true.""cos cogit sendTrace: 6." "trace prims & print""cos cogit singleStep: true.""cos cogit printInstructions: true.""cos linkSends: false.""cos enableCog: false.""cos setBreakSelector: 'standardIOStreamNamed:forWrite:'.""cos cogit setBreakMethod: 16rCE1630.""cos cogit cog: 16rAB0B28 + cos startOfMemory selector: 16r31F280 + cos startOfMemory." "e.g. jit a specific method without simulating"cos openAsMorph; run]."Run the Stack VM simulator on a 64-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)"[| sis |sis := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur64BitMemoryManager).sis desiredNumStackPages: 8.sis assertValidExecutionPointersAtEachStep: false. "Set this to true to turn on an expensive assert that checks for valid stack, frame pointers etc on each bytecode. Useful when you're adding new bytecodes or exotic execution primitives."sis openOn: 'spurreader-64.image'.sis openAsMorph; run]."Run the Cog VM simulator on a 64-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)"[| cos |cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" ObjectMemory Spur64BitCoMemoryManager "ISA ARMv5" "ISA IA32")."cos initializeThreadSupport."cos desiredNumStackPages: 8.cos openOn: 'spurreader-64.image'.cos openAsMorph; run]

nsspur64src/vm/cogit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.2454 uuid: 1a484e25-1628-4326-8054-8d4fbbbc3d65
2+
CCodeGenerator VMMaker.oscog-eem.2461 uuid: b3cd33f5-6309-43a1-b669-7a1805111f34
33
*/
44

55

0 commit comments

Comments
 (0)