[Vm-dev] VM Maker: VMMaker.oscog-eem.2303.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Dec 31 00:43:39 UTC 2017


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2303.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.2303
Author: eem
Time: 30 December 2017, 4:43:05.961374 pm
UUID: 8cb7a9db-781c-4795-8cb7-ebd46abf0932
Ancestors: VMMaker.oscog-eem.2302

Simulation/Translation tweaks.  Mark some simulation-only InterpreterPlugin methods as doNotGenerate.  Slow down the simulated clock on the StackInterpreter (so that in simulation fewer tests time out).  Provide an optional simulation-only primTraceLog for the StackInterpreter (which was used to debug the new 64-bit at:[put:] support).

=============== Diff against VMMaker.oscog-eem.2302 ===============

Item was changed:
  ----- Method: InterpreterPlugin>>cCoerce:to: (in category 'simulation') -----
  cCoerce: value to: cType
+ 	<doNotGenerate>
  	"Type coercion for translation only; just return the value when running in Smalltalk.
  	 This overrides the generic coercion method in VMClass.  For some reason we are the exception.
  	 If we want that style of coercion we can send cCoerce:to: to interpreterProxy, not self."
  
  	^value!

Item was changed:
  ----- Method: InterpreterPlugin>>cCoerceSimple:to: (in category 'simulation') -----
  cCoerceSimple: value to: cType
+ 	<doNotGenerate>
  	"Coercion without type mapping.  Don't even bother to check for valid types..."
  	^value!

Item was changed:
  ----- Method: InterpreterPlugin>>translatedPrimitiveArgument:ofType:using: (in category 'simulation') -----
  translatedPrimitiveArgument: index ofType: cTypeString using: aCCodeGenerator
+ 	<doNotGenerate>
  	| oop unitSize |
  	oop := interpreterProxy stackValue: interpreterProxy methodArgumentCount - index.
  	(interpreterProxy isOopForwarded: oop) ifTrue: [^nil]. 
  	cTypeString last == $* ifTrue:
  		[unitSize := self sizeof: (aCCodeGenerator baseTypeForPointerType: cTypeString) asSymbol.
  		 unitSize caseOf: {
  			[1]	->	[(interpreterProxy isBytes: oop) ifFalse: [^nil]].
  			[2]	->	[(interpreterProxy isShorts: oop) ifFalse: [^nil]].
  			[4]	->	[(interpreterProxy isWords: oop) ifFalse: [^nil]].
  			[8]	->	[(interpreterProxy isLong64s: oop) ifFalse: [^nil]] }
  			otherwise: [^nil].
  		^ObjectProxyForTranslatedPrimitiveSimulation new
  			interpreter: interpreterProxy
  			oop: oop
  			unitSize: unitSize].
  	((interpreterProxy isIntegerObject: oop)
  	 and: [aCCodeGenerator isIntegralCType: cTypeString]) ifTrue:
  		[^interpreterProxy integerValueOf: oop].
  	self halt!

Item was changed:
  StackInterpreterPrimitives subclass: #StackInterpreterSimulator
+ 	instanceVariableNames: 'parent bootstrapping byteCount breakCount sendCount lookupCount printSends printReturns traceOn myBitBlt displayForm fakeForm filesOpen imageName pluginList mappedPluginEntries quitBlock transcript displayView eventTransformer printFrameAtEachStep printBytecodeAtEachStep systemAttributes startMicroseconds lastYieldMicroseconds externalSemaphoreSignalRequests externalSemaphoreSignalResponses extSemTabSize atEachStepBlock disableBooleanCheat performFilters eventQueue assertVEPAES primTraceLog'
- 	instanceVariableNames: 'parent bootstrapping byteCount breakCount sendCount lookupCount printSends printReturns traceOn myBitBlt displayForm fakeForm filesOpen imageName pluginList mappedPluginEntries quitBlock transcript displayView eventTransformer printFrameAtEachStep printBytecodeAtEachStep systemAttributes startMicroseconds lastYieldMicroseconds externalSemaphoreSignalRequests externalSemaphoreSignalResponses extSemTabSize atEachStepBlock disableBooleanCheat performFilters eventQueue assertVEPAES'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'VMMaker-InterpreterSimulation'!
  
  !StackInterpreterSimulator commentStamp: 'eem 9/3/2013 11:05' prior: 0!
  This class defines basic memory access and primitive simulation so that the StackInterpreter can run simulated in the Squeak environment.  It also defines a number of handy object viewing methods to facilitate pawing around in the object memory.
  
  To see the thing actually run, you could (after backing up this image and changes), execute
  
  	(StackInterpreterSimulator new openOn: Smalltalk imageName) test
  
  	((StackInterpreterSimulator newWithOptions: #(NewspeakVM true MULTIPLEBYTECODESETS true))
  		openOn: 'ns101.image') test
  
  and be patient both to wait for things to happen, and to accept various things that may go wrong depending on how large or unusual your image may be.  We usually do this with a small and simple benchmark image.
  
  Here's an example of what Eliot uses to launch the simulator in a window.  The bottom-right window has a menu packed with useful stuff:
  
  | vm |
  vm := StackInterpreterSimulator newWithOptions: #().
  vm openOn: '/Users/eliot/Squeak/Squeak4.4/trunk44.image'.
  vm setBreakSelector: #&.
  vm openAsMorph; run!

Item was changed:
  ----- Method: StackInterpreterSimulator>>ioUTCMicroseconds (in category 'I/O primitives support') -----
  ioUTCMicroseconds
  	"Return the value of the microsecond clock."
  	"NOT.  Actually, we want something a lot slower and, for exact debugging,
  	something more repeatable than real time.  Dan had an idea: use the byteCount..."
  
+ 	^(byteCount // 50) + startMicroseconds!
- 	^byteCount + startMicroseconds
- 	
- "At 20k bytecodes per second, this gives us aobut 200 ticks per second, or about 1/5 of what you'd expect for the real time clock.  This should still service events at one or two per second"!

Item was added:
+ ----- Method: StackInterpreterSimulator>>slowPrimitiveResponse (in category 'primitive support') -----
+ slowPrimitiveResponse
+ 	primTraceLog ifNotNil:
+ 		[primTraceLog size > 127 ifTrue:
+ 			[primTraceLog removeFirst].
+ 		 primTraceLog addLast: primitiveFunctionPointer].
+ 	^super slowPrimitiveResponse!

Item was added:
+ ----- Method: StackInterpreterSimulator>>turnOnPrimTraceLog (in category 'accessing') -----
+ turnOnPrimTraceLog
+ 	primTraceLog ifNil:
+ 		[primTraceLog := OrderedCollection new: 512]!



More information about the Vm-dev mailing list