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

commits at source.squeak.org commits at source.squeak.org
Thu Apr 17 22:08:08 UTC 2014


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

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

Name: VMMaker.oscog-eem.679
Author: eem
Time: 17 April 2014, 3:03:55.029 pm
UUID: 96f3797e-31e4-4c70-bd12-af82bff6fbe5
Ancestors: VMMaker.oscog-djm.678

Slang:
Rescue the SimpleStackBasedCogit by avoiding the conflict
between the object representation's numRegArgs and the
Cogit's numRegArgs by renaming object representation's
numRegArgs to preferredNumRegArgs.

Rescue running the Slang test workspace expressions before
initialization by adding guards in the relevant places.

ThreadedARMFFIPlugin: delete an unused method to nuke
an Undeclared.

=============== Diff against VMMaker.oscog-djm.678 ===============

Item was removed:
- ----- Method: CogObjectRepresentation>>numRegArgs (in category 'calling convention') -----
- numRegArgs
- 	"Define how many register arguments a StackToRegisterMapngCogit can and should use
- 	 with the receiver.  The value must be 0, 1 or 2.  Note that a SimpleStackBasedCogit always
- 	 has 0 register args (although the receiver is passed in a register)."
- 	self subclassResponsibility!

Item was added:
+ ----- Method: CogObjectRepresentation>>preferredNumRegArgs (in category 'calling convention') -----
+ preferredNumRegArgs
+ 	"Define how many register arguments a StackToRegisterMappingCogit can and should use
+ 	 with the receiver.  The value must be 0, 1 or 2.  Note that a SimpleStackBasedCogit always
+ 	 has 0 register args (although the receiver is passed in a register)."
+ 	self subclassResponsibility!

Item was removed:
- ----- Method: CogObjectRepresentationForSpur>>numRegArgs (in category 'calling convention') -----
- numRegArgs
- 	"The Spur object representation is simple enough that implementing
- 	 at:put: is straight-forward and hence 2 register args are worth while."
- 	<api>
- 	^2!

Item was added:
+ ----- Method: CogObjectRepresentationForSpur>>preferredNumRegArgs (in category 'calling convention') -----
+ preferredNumRegArgs
+ 	"Define how many register arguments a StackToRegisterMappingCogit can
+ 	 and should use with the receiver.  The value must be 0, 1 or 2.  Note that a
+ 	 SimpleStackBasedCogit always has 0 register args (although the receiver is
+ 	 passed in a register).  The Spur object representation is simple enough that
+ 	 implementing at:put: is straight-forward and hence 2 register args are worth while."
+ 	<inline: true>
+ 	^2!

Item was removed:
- ----- Method: CogObjectRepresentationForSqueakV3>>numRegArgs (in category 'calling convention') -----
- numRegArgs
- 	"CogObjectRepresentationForSqueakV3 only implements at most 1-arg primitives, because
- 	 the complexity of the object representation makes it difficult to implement at:put:, the most
- 	 performance-critical 2-argument primitive."
- 	<api>
- 	^1!

Item was added:
+ ----- Method: CogObjectRepresentationForSqueakV3>>preferredNumRegArgs (in category 'calling convention') -----
+ preferredNumRegArgs
+ 	"Define how many register arguments a StackToRegisterMappingCogit can
+ 	 and should use with the receiver.  The value must be 0, 1 or 2.  Note that a
+ 	 SimpleStackBasedCogit always has 0 register args (although the receiver is
+ 	 passed in a register).  CogObjectRepresentationForSqueakV3 only implements
+ 	 at most 1-arg primitives, because the complexity of the object representation
+ 	 makes it difficult to implement at:put:, the most performance-critical 2-argument
+ 	 primitive."
+ 	<inline: true>
+ 	^1!

