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

commits at source.squeak.org commits at source.squeak.org
Wed Dec 18 01:44:59 UTC 2013


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

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

Name: VMMaker.oscog-eem.564
Author: eem
Time: 17 December 2013, 5:41:30.917 pm
UUID: 70d96811-1a51-4f85-9f12-cb5a3ba8a8bf
Ancestors: VMMaker.oscog-eem.563

Make the instantiation primtijevs fail for format 7 (forwarded format)
and name this for use as the format of immediate classes.

Include both variants of the get class tag code in the Spur obj rep.

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

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>getInlineCacheClassTagFrom:into: (in category 'compile abstract instructions') -----
  getInlineCacheClassTagFrom: sourceReg into: destReg
  	"Extract the inline cache tag for the object in sourceReg into destReg. The inline
  	 cache tag for a given object is the value loaded in inline caches to distinguish
  	 objects of different classes.  In Spur this is either the tags for immediates, (with
  	 1 & 3 collapsed to 1 for SmallIntegers, and 2 collapsed to 0 for Characters), or
  	 the receiver's classIndex.  Generate something like this:
  		Lentry:
  			movl rSource, rDest
  			andl $0x3, rDest
  			jz LnotImm
  			andl $1, rDest
  			j Lcmp
  		LnotImm:
  			movl 0(%edx), rDest
  			andl $0x3fffff, rDest
  		Lcmp:
  	 At least on a 2.2GHz Intel Core i7 it is slightly faster,
  	 136m sends/sec vs 130m sends/sec for nfib in tinyBenchmarks, than
  		Limm:
  			andl $0x1, rDest
  			j Lcmp
  		Lentry:
  			movl rSource, rDest
  			andl $0x3, rDest
  			jnz Limm
  			movl 0(%edx), rDest
  			andl $0x3fffff, rDest
  		Lcmp:
  	"
+ 	| immLabel jumpNotImm entryLabel jumpCompare |
+ 	<var: #immLabel type: #'AbstractInstruction *'>
- 	| jumpNotImm entryLabel jumpCompare |
  	<var: #jumpNotImm type: #'AbstractInstruction *'>
  	<var: #entryLabel type: #'AbstractInstruction *'>
  	<var: #jumpCompare type: #'AbstractInstruction *'>
+ 	true
+ 		ifTrue:
+ 			[cogit AlignmentNops: (BytesPerWord max: 8).
+ 			 entryLabel := cogit Label.
+ 			 cogit MoveR: sourceReg R: destReg.
+ 			 cogit AndCq: objectMemory tagMask R: destReg.
+ 			 jumpNotImm := cogit JumpZero: 0.
+ 			 cogit AndCq: 1 R: destReg.
+ 			 jumpCompare := cogit Jump: 0.
+ 			 "Get least significant half of header word in destReg"
+ 			 self flag: #endianness.
+ 			 jumpNotImm jmpTarget:
+ 				(cogit MoveMw: 0 r: sourceReg R: destReg).
+ 			 jumpCompare jmpTarget:
+ 				(cogit AndCq: objectMemory classIndexMask R: destReg)]
+ 		ifFalse:
+ 			[cogit AlignmentNops: BytesPerWord.
+ 			 immLabel := cogit Label.
+ 			 cogit AndCq: 1 R: destReg.
+ 			 jumpCompare := cogit Jump: 0.
+ 			 cogit AlignmentNops: BytesPerWord.
+ 			 entryLabel := cogit Label.
+ 			 cogit MoveR: sourceReg R: destReg.
+ 			 cogit AndCq: objectMemory tagMask R: destReg.
+ 			 cogit JumpNonZero: immLabel.
+ 			 self flag: #endianness.
+ 			 "Get least significant half of header word in destReg"
+ 			 cogit MoveMw: 0 r: sourceReg R: destReg.
+ 			 cogit AndCq: objectMemory classIndexMask R: destReg.
+ 			 jumpCompare jmpTarget: cogit Label].
- 	cogit AlignmentNops: (BytesPerWord max: 8).
- 	entryLabel := cogit Label.
- 	cogit MoveR: sourceReg R: destReg.
- 	cogit AndCq: objectMemory tagMask R: destReg.
- 	jumpNotImm := cogit JumpZero: 0.
- 	cogit AndCq: 1 R: destReg.
- 	jumpCompare := cogit Jump: 0.
- 	"Get least significant half of header word in destReg"
- 	self flag: #endianness.
- 	jumpNotImm jmpTarget:
- 		(cogit MoveMw: 0 r: sourceReg R: destReg).
- 	jumpCompare jmpTarget:
- 		(cogit AndCq: objectMemory classIndexMask R: destReg).
  	^entryLabel!

