[Vm-dev] VM Maker: VMMaker.oscog-nice.1977.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 4 19:47:08 UTC 2016

Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-nice.1977
Author: nice
Time: 4 November 2016, 8:45:40.263858 pm
UUID: 3612c2e9-55ee-401d-bef6-7a62d7ab5dc9
Ancestors: VMMaker.oscog-eem.1976

Improve portability to LLP64 by using usqInt rather than unsigned long where it makes sense.
It's not the case of integer containing target machine pointer that should use usqIntptr_t for the eventual future case when image wordSize differs from machine word size (32bits image on 64bits VM).

Currently, on Spur, LLP64 apart, usqInt and 'unsigned long' do match, and longAt: longAtPointer: in fact do return a sqInt (see platforms/cross/vm/sqMemory.h).

So for now:
- a single sista counter should fit into a usqInt.
- an immediate character fits into a usqInt.
- maxOldSpaceSize is not going to exeeed addressable space in the image, so it should allways fit into a usqInt too.

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

Item was changed:
  ----- Method: SistaCogit>>picDataFor:Annotation:Mcpc:Bcpc:Method: (in category 'method introspection') -----
  picDataFor: descriptor Annotation: isBackwardBranchAndAnnotation Mcpc: mcpc Bcpc: bcpc Method: cogMethodArg
  	<var: #descriptor type: #'BytecodeDescriptor *'>
  	<var: #mcpc type: #'char *'>
  	<var: #cogMethodArg type: #'void *'>
  	| annotation entryPoint tuple counter |
+ 	<var: #counter type: #usqInt>
- 	<var: #counter type: #'unsigned long'>
  	descriptor ifNil:
  	descriptor isBranch ifTrue:
  		["it's a branch; conditional?"
  		 (descriptor isBranchTrue or: [descriptor isBranchFalse]) ifTrue:
  			[counter := (self
  							cCoerce: ((self
  											cCoerceSimple: cogMethodArg
  											to: #'CogMethod *') counters)
+ 							to: #'usqInt *')
- 							to: #'unsigned long *')
  								at: counterIndex.
  			 tuple := self picDataForCounter: counter at: bcpc + 1.
  			 tuple = 0 ifTrue: [^PrimErrNoMemory].
  			 objectMemory storePointer: introspectionDataIndex ofObject: introspectionData withValue: tuple.
  			 introspectionDataIndex := introspectionDataIndex + 1.
  			 counterIndex := counterIndex + 1].
  	annotation := isBackwardBranchAndAnnotation >> 1.
  	((self isPureSendAnnotation: annotation)
  	 and: [entryPoint := backEnd callTargetFromReturnAddress: mcpc asUnsignedInteger.
  		 entryPoint > methodZoneBase]) ifFalse: "send is not linked, or is not a send"
  	self targetMethodAndSendTableFor: entryPoint "It's a linked send; find which kind."
  		annotation: annotation
  		into: [:targetMethod :sendTable| | methodClassIfSuper association |
  			methodClassIfSuper := nil.
  			sendTable = superSendTrampolines ifTrue:
  				[methodClassIfSuper := coInterpreter methodClassOf: (self cCoerceSimple: cogMethodArg to: #'CogMethod *') methodObject].
  			sendTable = directedSuperSendTrampolines ifTrue:
  				[association := backEnd literalBeforeInlineCacheTagAt: mcpc asUnsignedInteger.
  				 methodClassIfSuper := objectRepresentation valueOfAssociation: association].
  			tuple := self picDataForSendTo: targetMethod
  						methodClassIfSuper: methodClassIfSuper
  						at: mcpc
  						bcpc: bcpc + 1].
  	tuple = 0 ifTrue: [^PrimErrNoMemory].
  	objectMemory storePointer: introspectionDataIndex ofObject: introspectionData withValue: tuple.
  	introspectionDataIndex := introspectionDataIndex + 1.

Item was changed:
  ----- Method: SistaCogit>>picDataForCounter:at: (in category 'method introspection') -----
  picDataForCounter: counter at: bcpc
  	| executedCount tuple untakenCount |
+ 	<var: #counter type: #usqInt>
- 	<var: #counter type: #'unsigned long'>
  	tuple := objectMemory
  				eeInstantiateClassIndex: ClassArrayCompactIndex
  				format: objectMemory arrayFormat
  				numSlots: 3.
  	tuple = 0 ifTrue:
  	self assert: CounterBytes = 4.
  	executedCount := initialCounterValue - (counter >> 16).
  	untakenCount := initialCounterValue - (counter bitAnd: 16rFFFF).
  		storePointerUnchecked: 0 ofObject: tuple withValue: (objectMemory integerObjectOf: bcpc);
  		storePointerUnchecked: 1 ofObject: tuple withValue: (objectMemory integerObjectOf: executedCount);
  		storePointerUnchecked: 2 ofObject: tuple withValue: (objectMemory integerObjectOf: untakenCount).

Item was changed:
  ----- Method: Spur32BitMemoryManager>>integerObjectOfCharacterObject: (in category 'immediates') -----
  integerObjectOfCharacterObject: oop
  	"Immediate characters are unsigned"
+ 	^(self cCoerceSimple: oop to: #usqInt) >> 1!
- 	^(self cCoerceSimple: oop to: #'unsigned long') >> 1!

Item was changed:
  ----- Method: SpurMemoryManager class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator
  	self declareCAsOop: #(	memory freeStart scavengeThreshold newSpaceStart newSpaceLimit pastSpaceStart
  							lowSpaceThreshold freeOldSpaceStart oldSpaceStart endOfMemory firstFreeChunk lastFreeChunk)
  		in: aCCodeGenerator.
  	self declareCAsUSqLong: (self allInstVarNames select: [:ivn| ivn endsWith: 'Usecs'])
  		in: aCCodeGenerator.
  		var: #freeListsMask type: #usqInt;
  		var: #freeLists type: #'sqInt *';
  		var: #objStackInvalidBecause type: #'char *';
  		var: #unscannedEphemerons type: #SpurContiguousObjStack;
  		var: #heapGrowthToSizeGCRatio type: #float;
  		var: #heapSizeAtPreviousGC type: #usqInt;
  		var: #totalFreeOldSpace type: #usqInt;
+ 		var: #maxOldSpaceSize type: #usqInt.
- 		var: #maxOldSpaceSize type: #'unsigned long'.
  		var: #remapBuffer
  		declareC: 'sqInt remapBuffer[RemapBufferSize + 1 /* ', (RemapBufferSize + 1) printString, ' */]'.
  		var: #extraRoots
  		declareC: 'sqInt *extraRoots[ExtraRootsSize + 1 /* ', (ExtraRootsSize + 1) printString, ' */]'!

Item was changed:
  ----- Method: SpurMemoryManager>>setMaxOldSpaceSize: (in category 'accessing') -----
  setMaxOldSpaceSize: limit
+ 	<var: #limit type: #usqInt>
- 	<var: #limit type: #'unsigned long'>
  	maxOldSpaceSize := limit.

More information about the Vm-dev mailing list