Item was changed:
  ----- Method: Cogit class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator
  	#(	'coInterpreter' 'objectMemory' 'methodZone' 'objectRepresentation'
  		'cogBlockMethodSurrogateClass' 'cogMethodSurrogateClass'
  		'threadManager' 'processor' 'lastNInstructions' 'simulatedAddresses'
  		'simulatedTrampolines' 'simulatedVariableGetters' 'simulatedVariableSetters'
  		'printRegisters' 'printInstructions' 'clickConfirm' 'singleStep') do:
  			[:simulationVariableNotNeededForRealVM|
  			aCCodeGenerator removeVariable: simulationVariableNotNeededForRealVM].
  	NewspeakVM ifFalse:
  		[#(	'dynSuperEntry' 'dynSuperEntryAlignment' 'dynamicSuperSendTrampolines'
  			'ceImplicitReceiverTrampoline' 'ceExplicitReceiverTrampoline' 'cmDynSuperEntryOffset') do:
  				[:variableNotNeededInNormalVM|
  				aCCodeGenerator removeVariable: variableNotNeededInNormalVM]].
  	aCCodeGenerator removeConstant: #COGMTVM. "this should be defined at compile time"
  	aCCodeGenerator
  		addHeaderFile:'<stddef.h>'; "for e.g. offsetof"
  		addHeaderFile:'"sqCogStackAlignment.h"';
  		addHeaderFile:'"cogmethod.h"';
  		addHeaderFile:'#if COGMTVM';
  		addHeaderFile:'"cointerpmt.h"';
  		addHeaderFile:'#else';
  		addHeaderFile:'"cointerp.h"';
  		addHeaderFile:'#endif';
  		addHeaderFile:'"cogit.h"';
  		addHeaderFile:'"dispdbg.h"'.
  	aCCodeGenerator
  		var: #ceGetSP
  			declareC: 'unsigned long (*ceGetSP)(void)';
  		var: #ceCaptureCStackPointers
  			declareC: 'void (*ceCaptureCStackPointers)(void)';
  		var: #ceEnterCogCodePopReceiverReg
  			declareC: 'void (*ceEnterCogCodePopReceiverReg)(void)';
  		var: #realCEEnterCogCodePopReceiverReg
  			declareC: 'void (*realCEEnterCogCodePopReceiverReg)(void)';
  		var: #ceEnterCogCodePopReceiverAndClassRegs
  			declareC: 'void (*ceEnterCogCodePopReceiverAndClassRegs)(void)';
  		var: #realCEEnterCogCodePopReceiverAndClassRegs
  			declareC: 'void (*realCEEnterCogCodePopReceiverAndClassRegs)(void)';
  		var: #ceFlushICache
  			declareC: 'static void (*ceFlushICache)(unsigned long from, unsigned long to)';
  		var: #ceCheckFeaturesFunction
  			declareC: 'static unsigned long (*ceCheckFeaturesFunction)(void)';
  		var: #ceTryLockVMOwner
  			declareC: 'unsigned long (*ceTryLockVMOwner)(void)';
  		var: #ceUnlockVMOwner
  			declareC: 'void (*ceUnlockVMOwner)(void)';
  		var: #postCompileHook
  			declareC: 'void (*postCompileHook)(CogMethod *, void *)';
  		var: #openPICList declareC: 'CogMethod *openPICList = 0';
  		var: #maxMethodBefore type: #'CogBlockMethod *'.
  	aCCodeGenerator
  		declareVar: 'aMethodLabel' type: #'AbstractInstruction'; "Has to come lexicographically before backEnd & methodLabel"
  		var: #backEnd declareC: 'AbstractInstruction * const backEnd = &aMethodLabel';
  		var: #methodLabel declareC: 'AbstractInstruction * const methodLabel = &aMethodLabel';
  		var: #primInvokeLabel type: #'AbstractInstruction *'.
  	self declareC: #(abstractOpcodes stackCheckLabel
  					blockEntryLabel blockEntryNoContextSwitch
  					stackOverflowCall sendMissCall entry noCheckEntry dynSuperEntry
  					mnuCall interpretCall endCPICCase0 endCPICCase1)
  			as: #'AbstractInstruction *'
  				in: aCCodeGenerator.
  	aCCodeGenerator
  		declareVar: #annotations type: #'InstructionAnnotation *';
  		declareVar: #blockStarts type: #'BlockStart *';
  		declareVar: #fixups type: #'BytecodeFixup *'.
  	aCCodeGenerator
  		var: #sendTrampolines
  			declareC: 'sqInt sendTrampolines[NumSendTrampolines]';
  		var: #superSendTrampolines
  			declareC: 'sqInt superSendTrampolines[NumSendTrampolines]';
  		var: #dynamicSuperSendTrampolines
  			declareC: 'sqInt dynamicSuperSendTrampolines[NumSendTrampolines]';
  		var: #trampolineAddresses
  			declareC: 'static char *trampolineAddresses[NumTrampolines*2]';
  		var: #objectReferencesInRuntime
  			declareC: 'static sqInt objectReferencesInRuntime[NumObjRefsInRuntime]';
  		var: #cePositive32BitIntegerTrampoline
  			declareC: 'static sqInt cePositive32BitIntegerTrampoline';
  		var: #labelCounter
  			type: #int;
  		var: #traceFlags
  			declareC: 'int traceFlags = 8 /* prim trace log on by default */';
  		var: #cStackAlignment
  			declareC: 'const int cStackAlignment = STACK_ALIGN_BYTES'.
  	aCCodeGenerator
  		declareVar: #CFramePointer type: #'void *';
  		declareVar: #CStackPointer type: #'void *';
  		declareVar: #minValidCallAddress type: #'unsigned long';
  		declareVar: #debugPrimCallStackOffset type: #'unsigned long'.