Item was changed:
  ----- Method: Spur32BitMemoryManager>>instantiateClass:indexableSize: (in category 'instantiation') -----
  instantiateClass: classObj indexableSize: nElements
  	| instSpec classFormat numSlots classIndex newObj fillValue |
  	classFormat := self formatOfClass: classObj.
  	instSpec := self instSpecOfClassFormat: classFormat.
  	fillValue := 0.
  	instSpec caseOf: {
  		[self arrayFormat]	->
  			[numSlots := nElements.
  			 fillValue := nilObj].
  		[self indexablePointersFormat]	->
  			[numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements.
  			 fillValue := nilObj].
  		[self weakArrayFormat]	->
  			[numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements.
  			 fillValue := nilObj].
  		[self sixtyFourBitIndexableFormat]	->
  			[numSlots := nElements * 2].
  		[self firstLongFormat]	->
  			[numSlots := nElements].
  		[self firstShortFormat]	->
  			[numSlots := nElements + 1 // 2.
  			 instSpec := instSpec + (nElements bitAnd: 1)].
  		[self firstByteFormat]	->
  			[numSlots := nElements + 3 // 4.
  			 instSpec := instSpec + (4 - nElements bitAnd: 3)].
  		[self firstCompiledMethodFormat]	->
  			[numSlots := nElements + 3 // 4.
  			 instSpec := instSpec + (4 - nElements bitAnd: 3)] }
  		otherwise: ["some Squeak images include funky fixed subclasses of abstract variable
  					 superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection.
  					 Allow fixed classes to be instantiated here iff nElements = 0."
+ 					 (nElements ~= 0 or: [instSpec > self lastPointerFormat]) ifTrue:
- 					 (nElements ~= 0 or: [instSpec >= self sixtyFourBitIndexableFormat]) ifTrue:
  						[^nil].
  					 numSlots := self fixedFieldsOfClassFormat: classFormat]. "non-indexable"
  	classIndex := self ensureBehaviorHash: classObj.
  	classIndex < 0 ifTrue:
  		[coInterpreter primitiveFailFor: classIndex negated.
  		 ^nil].
  	numSlots > self maxSlotsForNewSpaceAlloc
  		ifTrue: [newObj := self allocateSlotsInOldSpace: numSlots format: instSpec classIndex: classIndex]
  		ifFalse: [newObj := self allocateSlots: numSlots format: instSpec classIndex: classIndex].
  	newObj ifNotNil:
  		[self fillObj: newObj numSlots: numSlots with: fillValue].
  	^newObj!

Item was changed:
  ----- Method: Spur64BitMemoryManager>>instantiateClass:indexableSize: (in category 'instantiation') -----
  instantiateClass: classObj indexableSize: nElements
  	| instSpec classFormat numSlots classIndex newObj fillValue |
  	classFormat := self formatOfClass: classObj.
  	instSpec := self instSpecOfClassFormat: classFormat.
  	fillValue := 0.
  	instSpec caseOf: {
  		[self arrayFormat]	->
  			[numSlots := nElements.
  			 fillValue := nilObj].
  		[self indexablePointersFormat]	->
  			[numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements.
  			 fillValue := nilObj].
  		[self weakArrayFormat]	->
  			[numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements.
  			 fillValue := nilObj].
  		[self sixtyFourBitIndexableFormat]	->
  			[numSlots := nElements].
  		[self firstLongFormat]	->
  			[numSlots := nElements + 1 // 2.
  			 instSpec := instSpec + (nElements bitAnd: 1)].
  		[self firstShortFormat]	->
  			[numSlots := nElements + 3 // 4.
  			 instSpec := instSpec + (4 - nElements bitAnd: 3)].
  		[self firstByteFormat]	->
  			[numSlots := nElements + 7 // 8.
  			 instSpec := instSpec + (8 - nElements bitAnd: 7)].
  		[self firstCompiledMethodFormat]	->
  			[numSlots := nElements + 7 // 8.
  			 instSpec := instSpec + (8 - nElements bitAnd: 7)] }
  		otherwise: ["some Squeak images include funky fixed subclasses of abstract variable
  					 superclasses. e.g. DirectoryEntry as a subclass of ArrayedCollection.
  					 Allow fixed classes to be instantiated here iff nElements = 0."
+ 					 (nElements ~= 0 or: [instSpec > self lastPointerFormat]) ifTrue:
- 					 (nElements ~= 0 or: [instSpec >= self sixtyFourBitIndexableFormat]) ifTrue:
  						[^nil].
  					 numSlots := self fixedFieldsOfClassFormat: classFormat]. "non-indexable"
  	classIndex := self ensureBehaviorHash: classObj.
  	classIndex < 0 ifTrue:
  		[coInterpreter primitiveFailFor: classIndex negated.
  		 ^nil].
  	numSlots > self maxSlotsForNewSpaceAlloc
  		ifTrue: [newObj := self allocateSlotsInOldSpace: numSlots format: instSpec classIndex: classIndex]
  		ifFalse: [newObj := self allocateSlots: numSlots format: instSpec classIndex: classIndex].
  	newObj ifNotNil:
  		[self fillObj: newObj numSlots: numSlots with: fillValue].
  	^newObj!

Item was added:
+ ----- Method: SpurMemoryManager>>instSpecForImmediateClasses (in category 'header formats') -----
+ instSpecForImmediateClasses
+ 	"Use the format for forwarded objects for immediate classes.  Immediate classes (SmallInteger,
+ 	 Character, etc) can't be instantiated, so the inst spec should be an invalid one to cause the
+ 	 instantiation primitives to fail.  The forwardedFormat is internal to the SpurMemoryManager,
+ 	 used to mark forwarded objects only, and so is suitable."
+ 	^self forwardedFormat!

Item was changed:
  ----- Method: SpurSegmentManager>>initForBootstrap (in category 'spur bootstrap') -----
  initForBootstrap
+ 	numSegInfos = 0 ifTrue:
+ 		[self allocateOrExtendSegmentInfos]!
- 	self allocateOrExtendSegmentInfos!



More information about the Vm-dev mailing list