+ 	aCCodeGenerator vmClass generatorTable ifNotNil:
+ 		[:generatorTable|
+ 		aCCodeGenerator
+ 			var: #generatorTable
+ 				declareC: 'BytecodeDescriptor generatorTable[', aCCodeGenerator vmClass generatorTable size, ']'
+ 							, (self tableInitializerFor: aCCodeGenerator vmClass generatorTable
+ 								in: aCCodeGenerator);
+ 			var: #primitiveGeneratorTable
+ 				declareC: 'PrimitiveDescriptor primitiveGeneratorTable[MaxCompiledPrimitiveIndex+1]'
+ 							, (self tableInitializerFor: aCCodeGenerator vmClass primitiveTable
+ 								in: aCCodeGenerator)].
- 	aCCodeGenerator
- 		var: #generatorTable
- 			declareC: 'BytecodeDescriptor generatorTable[', aCCodeGenerator vmClass generatorTable size, ']'
- 						, (self tableInitializerFor: aCCodeGenerator vmClass generatorTable
- 							in: aCCodeGenerator);
- 		var: #primitiveGeneratorTable
- 			declareC: 'PrimitiveDescriptor primitiveGeneratorTable[MaxCompiledPrimitiveIndex+1]'
- 						, (self tableInitializerFor: aCCodeGenerator vmClass primitiveTable
- 							in: aCCodeGenerator).
  	"In C the abstract opcode names clash with the Smalltak generator syntactic sugar.
  	 Most of the syntactic sugar is inlined, but alas some remains.  Rename the syntactic
  	 sugar to avoid the clash."
  	(self organization listAtCategoryNamed: #'abstract instructions') do:
  		[:s|
  		aCCodeGenerator addSelectorTranslation: s to: 'g', (aCCodeGenerator cFunctionNameFor: s)].
  	aCCodeGenerator addSelectorTranslation: #halt: to: 'haltmsg'!

Item was changed:
  ----- Method: Cogit class>>tableFunctions (in category 'translation') -----
  tableFunctions
  	"self tableFunctions"
  	self getVMMaker ifNotNil:
  		[:vmMaker| vmMaker cogitClass ~= self ifTrue: [^Set new]].
+ 	generatorTable ifNil:
+ 		[^Set new].
  	^Set new
  		addAll: (generatorTable object
  					collect: [:ea| ea generator]);
  		addAll: (generatorTable object
  					select: [:ea| ea spanFunction notNil]
  					thenCollect: [:ea| ea spanFunction]);
  		addAll: (generatorTable object
  					select: [:ea| ea needsFrameFunction notNil]
  					thenCollect: [:ea| ea needsFrameFunction]);
  		addAll: (primitiveTable object
  					select: [:ea| ea notNil and: [ea primitiveGenerator notNil]]
  					thenCollect: [:ea| ea primitiveGenerator]);
  		addAll: (primitiveTable object
  					select: [:ea| ea notNil and: [ea enabled notNil]]
  					thenCollect: [:ea| ea enabled]);
  		asSortedCollection: [:a :b| a caseInsensitiveLessOrEqual: b]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCodeGen
  	aCodeGen
  		var: #methodAbortTrampolines
  			declareC: 'sqInt methodAbortTrampolines[4]';
  		var: #picAbortTrampolines
  			declareC: 'sqInt picAbortTrampolines[4]';
  		var: #picMissTrampolines
  			declareC: 'sqInt picMissTrampolines[4]';
  		var: 'ceEnter0ArgsPIC'
  			declareC: 'void (*ceEnter0ArgsPIC)(void)';
  		var: 'ceEnter1ArgsPIC'
  			declareC: 'void (*ceEnter1ArgsPIC)(void)';
  		var: 'ceEnter2ArgsPIC'
  			declareC: 'void (*ceEnter2ArgsPIC)(void)';
  		var: #ceEnterCogCodePopReceiverArg0Regs
  			declareC: 'void (*ceEnterCogCodePopReceiverArg0Regs)(void)';
  		var: #realCEEnterCogCodePopReceiverArg0Regs
  			declareC: 'void (*realCEEnterCogCodePopReceiverArg0Regs)(void)';
  		var: #ceEnterCogCodePopReceiverArg1Arg0Regs
  			declareC: 'void (*ceEnterCogCodePopReceiverArg1Arg0Regs)(void)';
  		var: #realCEEnterCogCodePopReceiverArg1Arg0Regs
  			declareC: 'void (*realCEEnterCogCodePopReceiverArg1Arg0Regs)(void)';
  		var: 'simStack'
  			declareC: 'CogSimStackEntry simStack[', ((CoInterpreter bindingOf: #LargeContextSize) value * 5 / 4 // BytesPerWord) asString, ']';
  		var: 'simSelf'
  			type: #CogSimStackEntry;
  		var: #optStatus
  			type: #CogSSOptStatus;
- 		var: 'isPushNilFunction'
- 			declareC: 'sqInt (* const isPushNilFunction)(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt) = ', (aCodeGen cFunctionNameFor: self isPushNilFunction);
- 		var: 'pushNilSizeFunction'
- 			declareC: 'sqInt (* const pushNilSizeFunction)(sqInt) = ', (aCodeGen cFunctionNameFor: self pushNilSizeFunction);
  		var: 'prevBCDescriptor'
  			type: #'BytecodeDescriptor *'.
  
+ 	self isPushNilFunction ifNotNil:
+ 		[aCodeGen
+ 			var: 'isPushNilFunction'
+ 				declareC: 'sqInt (* const isPushNilFunction)(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt) = ', (aCodeGen cFunctionNameFor: self isPushNilFunction);
+ 			var: 'pushNilSizeFunction'
+ 				declareC: 'sqInt (* const pushNilSizeFunction)(sqInt) = ', (aCodeGen cFunctionNameFor: self pushNilSizeFunction)].
+ 
  	aCodeGen
  		addSelectorTranslation: #register to: (aCodeGen cFunctionNameFor: 'registerr');
  		addSelectorTranslation: #register: to: (aCodeGen cFunctionNameFor: 'registerr:')!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>numRegArgs (in category 'compile abstract instructions') -----
  numRegArgs
+ 	<api>
+ 	^objectRepresentation preferredNumRegArgs!
- 	<doNotGenerate>
- 	^objectRepresentation numRegArgs!

Item was removed:
- ----- Method: ThreadedARMFFIPlugin class>>numRegArgs (in category 'accessing') -----
- numRegArgs
- 	^NumRegArgs!

Item was changed:
  ----- Method: VMClass class>>initializeMiscConstants (in category 'initialization') -----
  initializeMiscConstants
  	"Falsify the `what type of VM is this?' flags that are defined in the various interp.h files,
  	 or in the case of VMBIGENDIAN the various sqConfig.h files.
  	 Subclass implementations need to include a super initializeMiscConstants"
  
  	| omc |
  	VMBIGENDIAN class. "Mention this for the benefit of CCodeGenerator>>emitCConstantsOn:"
  	self isInterpreterClass ifTrue:
  		[STACKVM := COGVM := COGMTVM := false].
  
+ 	initializationOptions ifNil: [self initializationOptions: Dictionary new].
  	omc := initializationOptions at: #ObjectMemory ifAbsent: nil.
  	initializationOptions
  		at: #SqueakV3ObjectMemory	"the good ole default"
  			put: (omc
  					ifNil: [true]
  					ifNotNil: [(Smalltalk at: omc) inheritsFrom: ObjectMemory]);
  		at: #SpurObjectMemory		"the new condender"
  			put: (omc
  					ifNil: [false]
  					ifNotNil: [(Smalltalk at: omc) inheritsFrom: SpurMemoryManager]).
  
  	"Use ifAbsentPut: so that they will get copied back to the
  	 VMMaker's options and dead code will likely be eliminated."
  	NewspeakVM := initializationOptions at: #NewspeakVM ifAbsentPut: [false].
  	MULTIPLEBYTECODESETS := initializationOptions at: #MULTIPLEBYTECODESETS ifAbsentPut: [false].
  	"N.B.  Not yet implemented."
  	IMMUTABILITY := initializationOptions at: #IMMUTABILITY ifAbsentPut: [false].
  
  	"These for scripts etc... Usually they should get set by an Interpreter class's initializeMiscConstantsWith:"
  	(initializationOptions includesKey: #STACKVM) ifTrue:
  		[STACKVM := initializationOptions at: #STACKVM].
  	(initializationOptions includesKey: #COGVM) ifTrue:
  		[COGVM := initializationOptions at: #COGVM].
  	(initializationOptions includesKey: #COGMTVM) ifTrue:
  		[COGMTVM := initializationOptions at: #COGMTVM]!



More information about the Vm-dev mailing list