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

commits at source.squeak.org commits at source.squeak.org
Sat May 17 00:28:04 UTC 2014


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

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

Name: VMMaker.oscog-eem.720
Author: eem
Time: 16 May 2014, 5:24:41.663 pm
UUID: 0db9a001-37b2-4c1b-9aa8-0e661200853c
Ancestors: VMMaker.oscog-tpr.719

Newspeak Spur:
Provide machine code primitives for instantiateFixedClass:
(a.k.a. a 1 arg basicNew) and instantiateVariableClass:withSize:
(a.k.a. a 2 arg basicNew:).

Spur:
Fix the assert in checkForAndFollowForwardedPrimitiveState
and add support for primtiive 218, primitiveDoNamedPrimitiveWithArgs.

Multiple bytecode sets:
Usse class vars to define the per-bytecode set
longStoreOpcode instead of hardwiring the SqueakV3
and NewsqueakV4 values.

Use the new multiple bytecode set support to implement
stack depth finding.  Nuke the now obsolete
NewspeakStackDepthFinder.

Simulator:
Provide missing Spur unalignedLongAt:[put:].
Fix the new evaluating of the break block on every
interpreted instruction when a breakPC is in effect.

Misc:
Fix formatting in genMethodAbortTrampoline.
Nuke the obsolete CompiledMethod>>usesAlternateBytecodeSet
override.
Fix str:n:cmp: usage in printOopShortInner:.

=============== Diff against VMMaker.oscog-tpr.719 ===============

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>genGetSizeOf:into:formatReg:scratchReg:abortJumpsInto: (in category 'primitive generators') -----
  genGetSizeOf: sourceReg into: destReg formatReg: formatReg scratchReg: scratchReg abortJumpsInto: aBinaryBlock
  	"Get the size of the non-immediate object in sourceReg into destReg using formatReg
  	 and scratchReg as temps.  None of these registers can overlap.  Supply the jumps
  	 taken if the object in sourceReg is not indexable, or if the object in sourceReg is a
  	 context.. Hack: If the object has a pointer format other than 2 leave the number of
  	 fixed fields in formatReg.  Used by primitiveSize, primitiveAt, and primitiveAtPut"
  	<returnTypeC: #'AbstractInstruction *'>
  	| jumpNotIndexable jumpSmallSize
  	  jumpBytesDone jumpShortsDone jumpArrayDone jump32BitLongsDone
  	  jumpIsBytes jumpHasFixedFields jumpIsShorts jumpIsContext  |
  	<inline: true>
  	"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
  	<var: #jumpIsBytes type: #'AbstractInstruction *'>
  	<var: #jumpIsShorts type: #'AbstractInstruction *'>
  	<var: #jumpSmallSize type: #'AbstractInstruction *'>
  	<var: #jumpIsContext type: #'AbstractInstruction *'>
  	<var: #jumpArrayDone type: #'AbstractInstruction *'>
  	<var: #jumpNotIndexable type: #'AbstractInstruction *'>
  	<var: #jumpHasFixedFields type: #'AbstractInstruction *'>
  	<var: #jump32BitLongsDone type: #'AbstractInstruction *'>
  
+ 	"formatReg := self formatOf: sourceReg"
+ 	self genGetFormatOf: sourceReg
+ 		into: formatReg
+ 		leastSignificantHalfOfBaseHeaderIntoScratch: scratchReg.
- 	cogit
- 		MoveMw: 0 r: sourceReg R: formatReg;				"formatReg := least significant half of self baseHeader: receiver"
- 		MoveR: formatReg R: scratchReg;
- 		LogicalShiftRightCq: objectMemory formatShift R: formatReg;
- 		AndCq: objectMemory formatMask R: formatReg.	"formatReg := self formatOfHeader: destReg"
  
  	"get numSlots into destReg."
  	cogit MoveCq: 0 R: destReg. "N.B. MoveMb:r:R: does not zero other bits"
  	cogit MoveMb: 7 r: sourceReg R: destReg. "MSB of header"
  	cogit CmpCq: objectMemory numSlotsMask R: destReg.
  	jumpSmallSize := cogit JumpLess: 0.
  	cogit MoveMw: -8 r: sourceReg R: destReg. "LSW of overflow size header"
  
  	"dispatch on format in a combination of highest dynamic frequency order first and convenience.
  		  0 = 0 sized objects (UndefinedObject True False et al)
  		  1 = non-indexable objects with inst vars (Point et al)
  		  2 = indexable objects with no inst vars (Array et al)
  		  3 = indexable objects with inst vars (MethodContext AdditionalMethodState et al)
  		  4 = weak indexable objects with inst vars (WeakArray et al)
  		  5 = weak non-indexable objects with inst vars (ephemerons) (Ephemeron)
  		  6 unused, reserved for exotic pointer objects?
  		  7 Forwarded Object, 1st field is pointer, rest of fields are ignored
  		  8 unused, reserved for exotic non-pointer objects?
  		  9 (?) 64-bit indexable
  		10 - 11 32-bit indexable
  		12 - 15 16-bit indexable
  		16 - 23 byte indexable
  		24 - 31 compiled method"
  	jumpSmallSize jmpTarget:
  					(cogit CmpCq: objectMemory firstByteFormat R: formatReg).
  	jumpIsBytes := cogit JumpGreaterOrEqual: 0.
  					cogit CmpCq: objectMemory arrayFormat R: formatReg.
  	jumpArrayDone := cogit JumpZero: 0.
  	jumpNotIndexable := cogit JumpLess: 0.
  					cogit CmpCq: objectMemory weakArrayFormat R: formatReg.
  	jumpHasFixedFields := cogit JumpLessOrEqual: 0.
  					cogit CmpCq: objectMemory firstShortFormat R: formatReg.
  	jumpIsShorts := cogit JumpGreaterOrEqual: 0.
  					cogit CmpCq: objectMemory firstLongFormat R: formatReg.
  	jump32BitLongsDone := cogit JumpGreaterOrEqual: 0.
  	"For now ignore 64-bit indexability."
  	jumpNotIndexable jmpTarget: cogit Label.
  	jumpNotIndexable := cogit Jump: 0.
  
  	jumpIsBytes jmpTarget:
  		(cogit LogicalShiftLeftCq: objectMemory shiftForWord R: destReg).
  		cogit AndCq: objectMemory wordSize - 1 R: formatReg.
  		cogit SubR: formatReg R: destReg.
  	jumpBytesDone := cogit Jump: 0.
  
  	jumpIsShorts jmpTarget:
  		(cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: destReg).
  		cogit AndCq: 1 R: formatReg.
  		cogit SubR: formatReg R: destReg.
  	jumpShortsDone := cogit Jump: 0.
  
  	"formatReg contains fmt, now up for grabs.
  	 destReg contains numSlots, precious.
  	 sourceReg must be preserved"
  	jumpHasFixedFields jmpTarget:
  		(cogit AndCq: objectMemory classIndexMask R: scratchReg).
  	cogit MoveR: scratchReg R: formatReg.
  	cogit CmpCq: ClassMethodContextCompactIndex R: scratchReg.
  	jumpIsContext := cogit JumpZero: 0.
  	cogit PushR: destReg.
  	self genGetClassObjectOfClassIndex: formatReg into: destReg scratchReg: scratchReg.
  	self genLoadSlot: InstanceSpecificationIndex sourceReg: destReg destReg: formatReg.
  	self genConvertSmallIntegerToIntegerInReg: formatReg.
  	cogit
  		PopR: destReg;
  		AndCq: objectMemory fixedFieldsOfClassFormatMask R: formatReg;
  		SubR: formatReg R: destReg.
  
  	jumpArrayDone jmpTarget:
  	(jump32BitLongsDone jmpTarget:
  	(jumpShortsDone jmpTarget:
  	(jumpBytesDone jmpTarget:
  		cogit Label))).
  	aBinaryBlock value: jumpNotIndexable value: jumpIsContext!

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveAt: (in category 'primitive generators') -----
  genInnerPrimitiveAt: retNoffset
  	"Implement the guts of primitiveAt"
  	| formatReg jumpNotIndexable jumpSmallSize jumpImmediate jumpBadIndex
  	  jumpBytesDone jumpShortsDone jumpWordsDone jumpFixedFieldsDone
  	  jumpIsBytes jumpIsShorts jumpIsWords jumpWordTooBig jumpIsArray jumpHasFixedFields jumpIsContext
  	  jumpBytesOutOfBounds jumpShortsOutOfBounds jumpWordsOutOfBounds jumpArrayOutOfBounds jumpFixedFieldsOutOfBounds |
  	<inline: true>
  	"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
  	<var: #jumpIsBytes type: #'AbstractInstruction *'>
  	<var: #jumpIsShorts type: #'AbstractInstruction *'>
  	<var: #jumpBadIndex type: #'AbstractInstruction *'>
  	<var: #jumpSmallSize type: #'AbstractInstruction *'>
  	<var: #jumpIsContext type: #'AbstractInstruction *'>
  	<var: #jumpImmediate type: #'AbstractInstruction *'>
  	<var: #jumpBytesDone type: #'AbstractInstruction *'>
  	<var: #jumpShortsDone type: #'AbstractInstruction *'>
  	<var: #jumpWordsDone type: #'AbstractInstruction *'>
  	<var: #jumpWordTooBig type: #'AbstractInstruction *'>
  	<var: #jumpNotIndexable type: #'AbstractInstruction *'>
  	<var: #jumpHasFixedFields type: #'AbstractInstruction *'>
  	<var: #jumpFixedFieldsDone type: #'AbstractInstruction *'>
  	<var: #jumpArrayOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpShortsOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpFixedFieldsOutOfBounds type: #'AbstractInstruction *'>
  
  	cogit MoveR: ReceiverResultReg R: TempReg.
  	jumpImmediate := self genJumpImmediateInScratchReg: TempReg.
  	cogit MoveR: Arg0Reg R: TempReg.
  	cogit MoveR: Arg0Reg R: Arg1Reg.
  	jumpBadIndex := self genJumpNotSmallIntegerInScratchReg: TempReg.
  	self genConvertSmallIntegerToIntegerInReg: Arg1Reg.
  	cogit SubCq: 1 R: Arg1Reg. "1-rel => 0-rel"
  
+ 	"formatReg := self formatOf: ReceiverResultReg"
+ 	self genGetFormatOf: ReceiverResultReg
+ 		into: (formatReg := SendNumArgsReg)
+ 		leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
- 	formatReg := SendNumArgsReg.
- 	cogit
- 		MoveMw: 0 r: ReceiverResultReg R: formatReg;		"formatReg := least significant half of self baseHeader: receiver"
- 		MoveR: formatReg R: TempReg;
- 		LogicalShiftRightCq: objectMemory formatShift R: formatReg;
- 		AndCq: objectMemory formatMask R: formatReg.	"formatReg := self formatOfHeader: destReg"
  
  	"get numSlots into ClassReg."
  	cogit MoveCq: 0 R: ClassReg. "N.B. MoveMb:r:R: does not zero other bits"
  	cogit MoveMb: 7 r: ReceiverResultReg R: ClassReg. "MSB of header"
  	cogit CmpCq: objectMemory numSlotsMask R: ClassReg.
  	jumpSmallSize := cogit JumpBelow: 0.
  	cogit MoveMw: -8 r: ReceiverResultReg R: ClassReg. "LSW of overflow size header"
  
  	"dispatch on format in a combination of highest dynamic frequency order first and convenience.
  		  0 = 0 sized objects (UndefinedObject True False et al)
  		  1 = non-indexable objects with inst vars (Point et al)
  		  2 = indexable objects with no inst vars (Array et al)
  		  3 = indexable objects with inst vars (MethodContext AdditionalMethodState et al)
  		  4 = weak indexable objects with inst vars (WeakArray et al)
  		  5 = weak non-indexable objects with inst vars (ephemerons) (Ephemeron)
  		  6 unused, reserved for exotic pointer objects?
  		  7 Forwarded Object, 1st field is pointer, rest of fields are ignored
  		  8 unused, reserved for exotic non-pointer objects?
  		  9 (?) 64-bit indexable
  		10 - 11 32-bit indexable
  		12 - 15 16-bit indexable
  		16 - 23 byte indexable
  		24 - 31 compiled method"
  	jumpSmallSize jmpTarget:
  					(cogit CmpCq: objectMemory firstByteFormat R: formatReg).
  	jumpIsBytes := cogit JumpAboveOrEqual: 0.
  					cogit CmpCq: objectMemory arrayFormat R: formatReg.
  	jumpIsArray := cogit JumpZero: 0.
  	jumpNotIndexable := cogit JumpBelow: 0.
  					cogit CmpCq: objectMemory weakArrayFormat R: formatReg.
  	jumpHasFixedFields := cogit JumpBelowOrEqual: 0.
  					cogit CmpCq: objectMemory firstShortFormat R: formatReg.
  	jumpIsShorts := cogit JumpAboveOrEqual: 0.
  					cogit CmpCq: objectMemory firstLongFormat R: formatReg.
  	jumpIsWords := cogit JumpAboveOrEqual: 0.
  	"For now ignore 64-bit indexability."
  	jumpNotIndexable jmpTarget: cogit Label.
  	jumpNotIndexable := cogit Jump: 0.
  
  	jumpIsBytes jmpTarget:
  		(cogit LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg).
  		cogit AndCq: objectMemory wordSize - 1 R: formatReg.
  		cogit SubR: formatReg R: ClassReg;
  		CmpR: Arg1Reg R: ClassReg.
  	jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit AddCq: objectMemory baseHeaderSize R: Arg1Reg.
  	cogit MoveXbr: Arg1Reg R: ReceiverResultReg R: ReceiverResultReg.
  	self genConvertIntegerToSmallIntegerInReg: ReceiverResultReg.
  	jumpBytesDone := cogit Jump: 0.
  
  	jumpIsShorts jmpTarget:
  		(cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg).
  		cogit AndCq: 1 R: formatReg.
  		cogit SubR: formatReg R: ClassReg;
  		CmpR: Arg1Reg R: ClassReg.
  	jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit AddR: Arg1Reg R: ReceiverResultReg.
  	cogit MoveM16: objectMemory baseHeaderSize r: ReceiverResultReg R: ReceiverResultReg.
  	self genConvertIntegerToSmallIntegerInScratchReg: ReceiverResultReg.
  	jumpShortsDone := cogit Jump: 0.
  
  	jumpIsWords jmpTarget:
  		(cogit CmpR: Arg1Reg R: ClassReg).
  	jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
  	cogit MoveXwr: Arg1Reg R: ReceiverResultReg R: TempReg.
  	cogit SubCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
  	jumpWordTooBig := self jumpNotSmallIntegerUnsignedValueInRegister: TempReg.
  	cogit MoveR: TempReg R: ReceiverResultReg.
  	self genConvertIntegerToSmallIntegerInScratchReg: ReceiverResultReg.
  	jumpWordsDone := cogit Jump: 0.
  
  	jumpHasFixedFields jmpTarget:
  		(cogit AndCq: objectMemory classIndexMask R: TempReg).
  	cogit MoveR: TempReg R: formatReg.
  	cogit CmpCq: ClassMethodContextCompactIndex R: TempReg.
  	jumpIsContext := cogit JumpZero: 0.
  	cogit PushR: ClassReg.
  	self genGetClassObjectOfClassIndex: formatReg into: ClassReg scratchReg: TempReg.
  	self genLoadSlot: InstanceSpecificationIndex sourceReg: ClassReg destReg: formatReg.
  	cogit PopR: ClassReg.
  	self genConvertSmallIntegerToIntegerInReg: formatReg.
  	cogit
  		AndCq: objectMemory fixedFieldsOfClassFormatMask R: formatReg;
  		SubR: formatReg R: ClassReg;
  		CmpR: Arg1Reg R: ClassReg.
  	jumpFixedFieldsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	"index is (formatReg (fixed fields) + Arg1Reg (0-rel index)) * wordSize + baseHeaderSize"
  	cogit AddR: formatReg R: Arg1Reg.
  	cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
  	cogit MoveXwr: Arg1Reg R: ReceiverResultReg R: ReceiverResultReg.
  	jumpFixedFieldsDone := cogit Jump: 0.
  
  	jumpIsArray jmpTarget:
  		(cogit CmpR: Arg1Reg R: ClassReg).
  	jumpArrayOutOfBounds := cogit JumpBelowOrEqual: 0.	
  	cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
  	cogit MoveXwr: Arg1Reg R: ReceiverResultReg R: ReceiverResultReg.
  
  	jumpFixedFieldsDone jmpTarget:
  	(jumpWordsDone jmpTarget:
  	(jumpShortsDone jmpTarget:
  	(jumpBytesDone jmpTarget:
  		(cogit RetN: retNoffset)))).
  
  	jumpFixedFieldsOutOfBounds jmpTarget:
  	(jumpArrayOutOfBounds jmpTarget:
  	(jumpBytesOutOfBounds jmpTarget:
  	(jumpShortsOutOfBounds jmpTarget:
  	(jumpWordsOutOfBounds jmpTarget:
  	(jumpWordTooBig jmpTarget:
  	(jumpNotIndexable jmpTarget:
  	(jumpIsContext jmpTarget:
  	(jumpBadIndex jmpTarget:
  	(jumpImmediate jmpTarget: cogit Label))))))))).
  
  	^0!

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveAtPut: (in category 'primitive generators') -----
  genInnerPrimitiveAtPut: retNoffset
  	"Implement the guts of primitiveAtPut"
  	| formatReg jumpImmediate jumpBadIndex
  	  jumpSmallSize jumpNotIndexablePointers jumpNotIndexableBits
  	  jumpIsContext jumpIsCompiledMethod jumpIsBytes jumpHasFixedFields
  	  jumpArrayOutOfBounds jumpFixedFieldsOutOfBounds
  	  jumpWordsOutOfBounds jumpBytesOutOfBounds jumpBytesOutOfRange
  	  jumpNonSmallIntegerValue jumpShortsUnsupported jumpNotPointers
  	  |
  	<inline: true>
  	"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
  	<var: #jumpIsBytes type: #'AbstractInstruction *'>
  	<var: #jumpBadIndex type: #'AbstractInstruction *'>
  	<var: #jumpSmallSize type: #'AbstractInstruction *'>
  	<var: #jumpIsContext type: #'AbstractInstruction *'>
  	<var: #jumpImmediate type: #'AbstractInstruction *'>
  	<var: #jumpHasFixedFields type: #'AbstractInstruction *'>
  	<var: #jumpNotIndexableBits type: #'AbstractInstruction *'>
  	<var: #jumpArrayOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpShortsUnsupported type: #'AbstractInstruction *'>
  	<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpNotIndexablePointers type: #'AbstractInstruction *'>
  
  	cogit MoveR: ReceiverResultReg R: TempReg.
  	jumpImmediate := self genJumpImmediateInScratchReg: TempReg.
  	cogit MoveR: Arg0Reg R: TempReg.
  	jumpBadIndex := self genJumpNotSmallIntegerInScratchReg: TempReg.
  	self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
  	cogit SubCq: 1 R: Arg0Reg. "1-rel => 0-rel"
  
+ 	"formatReg := self formatOf: ReceiverResultReg"
+ 	self genGetFormatOf: ReceiverResultReg
+ 		into: (formatReg := SendNumArgsReg)
+ 		leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
- 	formatReg := SendNumArgsReg.
- 	cogit
- 		MoveMw: 0 r: ReceiverResultReg R: formatReg;		"formatReg := least significant half of self baseHeader: receiver"
- 		MoveR: formatReg R: TempReg;
- 		LogicalShiftRightCq: objectMemory formatShift R: formatReg;
- 		AndCq: objectMemory formatMask R: formatReg.	"formatReg := self formatOfHeader: destReg"
  
  	"get numSlots into ClassReg."
  	cogit MoveCq: 0 R: ClassReg. "N.B. MoveMb:r:R: does not zero other bits"
  	cogit MoveMb: 7 r: ReceiverResultReg R: ClassReg. "MSB of header"
  	cogit CmpCq: objectMemory numSlotsMask R: ClassReg.
  	jumpSmallSize := cogit JumpBelow: 0.
  	cogit MoveMw: -8 r: ReceiverResultReg R: ClassReg. "LSW of overflow size header"
  
  	"dispatch on format in a combination of highest dynamic frequency order first and convenience.
  		  0 = 0 sized objects (UndefinedObject True False et al)
  		  1 = non-indexable objects with inst vars (Point et al)
  		  2 = indexable objects with no inst vars (Array et al)
  		  3 = indexable objects with inst vars (MethodContext AdditionalMethodState et al)
  		  4 = weak indexable objects with inst vars (WeakArray et al)
  		  5 = weak non-indexable objects with inst vars (ephemerons) (Ephemeron)
  		  6 unused, reserved for exotic pointer objects?
  		  7 Forwarded Object, 1st field is pointer, rest of fields are ignored
  		  8 unused, reserved for exotic non-pointer objects?
  		  9 (?) 64-bit indexable
  		10 - 11 32-bit indexable
  		12 - 15 16-bit indexable
  		16 - 23 byte indexable
  		24 - 31 compiled method"
  	jumpSmallSize jmpTarget:
  					(cogit CmpCq: objectMemory weakArrayFormat R: formatReg).
  	jumpNotPointers := cogit JumpAbove: 0.
  	"optimistic store check; assume index in range (almost always is)."
  	self genStoreCheckReceiverReg: ReceiverResultReg valueReg: Arg1Reg scratchReg: TempReg.
  
  	cogit CmpCq: objectMemory arrayFormat R: formatReg.
  	jumpNotIndexablePointers := cogit JumpBelow: 0.
  	jumpHasFixedFields := cogit JumpNonZero: 0.
  	cogit CmpR: Arg0Reg R: ClassReg.
  	jumpArrayOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg0Reg.
  	cogit MoveR: Arg1Reg Xwr: Arg0Reg R: ReceiverResultReg.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  	cogit RetN: retNoffset.
  
  	jumpHasFixedFields jmpTarget: cogit Label.
  	self genGetClassIndexOfNonImm: ReceiverResultReg into: formatReg.
  	cogit CmpCq: ClassMethodContextCompactIndex R: formatReg.
  	jumpIsContext := cogit JumpZero: 0.
  	"get # fixed fields in formatReg"
  	cogit PushR: ClassReg.
  	self genGetClassObjectOfClassIndex: formatReg into: ClassReg scratchReg: TempReg.
  	self genLoadSlot: InstanceSpecificationIndex sourceReg: ClassReg destReg: formatReg.
  	cogit PopR: ClassReg.
  	self genConvertSmallIntegerToIntegerInReg: formatReg.
  	cogit AndCq: objectMemory fixedFieldsOfClassFormatMask R: formatReg.
  	cogit SubR: formatReg R: ClassReg.
  	cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: formatReg.
  	cogit CmpR: Arg0Reg R: ClassReg.
  	jumpFixedFieldsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit AddR: formatReg R: Arg0Reg.
  	cogit MoveR: Arg1Reg Xwr: Arg0Reg R: ReceiverResultReg.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  	cogit RetN: retNoffset.
  
  	jumpNotPointers jmpTarget:
  		(cogit CmpCq: objectMemory firstCompiledMethodFormat R: formatReg).
  	jumpIsCompiledMethod := cogit JumpAboveOrEqual: 0.
  	cogit MoveR: Arg1Reg R: TempReg.
  	jumpNonSmallIntegerValue := self genJumpNotSmallIntegerInScratchReg: TempReg.
  					cogit CmpCq: objectMemory firstByteFormat R: formatReg.
  	jumpIsBytes := cogit JumpAboveOrEqual: 0.
  					cogit CmpCq: objectMemory firstShortFormat R: formatReg.
  	jumpShortsUnsupported := cogit JumpAboveOrEqual: 0.
  					cogit CmpCq: objectMemory firstLongFormat R: formatReg.
  	"For now ignore 64-bit indexability."
  	jumpNotIndexableBits := cogit JumpBelow: 0.
  
  	cogit CmpR: Arg0Reg R: ClassReg.
  	jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit MoveR: Arg1Reg R: TempReg.
  	self genConvertSmallIntegerToIntegerInReg: TempReg.
  	cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg0Reg.
  	cogit MoveR: TempReg Xwr: Arg0Reg R: ReceiverResultReg.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  	cogit RetN: retNoffset.
  
  	jumpIsBytes jmpTarget:
  		(cogit CmpCq: (objectMemory integerObjectOf: 255) R: Arg1Reg).
  	jumpBytesOutOfRange := cogit JumpAbove: 0.
  	cogit LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
  	cogit AndCq: objectMemory wordSize - 1 R: formatReg.
  	cogit SubR: formatReg R: ClassReg;
  	CmpR: Arg0Reg R: ClassReg.
  	jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit MoveR: Arg1Reg R: TempReg.
  	self genConvertSmallIntegerToIntegerInReg: TempReg.
  	cogit AddCq: objectMemory baseHeaderSize R: Arg0Reg.
  	cogit MoveR: TempReg Xbr: Arg0Reg R: ReceiverResultReg.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  	cogit RetN: retNoffset.
  
  	"there are no shorts as yet.  so this is dead code:
  	jumpIsShorts jmpTarget:
  		(cogit CmpCq: (objectMemory integerObjectOf: 65535) R: Arg1Reg).
  	jumpShortsOutOfRange := cogit JumpAbove: 0.
  	cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
  	cogit AndCq: 1 R: formatReg.
  	cogit SubR: formatReg R: ClassReg;
  	CmpR: Arg0Reg R: ClassReg.
  	jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit MoveR: Arg1Reg R: TempReg.
  	cogit genConvertSmallIntegerToIntegerInReg: TempReg.
  	cogit AddR: Arg0Reg R: ReceiverResultReg.
  	cogit MoveR: TempReg M16: objectMemory baseHeaderSize r: ReceiverResultReg.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  	jumpShortsDone := cogit Jump: 0."
  
  	jumpIsContext jmpTarget: 
  	(jumpNotIndexableBits jmpTarget:
  	(jumpBytesOutOfRange jmpTarget:
  	(jumpIsCompiledMethod jmpTarget:
  	(jumpArrayOutOfBounds jmpTarget:
  	(jumpBytesOutOfBounds jmpTarget:
  	(jumpShortsUnsupported jmpTarget:
  	(jumpWordsOutOfBounds jmpTarget:
  	(jumpNotIndexablePointers jmpTarget:
  	(jumpNonSmallIntegerValue jmpTarget:
  	(jumpFixedFieldsOutOfBounds jmpTarget: cogit Label)))))))))).
  
  	cogit AddCq: 1 R: Arg0Reg. "0-rel => 1-rel"
  	self genConvertIntegerToSmallIntegerInScratchReg: Arg0Reg.
  
  	jumpBadIndex jmpTarget: (jumpImmediate jmpTarget: cogit Label).
  
  	^0!

Item was added:
+ ----- Method: CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveMirrorNew: (in category 'primitive generators') -----
+ genInnerPrimitiveMirrorNew: retNoffset
+ 	"Implement 1-arg (instantiateFixedClass:) primitiveNew for convenient cases:
+ 	- the class argument has a hash
+ 	- the class argument is fixed size (excluding ephemerons to save instructions & miniscule time)
+ 	- single word header/num slots < numSlotsMask
+ 	- the result fits in eden (actually below scavengeThreshold)"
+ 
+ 	| halfHeaderReg fillReg instSpecReg byteSizeReg
+ 	  jumpImmediate jumpUnhashed jumpNotFixedPointers jumpTooSmall jumpBadFormat
+ 	  jumpNoSpace jumpTooBig jumpHasSlots jumpVariableOrEphemeron
+ 	  fillLoop skip |
+ 	<var: 'skip' type: #'AbstractInstruction *'>
+ 	<var: 'fillLoop' type: #'AbstractInstruction *'>
+ 	<var: 'jumpTooBig' type: #'AbstractInstruction *'>
+ 	<var: 'jumpHasSlots' type: #'AbstractInstruction *'>
+ 	<var: 'jumpNoSpace' type: #'AbstractInstruction *'>
+ 	<var: 'jumpTooSmall' type: #'AbstractInstruction *'>
+ 	<var: 'jumpUnhashed' type: #'AbstractInstruction *'>
+ 	<var: 'jumpImmediate' type: #'AbstractInstruction *'>
+ 	<var: 'jumpBadFormat' type: #'AbstractInstruction *'>
+ 	<var: 'jumpNotFixedPointers' type: #'AbstractInstruction *'>
+ 	<var: 'jumpVariableOrEphemeron' type: #'AbstractInstruction *'>
+ 
+ 	"half header will contain 1st half of header (classIndex/class's hash & format),
+ 	 then 2nd half of header (numSlots/fixed size) and finally fill value (nilObject)."
+ 	halfHeaderReg := fillReg := SendNumArgsReg.
+ 	"inst spec will hold class's instance specification, then byte size and finally end of new object."
+ 	instSpecReg := byteSizeReg := ClassReg.
+ 
+ 	"get freeStart as early as possible so as not to wait later..."
+ 	cogit MoveAw: objectMemory freeStartAddress R: Arg1Reg.
+ 
+ 	"validate class arg; sigh, this mirror crap hobbles unfairly; there is a better way with selector namespaces..."
+ 	cogit MoveR: Arg0Reg R: TempReg.
+ 	jumpImmediate := self genJumpImmediateInScratchReg: TempReg.
+ 
+ 	"Is the class arg pointers with at least 3 fields?"
+ 	self genGetFormatOf: Arg0Reg
+ 		into: TempReg
+ 		leastSignificantHalfOfBaseHeaderIntoScratch: nil.
+ 	cogit CmpCq: objectMemory nonIndexablePointerFormat R: TempReg.
+ 	jumpNotFixedPointers := cogit JumpNonZero: 0.
+ 	
+ 	self genGetRawSlotSizeOfNonImm: Arg0Reg into: TempReg.
+ 	cogit CmpCq: InstanceSpecificationIndex + 1 R: TempReg.
+ 	jumpTooSmall := cogit JumpLess: 0.
+ 
+ 	"get class's hash & fail if 0"
+ 	self genGetHashFieldNonImmOf: Arg0Reg into: halfHeaderReg.
+ 	jumpUnhashed := cogit JumpZero: 0.
+ 
+ 	"get class's format inst var for both inst spec (format field) and num fixed fields"
+ 	self genLoadSlot: InstanceSpecificationIndex sourceReg: Arg0Reg destReg: instSpecReg.
+ 	cogit MoveR: instSpecReg R: TempReg.
+ 	jumpBadFormat := self genJumpNotSmallIntegerInScratchReg: TempReg.
+ 	self genConvertSmallIntegerToIntegerInReg: instSpecReg.
+ 	cogit LogicalShiftRightCq: objectMemory fixedFieldsFieldWidth R: TempReg.
+ 	cogit AndCq: objectMemory formatMask R: TempReg.
+ 	cogit AndCq: objectMemory fixedFieldsOfClassFormatMask R: instSpecReg.
+ 	"fail if not fixed or if ephemeron (rare beasts so save the cycles)"
+ 	cogit CmpCq: objectMemory nonIndexablePointerFormat R: TempReg.
+ 	jumpVariableOrEphemeron := cogit JumpAbove: 0.
+ 	cogit CmpCq: objectMemory numSlotsMask R: instSpecReg.
+ 	jumpTooBig := cogit JumpAboveOrEqual: 0.
+ 	"Add format to classIndex/format half header; other word contains numSlots"
+ 	cogit LogicalShiftLeftCq: objectMemory formatShift R: TempReg.
+ 	cogit AddR: TempReg R: halfHeaderReg.
+ 	"write half header now; it frees halfHeaderReg"
+ 	cogit MoveR: halfHeaderReg Mw: 0 r: Arg1Reg.
+ 	"save unrounded numSlots for header"
+ 	cogit MoveR: instSpecReg R: halfHeaderReg.
+ 	"compute byte size; remember 0-sized objects still need 1 slot & allocation is
+ 	 rounded up to 8 bytes."
+ 	cogit CmpCq: 0 R: byteSizeReg. "a.k.a. instSpecReg"
+ 	jumpHasSlots := cogit JumpNonZero: 0.
+ 	cogit MoveCq: objectMemory baseHeaderSize * 2 R: byteSizeReg.
+ 	skip := cogit Jump: 0.
+ 	"round up to allocationUnit"
+ 	jumpHasSlots jmpTarget:
+ 	(cogit MoveR: byteSizeReg R: TempReg).
+ 	cogit AndCq: 1 R: TempReg.
+ 	cogit AddR: TempReg R: byteSizeReg.
+ 	cogit AddCq: objectMemory baseHeaderSize / objectMemory wordSize R: byteSizeReg.
+ 	cogit LogicalShiftLeftCq: objectMemory shiftForWord R: byteSizeReg.
+ 	skip jmpTarget:
+ 	"shift halfHeaderReg to put numSlots in correct place"
+ 	(cogit LogicalShiftLeftCq: objectMemory numSlotsHalfShift R: halfHeaderReg).
+ 	"check if allocation fits (freeSize + byteSize < scavengeThreshold); scavengeThreshold is constant."
+ 	cogit AddR: Arg1Reg R: byteSizeReg.
+ 	cogit CmpCq: objectMemory getScavengeThreshold R: byteSizeReg.
+ 	jumpNoSpace := cogit JumpAboveOrEqual: 0.
+ 	"write back new freeStart; get result. byteSizeReg holds new freeStart, the limit of the object"
+ 	cogit MoveR: byteSizeReg Aw: objectMemory freeStartAddress.
+ 	cogit MoveR: Arg1Reg R: ReceiverResultReg.
+ 	"write other half of header (numSlots/identityHash)"
+ 	cogit MoveR: halfHeaderReg Mw: 4 r: Arg1Reg.
+ 	"now fill"
+ 	cogit LoadEffectiveAddressMw: objectMemory baseHeaderSize r: ReceiverResultReg R: Arg1Reg.
+ 	cogit MoveCq: objectMemory nilObject R: fillReg.
+ 	"at least two words; so can make this a [fill 2 words. reached limit?] whileFalse"
+ 	fillLoop := 
+ 	cogit MoveR: fillReg Mw: 0 r: Arg1Reg.
+ 	cogit MoveR: fillReg Mw: 4 r: Arg1Reg.
+ 	cogit AddCq: 8 R: Arg1Reg.
+ 	cogit CmpR: Arg1Reg R: byteSizeReg.
+ 	cogit JumpAbove: fillLoop.
+ 	cogit RetN: retNoffset.
+ 
+ 	jumpNotFixedPointers jmpTarget:
+ 	(jumpBadFormat jmpTarget:
+ 	(jumpTooSmall jmpTarget:
+ 	(jumpImmediate jmpTarget:
+ 	(jumpUnhashed jmpTarget:
+ 	(jumpVariableOrEphemeron jmpTarget:
+ 	(jumpTooBig jmpTarget:
+ 	(jumpNoSpace jmpTarget: cogit Label))))))).
+ 
+ 	^0!

Item was added:
+ ----- Method: CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveMirrorNewWithArg: (in category 'primitive generators') -----
+ genInnerPrimitiveMirrorNewWithArg: retNoffset
+ 	"Implement instantiateVariableClass:withSize: for convenient cases:
+ 	- the class argument has a hash
+ 	- the class argument is variable and not compiled method
+ 	- single word header/num slots < numSlotsMask
+ 	- the result fits in eden
+ 	See superclass method for dynamic frequencies of formats.
+ 	For the moment we implement only arrayFormat, firstByteFormat & firstLongFormat"
+ 
+ 	| halfHeaderReg fillReg instSpecReg byteSizeReg maxSlots
+ 	  jumpArrayTooBig jumpByteTooBig jumpLongTooBig
+ 	  jumpArrayFormat jumpByteFormat jumpBytePrepDone jumpLongPrepDone
+ 	  jumpUnhashed jumpTooSmall jumpImmediate jumpNotFixedPointers
+ 	  jumpNElementsNonInt jumpFailCuzFixed jumpNoSpace jumpHasSlots fillLoop skip |
+ 	<var: 'skip' type: #'AbstractInstruction *'>
+ 	<var: 'fillLoop' type: #'AbstractInstruction *'>	
+ 	<var: 'jumpHasSlots' type: #'AbstractInstruction *'>
+ 	<var: 'jumpNoSpace' type: #'AbstractInstruction *'>
+ 	<var: 'jumpTooSmall' type: #'AbstractInstruction *'>
+ 	<var: 'jumpUnhashed' type: #'AbstractInstruction *'>
+ 	<var: 'jumpImmediate' type: #'AbstractInstruction *'>
+ 	<var: 'jumpByteFormat' type: #'AbstractInstruction *'>
+ 	<var: 'jumpByteTooBig' type: #'AbstractInstruction *'>
+ 	<var: 'jumpLongTooBig' type: #'AbstractInstruction *'>
+ 	<var: 'jumpArrayFormat' type: #'AbstractInstruction *'>
+ 	<var: 'jumpArrayTooBig' type: #'AbstractInstruction *'>
+ 	<var: 'jumpFailCuzFixed' type: #'AbstractInstruction *'>
+ 	<var: 'jumpBytePrepDone' type: #'AbstractInstruction *'>
+ 	<var: 'jumpLongPrepDone' type: #'AbstractInstruction *'>
+ 	<var: 'jumpNElementsNonInt' type: #'AbstractInstruction *'>
+ 	<var: 'jumpNotFixedPointers' type: #'AbstractInstruction *'>
+ 
+ 	"half header will contain 1st half of header (classIndex/class's hash & format),
+ 	 then 2nd half of header (numSlots) and finally fill value (nilObject)."
+ 	halfHeaderReg := fillReg := SendNumArgsReg.
+ 	"inst spec will hold class's instance specification and then byte size and finally numSlots half of header"
+ 	instSpecReg := byteSizeReg := ClassReg.
+ 	"The max slots we'll allocate here are those for a single header"
+ 	maxSlots := objectMemory numSlotsMask - 1.
+ 
+ 	"check size and fail if not a +ve integer"
+ 	cogit MoveR: Arg1Reg R: TempReg.
+ 	jumpNElementsNonInt := self genJumpNotSmallIntegerInScratchReg: TempReg.
+ 
+ 	"Is the class arg pointers with at least 3 fields?"
+ 	cogit MoveR: Arg0Reg R: TempReg.
+ 	jumpImmediate := self genJumpImmediateInScratchReg: TempReg.
+ 
+ 	self genGetFormatOf: Arg0Reg
+ 		into: TempReg
+ 		leastSignificantHalfOfBaseHeaderIntoScratch: nil.
+ 	cogit CmpCq: objectMemory nonIndexablePointerFormat R: TempReg.
+ 	jumpNotFixedPointers := cogit JumpNonZero: 0.
+ 	
+ 	self genGetRawSlotSizeOfNonImm: Arg0Reg into: TempReg.
+ 	cogit CmpCq: InstanceSpecificationIndex + 1 R: TempReg.
+ 	jumpTooSmall := cogit JumpLess: 0.
+ 
+ 	"get class's hash & fail if 0"
+ 	self genGetHashFieldNonImmOf: Arg0Reg into: halfHeaderReg.
+ 	jumpUnhashed := cogit JumpZero: 0.
+ 
+ 	"The basicNew: code (genInnerPrimitiveNewWithArg:) expects class in ReceiverResultReg
+ 	 and size in Arg0Reg.  Shuffle args to match, undoing on failure."
+ 	cogit
+ 		PushR: ReceiverResultReg;
+ 		MoveR: Arg0Reg R: ReceiverResultReg;
+ 		MoveR: Arg1Reg R: Arg0Reg.
+ 
+ 	"get freeStart as early as possible so as not to wait later..."
+ 	cogit MoveAw: objectMemory freeStartAddress R: Arg1Reg.
+ 	"get class's hash & fail if 0"
+ 	self genGetHashFieldNonImmOf: ReceiverResultReg into: halfHeaderReg.
+ 	jumpUnhashed := cogit JumpZero: 0.
+ 	"get class's format inst var for inst spec (format field)"
+ 	self genLoadSlot: InstanceSpecificationIndex sourceReg: ReceiverResultReg destReg: instSpecReg.
+ 	cogit LogicalShiftRightCq: objectMemory fixedFieldsFieldWidth + self numSmallIntegerTagBits R: instSpecReg.
+ 	cogit AndCq: objectMemory formatMask R: instSpecReg.
+ 	"Add format to classIndex/format half header now"
+ 	cogit MoveR: instSpecReg R: TempReg.
+ 	cogit LogicalShiftLeftCq: objectMemory formatShift R: TempReg.
+ 	cogit AddR: TempReg R: halfHeaderReg.
+ 	"get integer value of num fields in TempReg now"
+ 	cogit MoveR: Arg0Reg R: TempReg.
+ 	self genConvertSmallIntegerToIntegerInReg: TempReg.
+ 	"dispatch on format, failing if not variable or if compiled method"
+ 	cogit CmpCq: objectMemory arrayFormat R: instSpecReg.
+ 	jumpArrayFormat := cogit JumpZero: 0.
+ 	cogit CmpCq: objectMemory firstByteFormat R: instSpecReg.
+ 	jumpByteFormat := cogit JumpZero: 0.
+ 	cogit CmpCq: objectMemory firstLongFormat R: instSpecReg.
+ 	jumpFailCuzFixed := cogit JumpNonZero: 0.
+ 
+ 	cogit CmpCq: (objectMemory integerObjectOf: maxSlots) R: Arg0Reg.
+ 	jumpLongTooBig := cogit JumpAbove: 0.
+ 	"save num elements/slot size to instSpecReg"
+ 	cogit MoveR: TempReg R: instSpecReg.
+ 	"push fill value"
+ 	cogit MoveCq: 0 R: TempReg.
+ 	cogit PushR: TempReg.
+ 	jumpLongPrepDone := cogit Jump: 0. "go allocate"
+ 
+ 	jumpByteFormat jmpTarget:
+ 	(cogit CmpCq: (objectMemory integerObjectOf: maxSlots * objectMemory wordSize) R: Arg0Reg).
+ 	jumpByteTooBig := cogit JumpAbove: 0.
+ 	"save num elements to instSpecReg"
+ 	cogit MoveR: TempReg R: instSpecReg.
+ 	"compute odd bits and add into halfHeaderReg; oddBits := 4 - nElements bitAnd: 3"
+ 	cogit MoveCq: objectMemory wordSize R: TempReg.
+ 	cogit SubR: instSpecReg R: TempReg.
+ 	cogit AndCq: objectMemory wordSize - 1 R: TempReg.
+ 	cogit LogicalShiftLeftCq: objectMemory formatShift R: TempReg.
+ 	cogit AddR: TempReg R: halfHeaderReg.
+ 	"round up num elements to numSlots in instSpecReg"
+ 	cogit AddCq: objectMemory wordSize - 1 R: instSpecReg.
+ 	cogit LogicalShiftRightCq: objectMemory shiftForWord R: instSpecReg.
+ 	"push fill value"
+ 	cogit MoveCq: 0 R: TempReg.
+ 	cogit PushR: TempReg.
+ 	jumpBytePrepDone := cogit Jump: 0. "go allocate"
+ 
+ 	jumpArrayFormat jmpTarget:
+ 		(cogit CmpCq: (objectMemory integerObjectOf: maxSlots) R: Arg0Reg).
+ 	jumpArrayTooBig := cogit JumpAbove: 0.
+ 	"save num elements/slot size to instSpecReg"
+ 	cogit MoveR: TempReg R: instSpecReg.
+ 	"push fill value"
+ 	cogit MoveCw: objectMemory nilObject R: TempReg.
+ 	cogit PushR: TempReg.
+ 	"fall through to allocate"
+ 
+ 	jumpBytePrepDone jmpTarget:
+ 	(jumpLongPrepDone jmpTarget: cogit Label).
+ 
+ 	"write half header now; it frees halfHeaderReg"
+ 	cogit MoveR: halfHeaderReg Mw: 0 r: Arg1Reg.
+ 	"save numSlots to halfHeaderReg"
+ 	cogit MoveR: instSpecReg R: halfHeaderReg.
+ 	"compute byte size; remember 0-sized objects still need 1 slot & allocation is
+ 	 rounded up to 8 bytes."
+ 	cogit CmpCq: 0 R: byteSizeReg. "a.k.a. instSpecReg"
+ 	jumpHasSlots := cogit JumpNonZero: 0.
+ 	cogit MoveCq: objectMemory baseHeaderSize * 2 R: byteSizeReg.
+ 	skip := cogit Jump: 0.
+ 	"round up to allocationUnit"
+ 	jumpHasSlots jmpTarget:
+ 	(cogit MoveR: byteSizeReg R: TempReg).
+ 	cogit AndCq: 1 R: TempReg.
+ 	cogit AddR: TempReg R: byteSizeReg.
+ 	cogit AddCq: objectMemory baseHeaderSize / objectMemory wordSize R: byteSizeReg.
+ 	cogit LogicalShiftLeftCq: objectMemory shiftForWord R: byteSizeReg.
+ 	skip jmpTarget:
+ 	"shift halfHeaderReg to put numSlots in correct place"
+ 	(cogit LogicalShiftLeftCq: objectMemory numSlotsHalfShift R: halfHeaderReg).
+ 	"check if allocation fits"
+ 	cogit AddR: Arg1Reg R: byteSizeReg.
+ 	cogit CmpCq: objectMemory getScavengeThreshold R: byteSizeReg.
+ 	jumpNoSpace := cogit JumpAboveOrEqual: 0.
+ 	"get result, increment freeStart and write it back. Arg1Reg holds new freeStart, the limit of the object"
+ 	cogit MoveR: Arg1Reg R: ReceiverResultReg.
+ 	cogit MoveR: byteSizeReg Aw: objectMemory freeStartAddress.
+ 	"write other half of header (numSlots/0 identityHash)"
+ 	cogit MoveR: halfHeaderReg Mw: 4 r: ReceiverResultReg.
+ 	"now fill"
+ 	cogit PopR: fillReg.
+ 	cogit PopR: TempReg. "discard pushed receiver"
+ 	cogit LoadEffectiveAddressMw: objectMemory baseHeaderSize r: ReceiverResultReg R: Arg1Reg.
+ 	"at least two words; so can make this a [fill 2 words. reached limit?] whileFalse"
+ 	fillLoop := 
+ 	cogit MoveR: fillReg Mw: 0 r: Arg1Reg.
+ 	cogit MoveR: fillReg Mw: 4 r: Arg1Reg.
+ 	cogit AddCq: 8 R: Arg1Reg.
+ 	cogit CmpR: Arg1Reg R: byteSizeReg.
+ 	cogit JumpAbove: fillLoop.
+ 	cogit RetN: retNoffset.
+ 
+ 	"pop discarded fill value & fall through to failure"
+ 	jumpNoSpace jmpTarget: (cogit PopR: TempReg).
+ 
+ 	jumpFailCuzFixed jmpTarget:
+ 	(jumpArrayTooBig jmpTarget:
+ 	(jumpByteTooBig jmpTarget:
+ 	(jumpLongTooBig jmpTarget: cogit Label))).
+ 
+ 	"unshuffle arguments"
+ 	cogit
+ 		MoveR: Arg0Reg R: Arg1Reg;
+ 		MoveR: ReceiverResultReg R: Arg0Reg;
+ 		PopR: ReceiverResultReg.
+ 
+ 	jumpUnhashed jmpTarget:
+ 	(jumpImmediate jmpTarget:
+ 	(jumpNotFixedPointers jmpTarget:
+ 	(jumpTooSmall jmpTarget:
+ 	(jumpNElementsNonInt jmpTarget: cogit Label)))).
+ 
+ 	^0!

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveNew: (in category 'primitive generators') -----
  genInnerPrimitiveNew: retNoffset
+ 	"Implement 1-arg (instantiateFixedClass:) primitiveNew for convenient cases:
+ 	- the class argument has a hash
+ 	- the class argument is fixed size (excluding ephemerons to save instructions & miniscule time)
- 	"Implement primitiveNew for convenient cases:
- 	- the receiver has a hash
- 	- the receiver is fixed size (excluding ephemerons to save instructions & miniscule time)
  	- single word header/num slots < numSlotsMask
  	- the result fits in eden (actually below scavengeThreshold)"
  
  	| halfHeaderReg fillReg instSpecReg byteSizeReg
+ 	  jumpImmediate jumpUnhashed jumpNotFixedPointers jumpTooSmall jumpBadFormat
+ 	  jumpNoSpace jumpTooBig jumpHasSlots jumpVariableOrEphemeron
- 	  jumpUnhashed jumpVariableOrEphemeron jumpNoSpace jumpTooBig jumpHasSlots
  	  fillLoop skip |
  	<var: 'skip' type: #'AbstractInstruction *'>
  	<var: 'fillLoop' type: #'AbstractInstruction *'>
  	<var: 'jumpTooBig' type: #'AbstractInstruction *'>
  	<var: 'jumpHasSlots' type: #'AbstractInstruction *'>
  	<var: 'jumpNoSpace' type: #'AbstractInstruction *'>
+ 	<var: 'jumpTooSmall' type: #'AbstractInstruction *'>
  	<var: 'jumpUnhashed' type: #'AbstractInstruction *'>
+ 	<var: 'jumpImmediate' type: #'AbstractInstruction *'>
+ 	<var: 'jumpBadFormat' type: #'AbstractInstruction *'>
+ 	<var: 'jumpNotFixedPointers' type: #'AbstractInstruction *'>
  	<var: 'jumpVariableOrEphemeron' type: #'AbstractInstruction *'>
  
  	"half header will contain 1st half of header (classIndex/class's hash & format),
  	 then 2nd half of header (numSlots/fixed size) and finally fill value (nilObject)."
  	halfHeaderReg := fillReg := SendNumArgsReg.
  	"inst spec will hold class's instance specification, then byte size and finally end of new object."
  	instSpecReg := byteSizeReg := ClassReg.
  
  	"get freeStart as early as possible so as not to wait later..."
  	cogit MoveAw: objectMemory freeStartAddress R: Arg1Reg.
+ 
+ 	"validate class arg; sigh, this mirror crap hobbles unfairly; there is a better way with selector namespaces..."
+ 	cogit MoveR: Arg0Reg R: TempReg.
+ 	jumpImmediate := cogit genJumpImmediateInScratchReg: TempReg.
+ 
+ 	"Is the class arg pointers with at least 3 fields?"
+ 	self genGetFormatOf: Arg0Reg
+ 		into: TempReg
+ 		leastSignificantHalfOfBaseHeaderIntoScratch: nil.
+ 	cogit CmpCq: objectMemory nonIndexablePointerFormat R: TempReg.
+ 	jumpNotFixedPointers := cogit JumpNonZero: 0.
+ 	
+ 	self genGetRawSlotSizeOfNonImm: Arg0Reg into: TempReg.
+ 	self CmpCq: InstanceSpecificationIndex + 1 R: TempReg.
+ 	jumpTooSmall := cogit JumpLess: 0.
+ 
  	"get class's hash & fail if 0"
+ 	self genGetHashFieldNonImmOf: Arg0Reg into: halfHeaderReg.
- 	self genGetHashFieldNonImmOf: ReceiverResultReg into: halfHeaderReg.
  	jumpUnhashed := cogit JumpZero: 0.
+ 
  	"get class's format inst var for both inst spec (format field) and num fixed fields"
+ 	self genLoadSlot: InstanceSpecificationIndex sourceReg: Arg0Reg destReg: instSpecReg.
+ 	cogit MoveR: instSpecReg R: TempReg.
+ 	jumpBadFormat := cogit genJumpNotSmallIntegerInScratchReg: TempReg.
+ 	self genConvertSmallIntegerToIntegerInReg: instSpecReg.
- 	self genLoadSlot: InstanceSpecificationIndex sourceReg: ReceiverResultReg destReg: TempReg.
- 	self genConvertSmallIntegerToIntegerInReg: TempReg.
- 	cogit MoveR: TempReg R: instSpecReg.
  	cogit LogicalShiftRightCq: objectMemory fixedFieldsFieldWidth R: TempReg.
  	cogit AndCq: objectMemory formatMask R: TempReg.
  	cogit AndCq: objectMemory fixedFieldsOfClassFormatMask R: instSpecReg.
  	"fail if not fixed or if ephemeron (rare beasts so save the cycles)"
  	cogit CmpCq: objectMemory nonIndexablePointerFormat R: TempReg.
  	jumpVariableOrEphemeron := cogit JumpAbove: 0.
  	cogit CmpCq: objectMemory numSlotsMask R: instSpecReg.
  	jumpTooBig := cogit JumpAboveOrEqual: 0.
  	"Add format to classIndex/format half header; other word contains numSlots"
  	cogit LogicalShiftLeftCq: objectMemory formatShift R: TempReg.
  	cogit AddR: TempReg R: halfHeaderReg.
  	"write half header now; it frees halfHeaderReg"
  	cogit MoveR: halfHeaderReg Mw: 0 r: Arg1Reg.
  	"save unrounded numSlots for header"
  	cogit MoveR: instSpecReg R: halfHeaderReg.
  	"compute byte size; remember 0-sized objects still need 1 slot & allocation is
  	 rounded up to 8 bytes."
  	cogit CmpCq: 0 R: byteSizeReg. "a.k.a. instSpecReg"
  	jumpHasSlots := cogit JumpNonZero: 0.
  	cogit MoveCq: objectMemory baseHeaderSize * 2 R: byteSizeReg.
  	skip := cogit Jump: 0.
  	"round up to allocationUnit"
  	jumpHasSlots jmpTarget:
  	(cogit MoveR: byteSizeReg R: TempReg).
  	cogit AndCq: 1 R: TempReg.
  	cogit AddR: TempReg R: byteSizeReg.
  	cogit AddCq: objectMemory baseHeaderSize / objectMemory wordSize R: byteSizeReg.
  	cogit LogicalShiftLeftCq: objectMemory shiftForWord R: byteSizeReg.
  	skip jmpTarget:
  	"shift halfHeaderReg to put numSlots in correct place"
  	(cogit LogicalShiftLeftCq: objectMemory numSlotsHalfShift R: halfHeaderReg).
  	"check if allocation fits (freeSize + byteSize < scavengeThreshold); scavengeThreshold is constant."
  	cogit AddR: Arg1Reg R: byteSizeReg.
  	cogit CmpCq: objectMemory getScavengeThreshold R: byteSizeReg.
  	jumpNoSpace := cogit JumpAboveOrEqual: 0.
  	"write back new freeStart; get result. byteSizeReg holds new freeStart, the limit of the object"
  	cogit MoveR: byteSizeReg Aw: objectMemory freeStartAddress.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  	"write other half of header (numSlots/identityHash)"
  	cogit MoveR: halfHeaderReg Mw: 4 r: Arg1Reg.
  	"now fill"
  	cogit LoadEffectiveAddressMw: objectMemory baseHeaderSize r: ReceiverResultReg R: Arg1Reg.
  	cogit MoveCq: objectMemory nilObject R: fillReg.
  	"at least two words; so can make this a [fill 2 words. reached limit?] whileFalse"
  	fillLoop := 
  	cogit MoveR: fillReg Mw: 0 r: Arg1Reg.
  	cogit MoveR: fillReg Mw: 4 r: Arg1Reg.
  	cogit AddCq: 8 R: Arg1Reg.
  	cogit CmpR: Arg1Reg R: byteSizeReg.
  	cogit JumpAbove: fillLoop.
  	cogit RetN: retNoffset.
  
+ 	jumpNotFixedPointers jmpTarget:
+ 	(jumpBadFormat jmpTarget:
+ 	(jumpTooSmall jmpTarget:
+ 	(jumpImmediate jmpTarget:
+ 	(jumpUnhashed jmpTarget:
- 	jumpUnhashed jmpTarget:
  	(jumpVariableOrEphemeron jmpTarget:
  	(jumpTooBig jmpTarget:
+ 	(jumpNoSpace jmpTarget: cogit Label))))))).
- 	(jumpNoSpace jmpTarget: cogit Label))).
  
  	^0!

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveStringAt: (in category 'primitive generators') -----
  genInnerPrimitiveStringAt: retNoffset
  	"Implement the guts of primitiveStringAt; dispatch on size"
  	| formatReg jumpNotIndexable jumpSmallSize jumpBadIndex done
  	  jumpIsBytes jumpIsShorts jumpIsWords jumpWordTooBig
  	  jumpBytesOutOfBounds jumpShortsOutOfBounds jumpWordsOutOfBounds |
  	<inline: true>
  	"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
  	<var: #done type: #'AbstractInstruction *'>
  	<var: #jumpIsBytes type: #'AbstractInstruction *'>
  	<var: #jumpIsShorts type: #'AbstractInstruction *'>
  	<var: #jumpIsWords type: #'AbstractInstruction *'>
  	<var: #jumpBadIndex type: #'AbstractInstruction *'>
  	<var: #jumpSmallSize type: #'AbstractInstruction *'>
  	<var: #jumpWordTooBig type: #'AbstractInstruction *'>
  	<var: #jumpNotIndexable type: #'AbstractInstruction *'>
  	<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpShortsOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
  
  	cogit MoveR: Arg0Reg R: TempReg.
  	cogit MoveR: Arg0Reg R: Arg1Reg.
  	jumpBadIndex := self genJumpNotSmallIntegerInScratchReg: TempReg.
  	self genConvertSmallIntegerToIntegerInReg: Arg1Reg.
  	cogit SubCq: 1 R: Arg1Reg. "1-rel => 0-rel"
  
+ 	self genGetFormatOf: ReceiverResultReg
+ 		into: (formatReg := SendNumArgsReg)
+ 		leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
- 	formatReg := SendNumArgsReg.
- 	cogit
- 		MoveMw: 0 r: ReceiverResultReg R: formatReg;				"formatReg := least significant half of self baseHeader: receiver"
- 		MoveR: formatReg R: TempReg;
- 		LogicalShiftRightCq: objectMemory formatShift R: formatReg;
- 		AndCq: objectMemory formatMask R: formatReg.	"formatReg := self formatOfHeader: destReg"
  
  	"get numSlots into ClassReg."
  	cogit MoveCq: 0 R: ClassReg. "N.B. MoveMb:r:R: does not zero other bits"
  	cogit MoveMb: 7 r: ReceiverResultReg R: ClassReg. "MSB of header"
  	cogit CmpCq: objectMemory numSlotsMask R: ClassReg.
  	jumpSmallSize := cogit JumpLess: 0.
  	cogit MoveMw: -8 r: ReceiverResultReg R: ClassReg. "LSW of overflow size header"
  
  	"dispatch on format in a combination of highest dynamic frequency order first and convenience.
  		  0 = 0 sized objects (UndefinedObject True False et al)
  		  1 = non-indexable objects with inst vars (Point et al)
  		  2 = indexable objects with no inst vars (Array et al)
  		  3 = indexable objects with inst vars (MethodContext AdditionalMethodState et al)
  		  4 = weak indexable objects with inst vars (WeakArray et al)
  		  5 = weak non-indexable objects with inst vars (ephemerons) (Ephemeron)
  		  6 unused, reserved for exotic pointer objects?
  		  7 Forwarded Object, 1st field is pointer, rest of fields are ignored
  		  8 unused, reserved for exotic non-pointer objects?
  		  9 (?) 64-bit indexable
  		10 - 11 32-bit indexable
  		12 - 15 16-bit indexable
  		16 - 23 byte indexable
  		24 - 31 compiled method"
  	jumpSmallSize jmpTarget:
  					(cogit CmpCq: objectMemory firstByteFormat R: formatReg).
  	jumpIsBytes := cogit JumpGreaterOrEqual: 0.
  					cogit CmpCq: objectMemory firstShortFormat R: formatReg.
  	jumpIsShorts := cogit JumpGreaterOrEqual: 0.
  					cogit CmpCq: objectMemory firstLongFormat R: formatReg.
  	jumpIsWords := cogit JumpGreaterOrEqual: 0.
  	jumpNotIndexable := cogit Jump: 0.
  
  	jumpIsBytes jmpTarget:
  		(cogit LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg).
  		cogit AndCq: objectMemory wordSize - 1 R: formatReg.
  		cogit SubR: formatReg R: ClassReg;
  		CmpR: Arg1Reg R: ClassReg.
  	jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit AddCq: objectMemory baseHeaderSize R: Arg1Reg.
  	cogit MoveXbr: Arg1Reg R: ReceiverResultReg R: ReceiverResultReg.
  	done := cogit Label.
  	self genConvertIntegerToCharacterInReg: ReceiverResultReg.
  	cogit RetN: retNoffset.
  
  	jumpIsShorts jmpTarget:
  		(cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg).
  		cogit AndCq: 1 R: formatReg.
  		cogit SubR: formatReg R: ClassReg;
  		CmpR: Arg1Reg R: ClassReg.
  	jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit AddR: Arg1Reg R: ReceiverResultReg.
  	cogit MoveM16: objectMemory baseHeaderSize r: ReceiverResultReg R: ReceiverResultReg.
  	cogit Jump: done.
  
  	jumpIsWords jmpTarget:
  		(cogit CmpR: Arg1Reg R: ClassReg).
  	jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
  	cogit MoveXwr: Arg1Reg R: ReceiverResultReg R: TempReg.
  	cogit SubCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
  	jumpWordTooBig := self jumpNotCharacterUnsignedValueInRegister: TempReg.
  	cogit MoveR: TempReg R: ReceiverResultReg.
  	cogit Jump: done.
  
  	jumpBytesOutOfBounds jmpTarget:
  	(jumpShortsOutOfBounds jmpTarget:
  	(jumpWordsOutOfBounds jmpTarget:
  	(jumpWordTooBig jmpTarget:
  	(jumpNotIndexable jmpTarget: 
  	(jumpBadIndex jmpTarget: cogit Label))))).
  
  	^0!

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>genInnerPrimitiveStringAtPut: (in category 'primitive generators') -----
  genInnerPrimitiveStringAtPut: retNoffset
  	"Implement the guts of primitiveStringAtPut"
  	| formatReg jumpSmallSize jumpImmediate jumpBadIndex jumpBadArg
  	  jumpWordsDone jumpBytesOutOfRange
  	  jumpIsBytes jumpNotString jumpIsCompiledMethod
  	  jumpBytesOutOfBounds jumpWordsOutOfBounds jumpShortsUnsupported |
  	<inline: true>
  	"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
  	<var: #jumpBadArg type: #'AbstractInstruction *'>
  	<var: #jumpIsBytes type: #'AbstractInstruction *'>
  	<var: #jumpBadIndex type: #'AbstractInstruction *'>
  	<var: #jumpSmallSize type: #'AbstractInstruction *'>
  	<var: #jumpImmediate type: #'AbstractInstruction *'>
  	<var: #jumpWordsDone type: #'AbstractInstruction *'>
  	<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
  	<var: #jumpShortsUnsupported type: #'AbstractInstruction *'>
  	<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
  
  	cogit MoveR: ReceiverResultReg R: TempReg.
  	jumpImmediate := self genJumpImmediateInScratchReg: TempReg.
  	cogit MoveR: Arg0Reg R: TempReg.
  	jumpBadIndex := self genJumpNotSmallIntegerInScratchReg: TempReg.
  	cogit MoveR: Arg1Reg R: TempReg.
  	jumpBadArg := self genJumpNotCharacterInScratchReg: TempReg.
  	self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
  	cogit SubCq: 1 R: Arg0Reg. "1-rel => 0-rel"
  
+ 	"formatReg := self formatOf: ReceiverResultReg"
+ 	self genGetFormatOf: ReceiverResultReg
+ 		into: (formatReg := SendNumArgsReg)
+ 		leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
- 	formatReg := SendNumArgsReg.
- 	cogit
- 		MoveMw: 0 r: ReceiverResultReg R: formatReg;		"formatReg := least significant half of self baseHeader: receiver"
- 		MoveR: formatReg R: TempReg;
- 		LogicalShiftRightCq: objectMemory formatShift R: formatReg;
- 		AndCq: objectMemory formatMask R: formatReg.	"formatReg := self formatOfHeader: destReg"
  
  	"get numSlots into ClassReg."
  	cogit MoveCq: 0 R: ClassReg. "N.B. MoveMb:r:R: does not zero other bits"
  	cogit MoveMb: 7 r: ReceiverResultReg R: ClassReg. "MSB of header"
  	cogit CmpCq: objectMemory numSlotsMask R: ClassReg.
  	jumpSmallSize := cogit JumpBelow: 0.
  	cogit MoveMw: -8 r: ReceiverResultReg R: ClassReg. "LSW of overflow size header"
  
  	"dispatch on format; words and/or bytes.
  		  0 to 8 = pointer objects, forwarders, reserved.
  		  9 (?) 64-bit indexable
  		10 - 11 32-bit indexable
  		12 - 15 16-bit indexable (but unused)
  		16 - 23 byte indexable
  		24 - 31 compiled method"
  	jumpSmallSize jmpTarget:
  					(cogit CmpCq: objectMemory firstLongFormat R: formatReg).
  	jumpNotString := cogit JumpBelowOrEqual: 0.
  					cogit CmpCq: objectMemory firstCompiledMethodFormat R: formatReg.
  	jumpIsCompiledMethod := cogit JumpAboveOrEqual: 0.
  					cogit CmpCq: objectMemory firstByteFormat R: formatReg.
  	jumpIsBytes := cogit JumpGreaterOrEqual: 0.
  					cogit CmpCq: objectMemory firstShortFormat R: formatReg.
  	jumpShortsUnsupported := cogit JumpGreaterOrEqual: 0.
  
  	cogit CmpR: Arg0Reg R: ClassReg.
  	jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit MoveR: Arg1Reg R: TempReg.
  	self genConvertSmallIntegerToIntegerInReg: TempReg.
  	cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg0Reg.
  	cogit MoveR: TempReg Xwr: Arg0Reg R: ReceiverResultReg.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  	jumpWordsDone := cogit Jump: 0.
  
  	"there are no shorts as yet.  so this is dead code:
  	jumpIsShorts jmpTarget:
  		(cogit CmpCq: (objectMemory integerObjectOf: 65535) R: Arg1Reg).
  	jumpShortsOutOfRange := cogit JumpAbove: 0.
  	cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
  	cogit AndCq: 1 R: formatReg.
  	cogit SubR: formatReg R: ClassReg;
  	CmpR: Arg0Reg R: ClassReg.
  	jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit MoveR: Arg1Reg R: TempReg.
  	cogit genConvertSmallIntegerToIntegerInReg: TempReg.
  	cogit AddR: Arg0Reg R: ReceiverResultReg.
  	cogit MoveR: TempReg M16: objectMemory baseHeaderSize r: ReceiverResultReg.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  	jumpShortsDone := cogit Jump: 0."
  
  	jumpIsBytes jmpTarget:
  		(cogit CmpCq: (objectMemory characterObjectOf: 255) R: Arg1Reg).
  	jumpBytesOutOfRange := cogit JumpAbove: 0.
  	cogit LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
  	cogit AndCq: objectMemory wordSize - 1 R: formatReg.
  	cogit SubR: formatReg R: ClassReg;
  	CmpR: Arg0Reg R: ClassReg.
  	jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
  	cogit MoveR: Arg1Reg R: TempReg.
  	self genConvertCharacterToCodeInReg: TempReg.
  	cogit AddCq: objectMemory baseHeaderSize R: Arg0Reg.
  	cogit MoveR: TempReg Xbr: Arg0Reg R: ReceiverResultReg.
  	cogit MoveR: Arg1Reg R: ReceiverResultReg.
  
  	jumpWordsDone jmpTarget:
  		(cogit RetN: retNoffset).
  
  	jumpBadArg jmpTarget:
  	(jumpNotString jmpTarget:
  	(jumpBytesOutOfRange jmpTarget:
  	(jumpIsCompiledMethod jmpTarget:
  	(jumpBytesOutOfBounds jmpTarget:
  	(jumpShortsUnsupported jmpTarget:
  	(jumpWordsOutOfBounds jmpTarget: cogit Label)))))).
  
  	cogit AddCq: 1 R: Arg0Reg. "0-rel => 1-rel"
  	self genConvertIntegerToSmallIntegerInScratchReg: Arg0Reg.
  
  	jumpBadIndex jmpTarget: (jumpImmediate jmpTarget: cogit Label).
  
  	^0!

Item was added:
+ ----- Method: CogObjectRepresentationForSpur>>genGetFormatOf:into:baseHeaderIntoScratch: (in category 'compile abstract instructions') -----
+ genGetFormatOf: sourceReg into: destReg baseHeaderIntoScratch: scratchReg
+ 	cogit MoveMw: 0 r: sourceReg R: destReg.
+ 	scratchReg ifNotNil:
+ 		[cogit MoveR: destReg R: scratchReg]. "destReg := (at least) least significant half of self baseHeader: receiver"
+ 	cogit LogicalShiftRightCq: objectMemory formatShift R: destReg.
+ 	cogit AndCq: objectMemory formatMask R: destReg.	"formatReg := self formatOfHeader: destReg"
+ 	^0!

Item was added:
+ ----- Method: CogObjectRepresentationForSpur>>genGetFormatOf:into:leastSignificantHalfOfBaseHeaderIntoScratch: (in category 'compile abstract instructions') -----
+ genGetFormatOf: sourceReg into: destReg leastSignificantHalfOfBaseHeaderIntoScratch: scratchRegOrNil
+ 	"Get the format of the object in sourceReg into destReg.  If scratchRegOrNil
+ 	 is not nil, load at least the least significant 32-bits (64-bits in 64-bits) of the
+ 	 header word, which contains the format, into scratchRegOrNil."
+ 	cogit MoveMw: 0 r: sourceReg R: destReg.
+ 	scratchRegOrNil ifNotNil:
+ 		[cogit MoveR: destReg R: scratchRegOrNil]. "destReg := (at least) least significant half of self baseHeader: receiver"
+ 	cogit LogicalShiftRightCq: objectMemory formatShift R: destReg.
+ 	cogit AndCq: objectMemory formatMask R: destReg.	"formatReg := self formatOfHeader: destReg"
+ 	^0!

Item was added:
+ ----- Method: CogObjectRepresentationForSpur>>genGetRawSlotSizeOfNonImm:into: (in category 'compile abstract instructions') -----
+ genGetRawSlotSizeOfNonImm: sourceReg into: destReg
+ 	"The raw numSlots field is the most significant byte of the 64-bit header word."
+ 	cogit MoveMb: 7 r: sourceReg R: destReg.
+ 	^0!

Item was changed:
  ----- Method: CogVMSimulator>>debugStackPointersFor: (in category 'debug support') -----
  debugStackPointersFor: aMethod
  	^CArrayAccessor on:
+ 		(StackDepthFinder on: (VMCompiledMethodProxy new
- 		(((NewspeakVM
- 			ifTrue: [NewspeakStackDepthFinder]
- 			ifFalse: [StackDepthFinder]) on: (VMCompiledMethodProxy new
  									for: aMethod
  									coInterpreter: self
  									objectMemory: objectMemory))
+ 			stackPointers!
- 			stackPointers)!

Item was changed:
  ----- Method: Cogit class>>initializePrimitiveTable (in category 'class initialization') -----
  initializePrimitiveTable
+ 	NewspeakVM
+ 		ifTrue: [self initializePrimitiveTableForNewsqueak]
+ 		ifFalse: [self initializePrimitiveTableForSqueak]!
- 	"Currently there is only one sequence of primitives."
- 	self initializePrimitiveTableForSqueakV3!

Item was changed:
  ----- Method: Cogit>>breakPC: (in category 'simulation only') -----
  breakPC: anAddress
  	<doNotGenerate>
  	breakPC := anAddress.
  	(breakPC isInteger
  	 and: [anAddress between: codeBase and: coInterpreter heapBase]) ifTrue:
  		[singleStep := true].
  	"If there's a breakPC then it is anded with breakBlock's result, so the breakBlock must default to true.
+ 	 If there's no breakPC the break block is used on its own and so must befault to false."
- 	If there's no breakPC the break block is used on its own and so must befault to false."
  	(breakBlock isNil
  	 or: [breakBlock method = thisContext method]) ifTrue:
  		[breakBlock := breakPC isInteger
+ 						ifTrue: [[:cogit| processor pc = breakPC]]
- 						ifTrue: [[:cogit| true]]
  						ifFalse: [[:cogit| false]]]!

Item was changed:
  ----- Method: Cogit>>genMethodAbortTrampoline (in category 'initialization') -----
  genMethodAbortTrampoline
  	"Generate the abort for a method.  This abort performs either a call of ceSICMiss:
  	 to handle a single-in-line cache miss or a call of ceStackOverflow: to handle a
  	 stack overflow.  It distinguishes the two by testing ResultReceiverReg.  If the
  	 register is zero then this is a stack-overflow because a) the receiver has already
  	 been pushed and so can be set to zero before calling the abort, and b) the
  	 receiver must always contain an object (and hence be non-zero) on SIC miss."
  	| jumpSICMiss |
  	<var: #jumpSICMiss type: #'AbstractInstruction *'>
  	opcodeIndex := 0.
  	self CmpCq: 0 R: ReceiverResultReg.
  	jumpSICMiss := self JumpNonZero: 0.
+ 	"on machines with a link register, pop the stack if the ReceiverResultReg = 0,
+ 	 i.e. if coming through the stack check abort; frame build has already pushed it."
+ 	backEnd hasLinkRegister ifTrue:
+ 		[self AddCq: BytesPerWord R: SPReg].
- 	"on machines with a link register, pop the stack if the receiverresulteg = 0"
- 		backEnd hasLinkRegister ifTrue:
- 			[self AddCq: BytesPerWord R: SPReg].
  
  	self compileTrampolineFor: #ceStackOverflow:
  		callJumpBar: true
  		numArgs: 1
  		arg: SendNumArgsReg
  		arg: nil
  		arg: nil
  		arg: nil
  		saveRegs: false
  		resultReg: nil.
  	jumpSICMiss jmpTarget: self Label.
  	^self genTrampolineFor: #ceSICMiss:
  		called: 'ceMethodAbort'
  		callJumpBar: true
  		numArgs: 1
  		arg: ReceiverResultReg
  		arg: nil
  		arg: nil
  		arg: nil
  		saveRegs: false
  		resultReg: nil
  		appendOpcodes: true!

Item was removed:
- ----- Method: CompiledMethod>>usesAlternateBytecodeSet (in category '*VMMaker-support') -----
- usesAlternateBytecodeSet
- 	"only an issue in vmcompiledmethodproxy stuff"
- 	^false!

Item was changed:
  ----- Method: CurrentImageCoInterpreterFacade>>debugStackPointersFor: (in category 'accessing') -----
  debugStackPointersFor: anOop
  	^CArrayAccessor on:
+ 		(StackDepthFinder on: (objectMap keyAtValue: anOop))
+ 			stackPointers!
- 		(((NewspeakVM
- 				ifTrue: [NewspeakStackDepthFinder]
- 				ifFalse: [StackDepthFinder]) on: (objectMap keyAtValue: anOop))
- 			stackPointers)!

Item was changed:
  ----- Method: CurrentImageCoInterpreterFacade>>longStoreBytecodeForHeader: (in category 'accessing') -----
  longStoreBytecodeForHeader: methodHeaderOop
  	"Answer the relevant long store temp bytecode, which indicates it has a primitive error code."
  	"234		11101010	i i i i i i i i	Store Temporary Variable #iiiiiiii"
  	"129 		10000001 jjkkkkkk 	Store (Receiver Variable, Temporary Location, Illegal, Literal Variable) [jj] #kkkkkk"
+ 	^coInterpreter longStoreBytecodeForHeader: methodHeaderOop
+ 	"was: ^(headerToMethodMap at: methodHeaderOop) usesAlternateBytecodeSet
- 	^(headerToMethodMap at: methodHeaderOop) usesAlternateBytecodeSet
  		ifTrue: [234]
+ 		ifFalse: [129]"!
- 		ifFalse: [129]!

Item was changed:
  ----- Method: NewspeakInterpreter>>printOopShortInner: (in category 'debug printing') -----
  printOopShortInner: oop
  	| classOop name nameLen |
  	<var: #name type: #'char *'>
  	<inline: true>
  	self printChar: $=.
  	(self isIntegerObject: oop) ifTrue:
  		[self printNum: (self integerValueOf: oop);
  			printChar: $(;
  			printHex: (self integerValueOf: oop);
  			printChar: $).
  		 ^nil].
  	(oop between: self startOfMemory and: freeBlock) ifFalse:
  		[self printHex: oop; print: ' is not on the heap'.
  		 ^nil].
  	(oop bitAnd: (BytesPerWord - 1)) ~= 0 ifTrue:
  		[self printHex: oop; print: ' is misaligned'.
  		 ^nil].
  	(self isFloatObject: oop) ifTrue:
  		[self printFloat: (self dbgFloatValueOf: oop).
  		 ^nil].
  	classOop := self fetchClassOf: oop.
  	(self sizeBitsOf: classOop) = metaclassSizeBits ifTrue:
  		[self printNameOfClass: oop count: 5.
  		 ^nil].
  	oop = self nilObject ifTrue: [self print: 'nil'. ^nil].
  	oop = self trueObject ifTrue: [self print: 'true'. ^nil].
  	oop = self falseObject ifTrue: [self print: 'false'. ^nil].
  	nameLen := self lengthOfNameOfClass: classOop.
  	nameLen = 0 ifTrue: [self print: 'a ??'. ^nil].
  	name := self nameOfClass: classOop.
  	nameLen = 10 ifTrue:
+ 		[(self str: name n: 'ByteString' cmp: 10) = 0 "strncmp is weird" ifTrue:
- 		[(self str: name n: 'ByteString' cmp: 10) not "strncmp is weird" ifTrue:
  			[self printChar: $"; printStringOf: oop; printChar: $".
  			 ^nil].
+ 		 (self str: name n: 'ByteSymbol' cmp: 10) = 0 "strncmp is weird" ifTrue:
- 		 (self str: name n: 'ByteSymbol' cmp: 10) not "strncmp is weird" ifTrue:
  			[self printChar: $#; printStringOf: oop.
  			 ^nil]].
+ 	(nameLen = 9 and: [(self str: name n: 'Character' cmp: 9) = 0]) ifTrue:
- 	(nameLen = 9 and: [(self str: name n: 'Character' cmp: 9) not]) ifTrue:
  		[self printChar: $$; printChar: (self integerValueOf: (self fetchPointer: 0 ofObject: oop)).
  		 ^nil].
  	self cCode: [self prin: 'a(n) %.*s' t: nameLen f: name]
  		inSmalltalk: [self print: 'a(n) '; print: name]!

Item was removed:
- StackDepthFinder subclass: #NewspeakStackDepthFinder
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'VMMaker-Support'!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>callPrimitive: (in category 'instruction decoding') -----
- callPrimitive: primitiveIndex
- 	"Call Primitive bytecode.  Effectively a no-op."!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>interpretNewspeakExtension:in:for: (in category 'private') -----
- interpretNewspeakExtension: offset in: method for: client
- 	| type offset2 byte2 byte3 byte4 |
- 	offset <= 6 ifTrue: 
- 		["Extended op codes 128-134"
- 		byte2 := method at: pc. pc := pc + 1.
- 		offset <= 2 ifTrue:
- 			["128-130:  extended pushes and pops"
- 			type := byte2 // 64.
- 			offset2 := byte2 \\ 64.
- 			offset = 0 ifTrue: 
- 				[type = 0 ifTrue: [^client pushReceiverVariable: offset2].
- 				type = 1 ifTrue: [^client pushTemporaryVariable: offset2].
- 				type = 2  ifTrue: [^client pushConstant: (method literalAt: offset2 + 1)].
- 				type = 3 ifTrue: [^client pushLiteralVariable: (method literalAt: offset2 + 1)]].
- 			offset = 1 ifTrue: 
- 				[type = 0 ifTrue: [^client storeIntoReceiverVariable: offset2].
- 				type = 1 ifTrue: [^client storeIntoTemporaryVariable: offset2].
- 				type = 2 ifTrue: [self error: 'illegalStore'].
- 				type = 3 ifTrue: [^client storeIntoLiteralVariable: (method literalAt: offset2 + 1)]].
- 			offset = 2 ifTrue: 
- 				[type = 0 ifTrue: [^client popIntoReceiverVariable: offset2].
- 				type = 1 ifTrue: [^client popIntoTemporaryVariable: offset2].
- 				type = 2 ifTrue: [self error: 'illegalStore'].
- 				type = 3  ifTrue: [^client popIntoLiteralVariable: (method literalAt: offset2 + 1)]]].
- 		"131-134: extended sends"
- 		offset = 3 ifTrue:  "Single extended send"
- 			[^client send: (method literalAt: byte2 \\ 32 + 1)
- 					super: false numArgs: byte2 // 32].
- 		offset = 4 ifTrue:    "Double extended do-anything"
- 			[byte3 := method at: pc. pc := pc + 1.
- 			type := byte2 // 32.
- 			type = 0 ifTrue: [^client send: (method literalAt: byte3 + 1)
- 									super: false numArgs: byte2 \\ 32].
- 			type = 1 ifTrue: [^client send: (method literalAt: byte3 + 1)
- 									super: true numArgs: byte2 \\ 32].
- 			type = 2 ifTrue: [^client pushReceiverVariable: byte3].
- 			type = 3 ifTrue: [^client pushConstant: (method literalAt: byte3 + 1)].
- 			type = 4 ifTrue: [^client pushLiteralVariable: (method literalAt: byte3 + 1)].
- 			type = 5 ifTrue: [^client storeIntoReceiverVariable: byte3].
- 			type = 6 ifTrue: [^client popIntoReceiverVariable: byte3].
- 			type = 7 ifTrue: [^client storeIntoLiteralVariable: (method literalAt: byte3 + 1)]].
- 		offset = 5 ifTrue:  "Single extended send to super"
- 			[^client send: (method literalAt: byte2 \\ 32 + 1)
- 					super: true numArgs: byte2 // 32].
- 		offset = 6 ifTrue:   "Second extended send"
- 			[^client send: (method literalAt: byte2 \\ 64 + 1)
- 					super: false numArgs: byte2 // 64]].
- 	offset = 7 ifTrue: [^client doPop].
- 	offset = 8 ifTrue: [^client doDup].
- 	offset = 9 ifTrue: [^client pushActiveContext].
- 	byte2 := method at: pc. pc := pc + 1.
- 	offset = 10 ifTrue:
- 		[^byte2 < 128
- 			ifTrue: [client pushNewArrayOfSize: byte2]
- 			ifFalse: [client pushConsArrayWithElements: byte2 - 128]].
- 	offset = 11 ifTrue: "139: pushExplicitOuter"
- 		[^client pushExplicitOuter: (method literalAt: byte2 + 1)].
- 	byte3 := method at: pc.  pc := pc + 1.
- 	offset = 12 ifTrue: [^client pushRemoteTemp: byte2 inVectorAt: byte3].
- 	offset = 13 ifTrue: [^client storeIntoRemoteTemp: byte2 inVectorAt: byte3].
- 	offset = 14 ifTrue: [^client popIntoRemoteTemp: byte2 inVectorAt: byte3].
- 	"offset = 15"
- 	byte4 := method at: pc.  pc := pc + 1.
- 	^client
- 		pushClosureCopyNumCopiedValues: (byte2 bitShift: -4)
- 		numArgs: (byte2 bitAnd: 16rF)
- 		blockSize: (byte3 * 256) + byte4!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>interpretNextInstructionFor: (in category 'decoding') -----
- interpretNextInstructionFor: client
- 	joins at: pc put: stackp.
- 	^self interpretNextNewspeakInstructionFor: client!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>interpretNextNewspeakInstructionFor: (in category 'decoding') -----
- interpretNextNewspeakInstructionFor: client
- 	"Send to the argument, client, a message that specifies the next instruction."
- 
- 	| byte type offset method |
- 	method := self method.
- 	method usesAlternateBytecodeSet ifTrue:
- 		[^self alternateInterpretNextInstructionFor: client].
- 	byte := method at: pc.
- 	type := byte // 16.
- 	offset := byte \\ 16.
- 	pc := pc+1.
- 	"We do an inline binary search on each of the possible 16 values of type:
- 	The old, cleaner but slow code is retained as a comment below"
- 	type < 8 ifTrue:
- 		[type < 4 ifTrue:
- 			[type < 2 ifTrue:
- 				[type = 0 ifTrue:
- 					 [^client pushReceiverVariable: offset].
- 				^client pushTemporaryVariable: offset]. "type = 1"
- 			 type = 2 ifTrue:
- 				[^client pushConstant: (method literalAt: offset + 1)].
- 			 ^client pushConstant: (method literalAt: offset + 17)]. "type = 3"
- 		 type < 6 ifTrue:
- 			[type = 4 ifTrue:
- 				[^client pushLiteralVariable: (method literalAt: offset + 1)].
- 			 ^client pushLiteralVariable: (method literalAt: offset + 17)]. "type = 5"
- 		 type = 6 ifTrue:
- 			[offset < 8
- 				ifTrue: [^client popIntoReceiverVariable: offset]
- 				ifFalse: [^client popIntoTemporaryVariable: offset - 8]].
- 		 "type = 7"
- 		 offset = 0 ifTrue: [^client pushReceiver].
- 		 offset < 8 ifTrue: [^client pushConstant: (SpecialConstants at: offset)].
- 		 offset = 8 ifTrue: [^client methodReturnReceiver].
- 		 offset < 12 ifTrue: [^client methodReturnConstant: (SpecialConstants at: offset - 8)].
- 		 offset = 12 ifTrue: [^client methodReturnTop].
- 		 offset = 13 ifTrue: [^client blockReturnTop].
- 		 offset = 14 ifTrue:
- 			[| byte2 |
- 			 byte := method at: pc.
- 			 pc := pc+1.
- 			byte2 := method at: pc.
- 			 pc := pc+1.
- 			^client sendToDynamicSuperclass: (method literalAt: byte2 + 1) numArgs: byte].
- 		 offset = 15 ifTrue:
- 			[byte := method at: pc.
- 			 pc := pc+1.
- 			^client pushImplicitReceiverForMessage: (method literalAt: byte + 1)]].
- 	type < 12 ifTrue:
- 		[type < 10 ifTrue:
- 			[type = 8 ifTrue:
- 				[^self interpretNewspeakExtension: offset in: method for: client].
- 			 "type = 9 (short jumps)"
- 			 offset < 8 ifTrue: [^client jump: offset + 1].
- 			 ^client jump: offset - 8 + 1 if: false].
- 		type= 10 ifTrue: "type = 10 (long jumps)"
- 			[byte := method at: pc.
- 			 pc := pc + 1.
- 			 offset < 8 ifTrue: [^client jump: offset - 4 * 256 + byte].
- 			 ^client jump: (offset bitAnd: 3) * 256 + byte if: offset < 12].
- 		"type = 11 (arithmetic special selector sends)"
- 		^client
- 			send: (Smalltalk specialSelectorAt: offset + 1)
- 			super: false
- 			numArgs: (Smalltalk specialNargsAt: offset + 1)].
- 	type = 12 ifTrue: "(miscellaneous special selector sends)"
- 		[^client
- 			send: (Smalltalk specialSelectorAt: offset + 17)
- 			super: false
- 			numArgs: (Smalltalk specialNargsAt: offset + 17)].
- 	"type = 13, 14 or 15"
- 	^client
- 		send: (method literalAt: offset + 1)
- 		super: false
- 		numArgs: type - 13
- 
- 
- "    old code
- 	type=0 ifTrue: [^client pushReceiverVariable: offset].
- 	type=1 ifTrue: [^client pushTemporaryVariable: offset].
- 	type=2 ifTrue: [^client pushConstant: (method literalAt: offset+1)].
- 	type=3 ifTrue: [^client pushConstant: (method literalAt: offset+17)].
- 	type=4 ifTrue: [^client pushLiteralVariable: (method literalAt: offset+1)].
- 	type=5 ifTrue: [^client pushLiteralVariable: (method literalAt: offset+17)].
- 	type=6
- 		ifTrue: [offset<8
- 					ifTrue: [^client popIntoReceiverVariable: offset]
- 					ifFalse: [^client popIntoTemporaryVariable: offset-8]].
- 	type=7
- 		ifTrue: [offset=0 ifTrue: [^client pushReceiver].
- 				offset<8 ifTrue: [^client pushConstant: (SpecialConstants at: offset)].
- 				offset=8 ifTrue: [^client methodReturnReceiver].
- 				offset<12 ifTrue: [^client methodReturnConstant:
- 												(SpecialConstants at: offset-8)].
- 				offset=12 ifTrue: [^client methodReturnTop].
- 				offset=13 ifTrue: [^client blockReturnTop].
- 				^self error: 'unusedBytecode'].
- 	type=8 ifTrue: [^self interpretExtension: offset in: method for: client].
- 	type=9
- 		ifTrue:  short jumps
- 			[offset<8 ifTrue: [^client jump: offset+1].
- 			^client jump: offset-8+1 if: false].
- 	type=10
- 		ifTrue:  long jumps
- 			[byte:= method at: pc.  pc:= pc+1.
- 			offset<8 ifTrue: [^client jump: offset-4*256 + byte].
- 			^client jump: (offset bitAnd: 3)*256 + byte if: offset<12].
- 	type=11
- 		ifTrue:
- 			[^client
- 				send: (Smalltalk specialSelectorAt: offset+1)
- 				super: false
- 				numArgs: (Smalltalk specialNargsAt: offset+1)].
- 	type=12
- 		ifTrue:
- 			[^client
- 				send: (Smalltalk specialSelectorAt: offset+17)
- 				super: false
- 				numArgs: (Smalltalk specialNargsAt: offset+17)].
- 	type>12
- 		ifTrue:
- 			[^client send: (method literalAt: offset+1)
- 					super: false
- 					numArgs: type-13]"!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>pushExplicitOuter: (in category 'instruction decoding') -----
- pushExplicitOuter: level
- 	"Push receiver for explcit outer, on Top Of Stack bytecode."
- 	self push!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>pushImplicitReceiverForMessage: (in category 'instruction decoding') -----
- pushImplicitReceiverForMessage: selector
- 	"Push implicit receiver for selector on top of stack bytecode."
- 	self push!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>sendToAbsentDynamicSuperclass:numArgs: (in category 'instruction decoding') -----
- sendToAbsentDynamicSuperclass: selector numArgs: numArgs
- 	"Dynamic Superclass Send Message With Selector, selector, to absent implicit receiver bytecode."
- 	self drop: numArgs - 1 "e.g. if no args pushes a result"!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>sendToAbsentImplicitReceiver:numArgs: (in category 'instruction decoding') -----
- sendToAbsentImplicitReceiver: selector numArgs: numArgs
- 	"Send Message With Selector, selector, to absent implicit receiver bytecode."
- 	self drop: numArgs - 1 "e.g. if no args pushes a result"!

Item was removed:
- ----- Method: NewspeakStackDepthFinder>>sendToDynamicSuperclass:numArgs: (in category 'instruction decoding') -----
- sendToDynamicSuperclass: selector numArgs: numArgs
- 	"Send Message With Selector, selector, to dynamic superclass bytecode."
- 	self drop: numArgs!

Item was added:
+ ----- Method: SimpleStackBasedCogit class>>initializePrimitiveTableForNewsqueak (in category 'class initialization') -----
+ initializePrimitiveTableForNewsqueak
+ 	"Initialize the table of primitive generators.  This does not include normal primitives implemented in the coInterpreter."
+ 	"SimpleStackBasedCogit initializePrimitiveTableForSqueakV3"
+ 	MaxCompiledPrimitiveIndex := 222.
+ 	primitiveTable := CArrayAccessor on: (Array new: MaxCompiledPrimitiveIndex + 1).
+ 	self table: primitiveTable from: 
+ 	#(	"Integer Primitives (0-19)"
+ 		(1 genPrimitiveAdd				1)
+ 		(2 genPrimitiveSubtract			1)
+ 		(3 genPrimitiveLessThan		1)
+ 		(4 genPrimitiveGreaterThan		1)
+ 		(5 genPrimitiveLessOrEqual		1)
+ 		(6 genPrimitiveGreaterOrEqual	1)
+ 		(7 genPrimitiveEqual			1)
+ 		(8 genPrimitiveNotEqual		1)
+ 		(9 genPrimitiveMultiply			1	processorHasMultiply:)
+ 		(10 genPrimitiveDivide			1	processorHasDivQuoRem:)
+ 		(11 genPrimitiveMod			1	processorHasDivQuoRem:)
+ 		(12 genPrimitiveDiv				1	processorHasDivQuoRem:)
+ 		(13 genPrimitiveQuo			1	processorHasDivQuoRem:)
+ 		(14 genPrimitiveBitAnd			1)
+ 		(15 genPrimitiveBitOr			1)
+ 		(16 genPrimitiveBitXor			1)
+ 		(17 genPrimitiveBitShift			1)
+ 		"(18 primitiveMakePoint)"
+ 		"(19 primitiveFail)"					"Guard primitive for simulation -- *must* fail"
+ 
+ 		"LargeInteger Primitives (20-39)"
+ 		"(20 primitiveFail)"
+ 		"(21 primitiveAddLargeIntegers)"
+ 		"(22 primitiveSubtractLargeIntegers)"
+ 		"(23 primitiveLessThanLargeIntegers)"
+ 		"(24 primitiveGreaterThanLargeIntegers)"
+ 		"(25 primitiveLessOrEqualLargeIntegers)"
+ 		"(26 primitiveGreaterOrEqualLargeIntegers)"
+ 		"(27 primitiveEqualLargeIntegers)"
+ 		"(28 primitiveNotEqualLargeIntegers)"
+ 		"(29 primitiveMultiplyLargeIntegers)"
+ 		"(30 primitiveDivideLargeIntegers)"
+ 		"(31 primitiveModLargeIntegers)"
+ 		"(32 primitiveDivLargeIntegers)"
+ 		"(33 primitiveQuoLargeIntegers)"
+ 		"(34 primitiveBitAndLargeIntegers)"
+ 		"(35 primitiveBitOrLargeIntegers)"
+ 		"(36 primitiveBitXorLargeIntegers)"
+ 		"(37 primitiveBitShiftLargeIntegers)"
+ 
+ 		"Float Primitives (38-59)"
+ 		"(38 primitiveFloatAt)"
+ 		"(39 primitiveFloatAtPut)"
+ 		(40 genPrimitiveAsFloat					0	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(41 genPrimitiveFloatAdd				1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(42 genPrimitiveFloatSubtract			1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(43 genPrimitiveFloatLessThan			1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(44 genPrimitiveFloatGreaterThan		1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(45 genPrimitiveFloatLessOrEqual		1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(46 genPrimitiveFloatGreaterOrEqual	1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(47 genPrimitiveFloatEqual				1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(48 genPrimitiveFloatNotEqual			1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(49 genPrimitiveFloatMultiply			1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(50 genPrimitiveFloatDivide				1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		"(51 primitiveTruncated)"
+ 		"(52 primitiveFractionalPart)"
+ 		"(53 primitiveExponent)"
+ 		"(54 primitiveTimesTwoPower)"
+ 		(55 genPrimitiveFloatSquareRoot		0	processorHasDoublePrecisionFloatingPointSupport:)
+ 		"(56 primitiveSine)"
+ 		"(57 primitiveArctan)"
+ 		"(58 primitiveLogN)"
+ 		"(59 primitiveExp)"
+ 
+ 		"Subscript and Stream Primitives (60-67)"
+ 		(60 genPrimitiveAt				1)
+ 		(61 genPrimitiveAtPut			2)
+ 		(62 genPrimitiveSize			0)
+ 		(63 genPrimitiveStringAt		1)
+ 		(64 genPrimitiveStringAtPut		2)
+ 		"The stream primitives no longer pay their way; normal Smalltalk code is faster."
+ 		"(65 primitiveFail)""was primitiveNext"
+ 		"(66 primitiveFail)" "was primitiveNextPut"
+ 		"(67 primitiveFail)" "was primitiveAtEnd"
+ 
+ 		"StorageManagement Primitives (68-79)"
+ 		"(68 primitiveObjectAt)"
+ 		"(69 primitiveObjectAtPut)"
+ 		(70 genPrimitiveNew			-1)			"For VMMirror support 1 argument instantiateFixedClass: as well as baiscNew"
+ 		(71 genPrimitiveNewWithArg	-1)			"For VMMirror support 2 argument instantiateVariableClass:withSize: as well as baiscNew:"
+ 		"(72 primitiveArrayBecomeOneWay)"		"Blue Book: primitiveBecome"
+ 		"(73 primitiveInstVarAt)"
+ 		"(74 primitiveInstVarAtPut)"
+ 		(75 genPrimitiveIdentityHash	0)
+ 		"(76 primitiveStoreStackp)"					"Blue Book: primitiveAsObject"
+ 		"(77 primitiveSomeInstance)"
+ 		"(78 primitiveNextInstance)"
+ 		(79 genPrimitiveNewMethod	2)
+ 
+ 		"Control Primitives (80-89)"
+ 		"(80 primitiveFail)"							"Blue Book: primitiveBlockCopy"
+ 		"(81 primitiveFail)"							"Blue Book: primitiveValue"
+ 		"(82 primitiveFail)"							"Blue Book: primitiveValueWithArgs"
+ 		"(83 primitivePerform)"
+ 		"(84 primitivePerformWithArgs)"
+ 		"(85 primitiveSignal)"
+ 		"(86 primitiveWait)"
+ 		"(87 primitiveResume)"
+ 		"(88 primitiveSuspend)"
+ 		"(89 primitiveFlushCache)"
+ 
+ 		"Input/Output Primitives (90-109); We won't compile any of these"
+ 
+ 		"System Primitives (110-119)"
+ 		(110 genPrimitiveIdentical 1)
+ 		(111 genPrimitiveClass)
+ 		"(112 primitiveBytesLeft)"
+ 		"(113 primitiveQuit)"
+ 		"(114 primitiveExitToDebugger)"
+ 		"(115 primitiveChangeClass)"					"Blue Book: primitiveOopsLeft"
+ 		"(116 primitiveFlushCacheByMethod)"
+ 		"(117 primitiveExternalCall)"
+ 		"(118 primitiveDoPrimitiveWithArgs)"
+ 		"(119 primitiveFlushCacheSelective)"
+ 			"Squeak 2.2 and earlier use 119.  Squeak 2.3 and later use 116.
+ 			Both are supported for backward compatibility."
+ 
+ 		"Miscellaneous Primitives (120-127); We won't compile any of these"
+ 
+ 		"Squeak Primitives Start Here"
+ 
+ 		"Squeak Miscellaneous Primitives (128-149); We won't compile any of these"
+ 
+ 		"File Primitives (150-169) - NO LONGER INDEXED; We won't compile any of these"
+ 		(169 genPrimitiveNotIdentical 1)
+ 
+ 		(170 genPrimitiveAsCharacter)			"SmallInteger>>asCharacter, Character class>>value:"
+ 		(171 genPrimitiveCharacterValue 0)	"Character>>value"
+ 		"Sound Primitives (170-199) - NO LONGER INDEXED; We won't compile any of these"
+ 		(175 genPrimitiveIdentityHash	0)		"Behavior>>identityHash"
+ 		"Sound Primitives (170-199) - NO LONGER INDEXED; We won't compile any of these"
+ 
+ 		"Old closure primitives"
+ 		"(186 primitiveFail)" "was primitiveClosureValue"
+ 		"(187 primitiveFail)" "was primitiveClosureValueWithArgs"
+ 
+ 		"Perform method directly"
+ 		"(188 primitiveExecuteMethodArgsArray)"
+ 		"(189 primitiveExecuteMethod)"
+ 
+ 		"Sound Primitives (continued) - NO LONGER INDEXED; We won't compile any of these"
+ 		"(190 194 primitiveFail)"
+ 
+ 		"Unwind primitives"
+ 		"(195 primitiveFindNextUnwindContext)"
+ 		"(196 primitiveTerminateTo)"
+ 		"(197 primitiveFindHandlerContext)"
+ 		(198 genFastPrimFail "primitiveMarkUnwindMethod")
+ 		(199 genFastPrimFail "primitiveMarkHandlerMethod")
+ 
+ 		"new closure primitives (were Networking primitives)"
+ 		"(200 primitiveClosureCopyWithCopiedValues)"
+ 		(201 genPrimitiveClosureValue	0) "value"
+ 		(202 genPrimitiveClosureValue	1) "value:"
+ 		(203 genPrimitiveClosureValue	2) "value:value:"
+ 		(204 genPrimitiveClosureValue	3) "value:value:value:"
+ 		(205 genPrimitiveClosureValue	4) "value:value:value:value:"
+ 		"(206 genPrimitiveClosureValueWithArgs)" "valueWithArguments:"
+ 
+ 		"(207 209 primitiveFail)"	"reserved for Cog primitives"
+ 
+ 		"(210 primitiveContextAt)"
+ 		"(211 primitiveContextAtPut)"
+ 		"(212 primitiveContextSize)"
+ 		"(213 217 primitiveFail)"	"reserved for Cog primitives"
+ 		"(218 primitiveDoNamedPrimitiveWithArgs)"
+ 		"(219 primitiveFail)"	"reserved for Cog primitives"
+ 
+ 		"(220 primitiveFail)"		"reserved for Cog primitives"
+ 
+ 		(221 genPrimitiveClosureValue	0) "valueNoContextSwitch"
+ 		(222 genPrimitiveClosureValue	1) "valueNoContextSwitch:"
+ 
+ 		"(223 229 primitiveFail)"	"reserved for Cog primitives"
+ 	)!

Item was added:
+ ----- Method: SimpleStackBasedCogit class>>initializePrimitiveTableForSqueak (in category 'class initialization') -----
+ initializePrimitiveTableForSqueak
+ 	"Initialize the table of primitive generators.  This does not include normal primitives implemented in the coInterpreter."
+ 	"SimpleStackBasedCogit initializePrimitiveTableForSqueak"
+ 	MaxCompiledPrimitiveIndex := 222.
+ 	primitiveTable := CArrayAccessor on: (Array new: MaxCompiledPrimitiveIndex + 1).
+ 	self table: primitiveTable from: 
+ 	#(	"Integer Primitives (0-19)"
+ 		(1 genPrimitiveAdd				1)
+ 		(2 genPrimitiveSubtract			1)
+ 		(3 genPrimitiveLessThan		1)
+ 		(4 genPrimitiveGreaterThan		1)
+ 		(5 genPrimitiveLessOrEqual		1)
+ 		(6 genPrimitiveGreaterOrEqual	1)
+ 		(7 genPrimitiveEqual			1)
+ 		(8 genPrimitiveNotEqual		1)
+ 		(9 genPrimitiveMultiply			1	processorHasMultiply:)
+ 		(10 genPrimitiveDivide			1	processorHasDivQuoRem:)
+ 		(11 genPrimitiveMod			1	processorHasDivQuoRem:)
+ 		(12 genPrimitiveDiv				1	processorHasDivQuoRem:)
+ 		(13 genPrimitiveQuo			1	processorHasDivQuoRem:)
+ 		(14 genPrimitiveBitAnd			1)
+ 		(15 genPrimitiveBitOr			1)
+ 		(16 genPrimitiveBitXor			1)
+ 		(17 genPrimitiveBitShift			1)
+ 		"(18 primitiveMakePoint)"
+ 		"(19 primitiveFail)"					"Guard primitive for simulation -- *must* fail"
+ 
+ 		"LargeInteger Primitives (20-39)"
+ 		"(20 primitiveFail)"
+ 		"(21 primitiveAddLargeIntegers)"
+ 		"(22 primitiveSubtractLargeIntegers)"
+ 		"(23 primitiveLessThanLargeIntegers)"
+ 		"(24 primitiveGreaterThanLargeIntegers)"
+ 		"(25 primitiveLessOrEqualLargeIntegers)"
+ 		"(26 primitiveGreaterOrEqualLargeIntegers)"
+ 		"(27 primitiveEqualLargeIntegers)"
+ 		"(28 primitiveNotEqualLargeIntegers)"
+ 		"(29 primitiveMultiplyLargeIntegers)"
+ 		"(30 primitiveDivideLargeIntegers)"
+ 		"(31 primitiveModLargeIntegers)"
+ 		"(32 primitiveDivLargeIntegers)"
+ 		"(33 primitiveQuoLargeIntegers)"
+ 		"(34 primitiveBitAndLargeIntegers)"
+ 		"(35 primitiveBitOrLargeIntegers)"
+ 		"(36 primitiveBitXorLargeIntegers)"
+ 		"(37 primitiveBitShiftLargeIntegers)"
+ 
+ 		"Float Primitives (38-59)"
+ 		"(38 primitiveFloatAt)"
+ 		"(39 primitiveFloatAtPut)"
+ 		(40 genPrimitiveAsFloat					0	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(41 genPrimitiveFloatAdd				1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(42 genPrimitiveFloatSubtract			1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(43 genPrimitiveFloatLessThan			1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(44 genPrimitiveFloatGreaterThan		1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(45 genPrimitiveFloatLessOrEqual		1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(46 genPrimitiveFloatGreaterOrEqual	1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(47 genPrimitiveFloatEqual				1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(48 genPrimitiveFloatNotEqual			1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(49 genPrimitiveFloatMultiply			1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		(50 genPrimitiveFloatDivide				1	processorHasDoublePrecisionFloatingPointSupport:)
+ 		"(51 primitiveTruncated)"
+ 		"(52 primitiveFractionalPart)"
+ 		"(53 primitiveExponent)"
+ 		"(54 primitiveTimesTwoPower)"
+ 		(55 genPrimitiveFloatSquareRoot		0	processorHasDoublePrecisionFloatingPointSupport:)
+ 		"(56 primitiveSine)"
+ 		"(57 primitiveArctan)"
+ 		"(58 primitiveLogN)"
+ 		"(59 primitiveExp)"
+ 
+ 		"Subscript and Stream Primitives (60-67)"
+ 		(60 genPrimitiveAt				1)
+ 		(61 genPrimitiveAtPut			2)
+ 		(62 genPrimitiveSize			0)
+ 		(63 genPrimitiveStringAt		1)
+ 		(64 genPrimitiveStringAtPut		2)
+ 		"The stream primitives no longer pay their way; normal Smalltalk code is faster."
+ 		"(65 primitiveFail)""was primitiveNext"
+ 		"(66 primitiveFail)" "was primitiveNextPut"
+ 		"(67 primitiveFail)" "was primitiveAtEnd"
+ 
+ 		"StorageManagement Primitives (68-79)"
+ 		"(68 primitiveObjectAt)"
+ 		"(69 primitiveObjectAtPut)"
+ 		(70 genPrimitiveNew			0)
+ 		(71 genPrimitiveNewWithArg	1)
+ 		"(72 primitiveArrayBecomeOneWay)"		"Blue Book: primitiveBecome"
+ 		"(73 primitiveInstVarAt)"
+ 		"(74 primitiveInstVarAtPut)"
+ 		(75 genPrimitiveIdentityHash	0)
+ 		"(76 primitiveStoreStackp)"					"Blue Book: primitiveAsObject"
+ 		"(77 primitiveSomeInstance)"
+ 		"(78 primitiveNextInstance)"
+ 		(79 genPrimitiveNewMethod	2)
+ 
+ 		"Control Primitives (80-89)"
+ 		"(80 primitiveFail)"							"Blue Book: primitiveBlockCopy"
+ 		"(81 primitiveFail)"							"Blue Book: primitiveValue"
+ 		"(82 primitiveFail)"							"Blue Book: primitiveValueWithArgs"
+ 		"(83 primitivePerform)"
+ 		"(84 primitivePerformWithArgs)"
+ 		"(85 primitiveSignal)"
+ 		"(86 primitiveWait)"
+ 		"(87 primitiveResume)"
+ 		"(88 primitiveSuspend)"
+ 		"(89 primitiveFlushCache)"
+ 
+ 		"Input/Output Primitives (90-109); We won't compile any of these"
+ 
+ 		"System Primitives (110-119)"
+ 		(110 genPrimitiveIdentical 1)
+ 		(111 genPrimitiveClass)
+ 		"(112 primitiveBytesLeft)"
+ 		"(113 primitiveQuit)"
+ 		"(114 primitiveExitToDebugger)"
+ 		"(115 primitiveChangeClass)"					"Blue Book: primitiveOopsLeft"
+ 		"(116 primitiveFlushCacheByMethod)"
+ 		"(117 primitiveExternalCall)"
+ 		"(118 primitiveDoPrimitiveWithArgs)"
+ 		"(119 primitiveFlushCacheSelective)"
+ 			"Squeak 2.2 and earlier use 119.  Squeak 2.3 and later use 116.
+ 			Both are supported for backward compatibility."
+ 
+ 		"Miscellaneous Primitives (120-127); We won't compile any of these"
+ 
+ 		"Squeak Primitives Start Here"
+ 
+ 		"Squeak Miscellaneous Primitives (128-149); We won't compile any of these"
+ 
+ 		"File Primitives (150-169) - NO LONGER INDEXED; We won't compile any of these"
+ 		(169 genPrimitiveNotIdentical 1)
+ 
+ 		(170 genPrimitiveAsCharacter)			"SmallInteger>>asCharacter, Character class>>value:"
+ 		(171 genPrimitiveCharacterValue 0)	"Character>>value"
+ 		"Sound Primitives (170-199) - NO LONGER INDEXED; We won't compile any of these"
+ 		(175 genPrimitiveIdentityHash	0)		"Behavior>>identityHash"
+ 		"Sound Primitives (170-199) - NO LONGER INDEXED; We won't compile any of these"
+ 
+ 		"Old closure primitives"
+ 		"(186 primitiveFail)" "was primitiveClosureValue"
+ 		"(187 primitiveFail)" "was primitiveClosureValueWithArgs"
+ 
+ 		"Perform method directly"
+ 		"(188 primitiveExecuteMethodArgsArray)"
+ 		"(189 primitiveExecuteMethod)"
+ 
+ 		"Sound Primitives (continued) - NO LONGER INDEXED; We won't compile any of these"
+ 		"(190 194 primitiveFail)"
+ 
+ 		"Unwind primitives"
+ 		"(195 primitiveFindNextUnwindContext)"
+ 		"(196 primitiveTerminateTo)"
+ 		"(197 primitiveFindHandlerContext)"
+ 		(198 genFastPrimFail "primitiveMarkUnwindMethod")
+ 		(199 genFastPrimFail "primitiveMarkHandlerMethod")
+ 
+ 		"new closure primitives (were Networking primitives)"
+ 		"(200 primitiveClosureCopyWithCopiedValues)"
+ 		(201 genPrimitiveClosureValue	0) "value"
+ 		(202 genPrimitiveClosureValue	1) "value:"
+ 		(203 genPrimitiveClosureValue	2) "value:value:"
+ 		(204 genPrimitiveClosureValue	3) "value:value:value:"
+ 		(205 genPrimitiveClosureValue	4) "value:value:value:value:"
+ 		"(206 genPrimitiveClosureValueWithArgs)" "valueWithArguments:"
+ 
+ 		"(207 209 primitiveFail)"	"reserved for Cog primitives"
+ 
+ 		"(210 primitiveContextAt)"
+ 		"(211 primitiveContextAtPut)"
+ 		"(212 primitiveContextSize)"
+ 		"(213 217 primitiveFail)"	"reserved for Cog primitives"
+ 		"(218 primitiveDoNamedPrimitiveWithArgs)"
+ 		"(219 primitiveFail)"	"reserved for Cog primitives"
+ 
+ 		"(220 primitiveFail)"		"reserved for Cog primitives"
+ 
+ 		(221 genPrimitiveClosureValue	0) "valueNoContextSwitch"
+ 		(222 genPrimitiveClosureValue	1) "valueNoContextSwitch:"
+ 
+ 		"(223 229 primitiveFail)"	"reserved for Cog primitives"
+ 	)!

Item was removed:
- ----- Method: SimpleStackBasedCogit class>>initializePrimitiveTableForSqueakV3 (in category 'class initialization') -----
- initializePrimitiveTableForSqueakV3
- 	"Initialize the table of primitive generators.  This does not include normal primitives implemened in the coInterpreter."
- 	"SimpleStackBasedCogit initializePrimitiveTableForSqueakV3"
- 	MaxCompiledPrimitiveIndex := 222.
- 	primitiveTable := CArrayAccessor on: (Array new: MaxCompiledPrimitiveIndex + 1).
- 	self table: primitiveTable from: 
- 	#(	"Integer Primitives (0-19)"
- 		(1 genPrimitiveAdd				1)
- 		(2 genPrimitiveSubtract			1)
- 		(3 genPrimitiveLessThan		1)
- 		(4 genPrimitiveGreaterThan		1)
- 		(5 genPrimitiveLessOrEqual		1)
- 		(6 genPrimitiveGreaterOrEqual	1)
- 		(7 genPrimitiveEqual			1)
- 		(8 genPrimitiveNotEqual		1)
- 		(9 genPrimitiveMultiply			1	processorHasMultiply:)
- 		(10 genPrimitiveDivide			1	processorHasDivQuoRem:)
- 		(11 genPrimitiveMod			1	processorHasDivQuoRem:)
- 		(12 genPrimitiveDiv				1	processorHasDivQuoRem:)
- 		(13 genPrimitiveQuo			1	processorHasDivQuoRem:)
- 		(14 genPrimitiveBitAnd			1)
- 		(15 genPrimitiveBitOr			1)
- 		(16 genPrimitiveBitXor			1)
- 		(17 genPrimitiveBitShift			1)
- 		"(18 primitiveMakePoint)"
- 		"(19 primitiveFail)"					"Guard primitive for simulation -- *must* fail"
- 
- 		"LargeInteger Primitives (20-39)"
- 		"(20 primitiveFail)"
- 		"(21 primitiveAddLargeIntegers)"
- 		"(22 primitiveSubtractLargeIntegers)"
- 		"(23 primitiveLessThanLargeIntegers)"
- 		"(24 primitiveGreaterThanLargeIntegers)"
- 		"(25 primitiveLessOrEqualLargeIntegers)"
- 		"(26 primitiveGreaterOrEqualLargeIntegers)"
- 		"(27 primitiveEqualLargeIntegers)"
- 		"(28 primitiveNotEqualLargeIntegers)"
- 		"(29 primitiveMultiplyLargeIntegers)"
- 		"(30 primitiveDivideLargeIntegers)"
- 		"(31 primitiveModLargeIntegers)"
- 		"(32 primitiveDivLargeIntegers)"
- 		"(33 primitiveQuoLargeIntegers)"
- 		"(34 primitiveBitAndLargeIntegers)"
- 		"(35 primitiveBitOrLargeIntegers)"
- 		"(36 primitiveBitXorLargeIntegers)"
- 		"(37 primitiveBitShiftLargeIntegers)"
- 
- 		"Float Primitives (38-59)"
- 		"(38 primitiveFloatAt)"
- 		"(39 primitiveFloatAtPut)"
- 		(40 genPrimitiveAsFloat					0	processorHasDoublePrecisionFloatingPointSupport:)
- 		(41 genPrimitiveFloatAdd				1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(42 genPrimitiveFloatSubtract			1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(43 genPrimitiveFloatLessThan			1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(44 genPrimitiveFloatGreaterThan		1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(45 genPrimitiveFloatLessOrEqual		1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(46 genPrimitiveFloatGreaterOrEqual	1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(47 genPrimitiveFloatEqual				1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(48 genPrimitiveFloatNotEqual			1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(49 genPrimitiveFloatMultiply			1	processorHasDoublePrecisionFloatingPointSupport:)
- 		(50 genPrimitiveFloatDivide				1	processorHasDoublePrecisionFloatingPointSupport:)
- 		"(51 primitiveTruncated)"
- 		"(52 primitiveFractionalPart)"
- 		"(53 primitiveExponent)"
- 		"(54 primitiveTimesTwoPower)"
- 		(55 genPrimitiveFloatSquareRoot		0	processorHasDoublePrecisionFloatingPointSupport:)
- 		"(56 primitiveSine)"
- 		"(57 primitiveArctan)"
- 		"(58 primitiveLogN)"
- 		"(59 primitiveExp)"
- 
- 		"Subscript and Stream Primitives (60-67)"
- 		(60 genPrimitiveAt				1)
- 		(61 genPrimitiveAtPut			2)
- 		(62 genPrimitiveSize			0)
- 		(63 genPrimitiveStringAt		1)
- 		(64 genPrimitiveStringAtPut		2)
- 		"The stream primitives no longer pay their way; normal Smalltalk code is faster."
- 		"(65 primitiveFail)""was primitiveNext"
- 		"(66 primitiveFail)" "was primitiveNextPut"
- 		"(67 primitiveFail)" "was primitiveAtEnd"
- 
- 		"StorageManagement Primitives (68-79)"
- 		"(68 primitiveObjectAt)"
- 		"(69 primitiveObjectAtPut)"
- 		(70 genPrimitiveNew			0)
- 		(71 genPrimitiveNewWithArg	1)
- 		"(72 primitiveArrayBecomeOneWay)"		"Blue Book: primitiveBecome"
- 		"(73 primitiveInstVarAt)"
- 		"(74 primitiveInstVarAtPut)"
- 		(75 genPrimitiveIdentityHash	0)
- 		"(76 primitiveStoreStackp)"					"Blue Book: primitiveAsObject"
- 		"(77 primitiveSomeInstance)"
- 		"(78 primitiveNextInstance)"
- 		(79 genPrimitiveNewMethod	2)
- 
- 		"Control Primitives (80-89)"
- 		"(80 primitiveFail)"							"Blue Book: primitiveBlockCopy"
- 		"(81 primitiveFail)"							"Blue Book: primitiveValue"
- 		"(82 primitiveFail)"							"Blue Book: primitiveValueWithArgs"
- 		"(83 primitivePerform)"
- 		"(84 primitivePerformWithArgs)"
- 		"(85 primitiveSignal)"
- 		"(86 primitiveWait)"
- 		"(87 primitiveResume)"
- 		"(88 primitiveSuspend)"
- 		"(89 primitiveFlushCache)"
- 
- 		"Input/Output Primitives (90-109); We won't compile any of these"
- 
- 		"System Primitives (110-119)"
- 		(110 genPrimitiveIdentical 1)
- 		(111 genPrimitiveClass)
- 		"(112 primitiveBytesLeft)"
- 		"(113 primitiveQuit)"
- 		"(114 primitiveExitToDebugger)"
- 		"(115 primitiveChangeClass)"					"Blue Book: primitiveOopsLeft"
- 		"(116 primitiveFlushCacheByMethod)"
- 		"(117 primitiveExternalCall)"
- 		"(118 primitiveDoPrimitiveWithArgs)"
- 		"(119 primitiveFlushCacheSelective)"
- 			"Squeak 2.2 and earlier use 119.  Squeak 2.3 and later use 116.
- 			Both are supported for backward compatibility."
- 
- 		"Miscellaneous Primitives (120-127); We won't compile any of these"
- 
- 		"Squeak Primitives Start Here"
- 
- 		"Squeak Miscellaneous Primitives (128-149); We won't compile any of these"
- 
- 		"File Primitives (150-169) - NO LONGER INDEXED; We won't compile any of these"
- 		(169 genPrimitiveNotIdentical 1)
- 
- 		(170 genPrimitiveAsCharacter)			"SmallInteger>>asCharacter, Character class>>value:"
- 		(171 genPrimitiveCharacterValue 0)	"Character>>value"
- 		"Sound Primitives (170-199) - NO LONGER INDEXED; We won't compile any of these"
- 		(175 genPrimitiveIdentityHash	0)		"Behavior>>identityHash"
- 		"Sound Primitives (170-199) - NO LONGER INDEXED; We won't compile any of these"
- 
- 		"Old closure primitives"
- 		"(186 primitiveFail)" "was primitiveClosureValue"
- 		"(187 primitiveFail)" "was primitiveClosureValueWithArgs"
- 
- 		"Perform method directly"
- 		"(188 primitiveExecuteMethodArgsArray)"
- 		"(189 primitiveExecuteMethod)"
- 
- 		"Sound Primitives (continued) - NO LONGER INDEXED; We won't compile any of these"
- 		"(190 194 primitiveFail)"
- 
- 		"Unwind primitives"
- 		"(195 primitiveFindNextUnwindContext)"
- 		"(196 primitiveTerminateTo)"
- 		"(197 primitiveFindHandlerContext)"
- 		(198 genFastPrimFail "primitiveMarkUnwindMethod")
- 		(199 genFastPrimFail "primitiveMarkHandlerMethod")
- 
- 		"new closure primitives (were Networking primitives)"
- 		"(200 primitiveClosureCopyWithCopiedValues)"
- 		(201 genPrimitiveClosureValue	0) "value"
- 		(202 genPrimitiveClosureValue	1) "value:"
- 		(203 genPrimitiveClosureValue	2) "value:value:"
- 		(204 genPrimitiveClosureValue	3) "value:value:value:"
- 		(205 genPrimitiveClosureValue	4) "value:value:value:value:"
- 		"(206 genPrimitiveClosureValueWithArgs)" "valueWithArguments:"
- 
- 		"(207 209 primitiveFail)"	"reserved for Cog primitives"
- 
- 		"(210 primitiveContextAt)"
- 		"(211 primitiveContextAtPut)"
- 		"(212 primitiveContextSize)"
- 		"(213 217 primitiveFail)"	"reserved for Cog primitives"
- 		"(218 primitiveDoNamedPrimitiveWithArgs)"
- 		"(219 primitiveFail)"	"reserved for Cog primitives"
- 
- 		"(220 primitiveFail)"		"reserved for Cog primitives"
- 
- 		(221 genPrimitiveClosureValue	0) "valueNoContextSwitch"
- 		(222 genPrimitiveClosureValue	1) "valueNoContextSwitch:"
- 
- 		"(223 229 primitiveFail)"	"reserved for Cog primitives"
- 	)!

Item was added:
+ ----- Method: Spur32BitCoMemoryManager>>unalignedLongAt: (in category 'simulation only') -----
+ unalignedLongAt: byteAddress
+ 	<doNotGenerate>
+ 	| rem |
+ 	rem := byteAddress \\ 4.
+ 	^rem = 0
+ 		ifTrue: [self longAt: byteAddress]
+ 		ifFalse: [((self longAt: byteAddress - rem) + ((self longAt: byteAddress - rem + 4) bitShift: 32) bitShift: rem * -8) bitAnd: 16rFFFFFFFF]!

Item was added:
+ ----- Method: Spur32BitCoMemoryManager>>unalignedLongAt:put: (in category 'simulation only') -----
+ unalignedLongAt: byteAddress put: aLong
+ 	<doNotGenerate>
+ 	| rem mask |
+ 	rem := byteAddress \\ 4.
+ 	^rem = 0
+ 		ifTrue: [self longAt: byteAddress put: aLong]
+ 		ifFalse:
+ 			[mask := 16rFFFFFFFF bitAnd: (-1 bitShift: rem * 8).
+ 			 self longAt: byteAddress - rem
+ 				put: ((self longAt: byteAddress - rem) bitAnd: mask bitInvert)
+ 					+ ((aLong bitShift: rem * 8) bitAnd: mask).
+ 			 self longAt: byteAddress - rem + 4
+ 				put: ((self longAt: byteAddress - rem + 4) bitAnd: mask)
+ 					+ ((aLong bitShift: 4 - rem * -8) bitAnd: mask bitInvert).
+ 			 aLong]!

Item was changed:
  ----- Method: StackDepthFinder>>stackPointers (in category 'accessing') -----
  stackPointers
  	"Collect the stack depth for each bytecode in the method.
+ 	 For the convenience of clients, write the stack depth for extended bytecodes
- 	 For the convenience of clients, write teh stack depth for extended bytecodes
  	 to the bytecode pc, as well as the bytecocdes' extensions' pcs."
+ 	| method encoderClass stackPointers end |
+ 	stackPointers :=  Array new: (end := (method := self method) endPC).
+ 	encoderClass := method encoderClass.
- 	| stackPointers end |
- 	stackPointers :=  Array new: (end := self method endPC).
  	[pc <= end] whileTrue:
  		[stackPointers at: pc put: stackp.
+ 		 encoderClass extensionsAt: pc in: method into:
+ 			[:extA :extB :delta|
+ 			delta > 0 ifTrue:
+ 				[stackPointers at: pc + delta put: stackp]].
- 		 self method usesAlternateBytecodeSet ifTrue:
- 			[self extensionsAt: pc into:
- 				[:extA :extB :delta|
- 				delta > 0 ifTrue:
- 					[stackPointers at: pc + delta put: stackp]]].
  		 self interpretNextInstructionFor: self].
  	^stackPointers!

Item was changed:
  InterpreterPrimitives subclass: #StackInterpreter
  	instanceVariableNames: 'currentBytecode bytecodeSetSelector localFP localIP localSP stackLimit stackPage stackPages method instructionPointer stackPointer framePointer localReturnValue extA extB primitiveFunctionPointer methodCache atCache lkupClassTag lkupClass methodDictLinearSearchLimit highestRunnableProcessPriority nextWakeupUsecs nextPollUsecs inIOProcessEvents interruptKeycode interruptPending savedWindowSize imageHeaderFlags fullScreenFlag deferDisplayUpdates pendingFinalizationSignals extraVMMemory interpreterProxy showSurfaceFn primitiveTable primitiveAccessorDepthTable externalPrimitiveTable externalPrimitiveTableFirstFreeIndex overflowedPage extraFramesToMoveOnOverflow globalSessionID jmpBuf jmpDepth suspendedCallbacks suspendedMethods numStackPages desiredNumStackPages desiredEdenBytes classNameIndex thisClassIndex metaclassNumSlots interruptCheckChain suppressHeartbeatFlag breakSelector breakSelectorLength longRunningPrimitiveCheckMethod longRunningPrimitiveCheckSemaphore longRunningPrimitiveStartUsecs longRunningPrimitiveStopUsecs longRunningPrimitiveGCUsecs longRunningPrimitiveCheckSequenceNumber longRunningPrimitiveSignalUndelivered tempOop statForceInterruptCheck statStackOverflow statStackPageDivorce statCheckForEvents statProcessSwitch statIOProcessEvents theUnknownShort the2ndUnknownShort imageFloatsBigEndian maxExtSemTabSizeSet lastMethodCacheProbeWrite statPendingFinalizationSignals gcSemaphoreIndex classByteArrayCompactIndex'
+ 	classVariableNames: 'AltBytecodeEncoderClassName AltLongStoreBytecode AtCacheEntries AtCacheFixedFields AtCacheFmt AtCacheMask AtCacheOop AtCacheSize AtCacheTotalSize AtPutBase BytecodeEncoderClassName BytecodeTable CacheProbeMax DirBadPath DirEntryFound DirNoMoreEntries DumpStackOnLowSpace EnclosingMixinIndex EnclosingObjectIndex FailImbalancedPrimitives HeaderFlagBitPosition LongStoreBytecode MaxExternalPrimitiveTableSize MaxJumpBuf MaxPrimitiveIndex MaxQuickPrimitiveIndex MixinIndex PrimitiveExternalCallIndex PrimitiveTable StackPageReachedButUntraced StackPageTraceInvalid StackPageTraced StackPageUnreached'
- 	classVariableNames: 'AtCacheEntries AtCacheFixedFields AtCacheFmt AtCacheMask AtCacheOop AtCacheSize AtCacheTotalSize AtPutBase BytecodeTable CacheProbeMax DirBadPath DirEntryFound DirNoMoreEntries DumpStackOnLowSpace EnclosingMixinIndex EnclosingObjectIndex FailImbalancedPrimitives HeaderFlagBitPosition MaxExternalPrimitiveTableSize MaxJumpBuf MaxPrimitiveIndex MaxQuickPrimitiveIndex MixinIndex PrimitiveExternalCallIndex PrimitiveTable StackPageReachedButUntraced StackPageTraceInvalid StackPageTraced StackPageUnreached'
  	poolDictionaries: 'VMBasicConstants VMMethodCacheConstants VMObjectIndices VMSpurObjectRepresentationConstants VMSqueakClassIndices VMSqueakV3BytecodeConstants VMSqueakV3ObjectRepresentationConstants VMStackFrameOffsets'
  	category: 'VMMaker-Interpreter'!
  
  !StackInterpreter commentStamp: 'eem 9/11/2013 18:30' prior: 0!
  This class is a complete implementation of the Smalltalk-80 virtual machine, derived originally from the Blue Book specification but quite different in some areas.  This VM supports Closures but *not* old-style BlockContexts.
  
  It has been modernized with 32-bit pointers, better management of Contexts (see next item), and attention to variable use that allows the CCodeGenerator (qv) to keep, eg, the instruction pointer and stack pointer in registers as well as keeping most simple variables in a global array that seems to improve performance for most platforms.
  
  The VM does not use Contexts directly.  Instead Contexts serve as proxies for a more conventional stack format that is invisible to the image.  There is considerable explanation at http://www.mirandabanda.org/cogblog/2009/01/14/under-cover-contexts-and-the-big-frame-up.  The VM maintains a fixed-size stack zone divided into pages, each page being capable of holding several method/block activations.  A send establishes a new frame in the current stack page, a return returns to the previous frame.  This eliminates allocation/deallocation of contexts and the moving of receiver and arguments from caller to callee on each send/return.  Contexts are created lazily when an activation needs a context (creating a block, explicit use of thisContext, access to sender when sender is a frame, or linking of stack pages together).  Contexts are either conventional and heap-resident ("single") or "married" and serve as proxies for their corresponding frame or "widowed", meaning that their spouse frame has been returned from (died).  A married context is specially marked (more details in the code) and refers to its frame.  Likewise a married frame is specially marked and refers to its context.
  
  In addition to SmallInteger arithmetic and Floats, the VM supports logic on 32-bit PositiveLargeIntegers, thus allowing it to simulate itself much more effectively than would otherwise be the case.
  
  NOTE:  Here follows a list of things to be borne in mind when working on this code, or when making changes for the future.
  
  1.  There are a number of things that should be done the next time we plan to release a completely incompatible image format.  These include unifying the instanceSize field of the class format word -- see instantiateClass:indexableSize:, and unifying the bits of the method primitive index (if we decide we need more than 512, after all) -- see primitiveIndexOf:.  Also, contexts should be given a special format code (see next item).
  
  2.  There are several fast checks for contexts (see isContextHeader: and isMethodContextHeader:) which will fail if the compact class indices of BlockContext or MethodContext change.  This is necessary because the oops may change during a compaction when the oops are being adjusted.  It's important to be aware of this when writing a new image using the SystemTracer.  A better solution would be to reserve one of the format codes for Contexts only.  An even better solution is to eliminate compact classes altogether (see 6.).
  
  3.  We have made normal files tolerant to size and positions up to 32 bits.  This has not been done for async files, since they are still experimental.  The code in size, at: and at:put: should work with sizes and indices up to 31 bits, although I have not tested it (di 12/98); it might or might not work with 32-bit sizes. [Late news, the support has been extended to 64-bit file sizes].
  
  4.  Note that 0 is used in a couple of places as an impossible oop.  This should be changed to a constant that really is impossible (or perhaps there is code somewhere that guarantees it --if so it should be put in this comment).  The places include the method cache and the at cache.
  
  5. Moving to a 2 bit immediate tag and having immediate Characters is a good choice for Unicode and the JIT.  We can still have 31-bit SmallIntegers by allowing two tag patterns for SmallInteger.
  
  6.  If Eliot Miranda's 2 word header scheme is acceptable in terms of footprint (we estimate about a 10% increase in image size with about 35 reclaimed by better representation of CompiledMethod - loss of MethodProperties) then the in-line cache for the JIT is simplified, class access is faster and header access is the same in 32-bit and full 64-bit images.  [Late breaking news, the 2-word header scheme is more compact, by over 2%].  See SpurMemorymanager's class comment.!

Item was changed:
  ----- Method: StackInterpreter class>>initializeBytecodeTableForNewspeakV3PlusClosures (in category 'initialization') -----
  initializeBytecodeTableForNewspeakV3PlusClosures
  	"StackInterpreter initializeBytecodeTableForNewspeakV3PlusClosures"
  	"Note: This table will be used to generate a C switch statement."
  
  	BytecodeTable := Array new: 256.
+ 	BytecodeEncoderClassName := #EncoderForNewsqueakV3.
+ 	LongStoreBytecode := 129.
  	self table: BytecodeTable from:
  	#(
  		(  0  15 pushReceiverVariableBytecode)
  		( 16  31 pushTemporaryVariableBytecode)
  		( 32  63 pushLiteralConstantBytecode)
  		( 64  95 pushLiteralVariableBytecode)
  		( 96 103 storeAndPopReceiverVariableBytecode)
  		(104 111 storeAndPopTemporaryVariableBytecode)
  		(112 pushReceiverBytecode)
  		(113 pushConstantTrueBytecode)
  		(114 pushConstantFalseBytecode)
  		(115 pushConstantNilBytecode)
  		(116 pushConstantMinusOneBytecode)
  		(117 pushConstantZeroBytecode)
  		(118 pushConstantOneBytecode)
  		(119 pushConstantTwoBytecode)
  		(120 returnReceiver)
  		(121 returnTrue)
  		(122 returnFalse)
  		(123 returnNil)
  		(124 returnTopFromMethod)
  		(125 returnTopFromBlock)
  
  		"2 of the 3 Newspeak bytecodes"
  		(126 dynamicSuperSendBytecode)
  		(127 pushImplicitReceiverBytecode)
  
  		(128 extendedPushBytecode)
  		(129 extendedStoreBytecode)
  		(130 extendedStoreAndPopBytecode)
  		(131 singleExtendedSendBytecode)
  		(132 doubleExtendedDoAnythingBytecode)
  		(133 singleExtendedSuperBytecode)
  		(134 secondExtendedSendBytecode)
  		(135 popStackBytecode)
  		(136 duplicateTopBytecode)
  
  		(137 pushActiveContextBytecode)
  		(138 pushNewArrayBytecode)
  
  		"The last of 3 Newspeak bytecodes"
  		(139 pushExplicitOuterReceiverBytecode)
  
  		(140 pushRemoteTempLongBytecode)
  		(141 storeRemoteTempLongBytecode)
  		(142 storeAndPopRemoteTempLongBytecode)
  		(143 pushClosureCopyCopiedValuesBytecode)
  
  		(144 151 shortUnconditionalJump)
  		(152 159 shortConditionalJumpFalse)
  		(160 167 longUnconditionalJump)
  		(168 171 longJumpIfTrue)
  		(172 175 longJumpIfFalse)
  
  		"176-191 were sendArithmeticSelectorBytecode"
  		(176 bytecodePrimAdd)
  		(177 bytecodePrimSubtract)
  		(178 bytecodePrimLessThan)
  		(179 bytecodePrimGreaterThan)
  		(180 bytecodePrimLessOrEqual)
  		(181 bytecodePrimGreaterOrEqual)
  		(182 bytecodePrimEqual)
  		(183 bytecodePrimNotEqual)
  		(184 bytecodePrimMultiply)
  		(185 bytecodePrimDivide)
  		(186 bytecodePrimMod)
  		(187 bytecodePrimMakePoint)
  		(188 bytecodePrimBitShift)
  		(189 bytecodePrimDiv)
  		(190 bytecodePrimBitAnd)
  		(191 bytecodePrimBitOr)
  
  		"192-207 were sendCommonSelectorBytecode"
  		(192 bytecodePrimAt)
  		(193 bytecodePrimAtPut)
  		(194 bytecodePrimSize)
  		(195 bytecodePrimNext)
  		(196 bytecodePrimNextPut)
  		(197 bytecodePrimAtEnd)
  		(198 bytecodePrimIdentical)
  		(199 bytecodePrimClass)
  		(200 bytecodePrimSpecialSelector24)
  		(201 bytecodePrimValue)
  		(202 bytecodePrimValueWithArg)
  		(203 bytecodePrimDo)
  		(204 bytecodePrimNew)
  		(205 bytecodePrimNewWithArg)
  		(206 bytecodePrimPointX)
  		(207 bytecodePrimPointY)
  
  		(208 223 sendLiteralSelector0ArgsBytecode)
  		(224 239 sendLiteralSelector1ArgBytecode)
  		(240 255 sendLiteralSelector2ArgsBytecode)
  	)!

Item was changed:
  ----- Method: StackInterpreter class>>initializeBytecodeTableForNewspeakV3PlusClosuresNewspeakV4Hybrid (in category 'initialization') -----
  initializeBytecodeTableForNewspeakV3PlusClosuresNewspeakV4Hybrid
  	"StackInterpreter initializeBytecodeTableForNewspeakV3PlusClosuresNewspeakV4Hybrid"
  
  	| v3Table v4Table |
- 	self initializeBytecodeTableForNewspeakV3PlusClosures.
- 	v3Table := BytecodeTable.
  	self initializeBytecodeTableForNewspeakV4.
  	v4Table := BytecodeTable.
+ 	AltBytecodeEncoderClassName := BytecodeEncoderClassName.
+ 	AltLongStoreBytecode := LongStoreBytecode.
+ 	self initializeBytecodeTableForNewspeakV3PlusClosures.
+ 	v3Table := BytecodeTable.
  	BytecodeTable := v3Table, v4Table!

Item was changed:
  ----- Method: StackInterpreter class>>initializeBytecodeTableForNewspeakV4 (in category 'initialization') -----
  initializeBytecodeTableForNewspeakV4
  	"StackInterpreter initializeBytecodeTableForNewspeakV4"
  	"Note: This table will be used to generate a C switch statement."
  
  	BytecodeTable := Array new: 256.
+ 	BytecodeEncoderClassName := #EncoderForNewsqueakV4.
+ 	LongStoreBytecode := 234.
  	self table: BytecodeTable from:
  	#(	"1 byte bytecodes"
  		(   0  15 pushReceiverVariableBytecode)
  		( 16  31 pushLiteralVariable16CasesBytecode)
  		( 32  63 pushLiteralConstantBytecode)
  		( 64  75 pushTemporaryVariableBytecode)
  		( 76	 pushReceiverBytecode)
  		( 77	 extPushPseudoVariableOrOuterBytecode)
  		( 78	 pushConstantZeroBytecode)
  		( 79	 pushConstantOneBytecode)
  
  		( 80	 bytecodePrimAdd)
  		( 81	 bytecodePrimSubtract)
  		( 82	 bytecodePrimLessThanV4) "for booleanCheatV4:"
  		( 83	 bytecodePrimGreaterThanV4) "for booleanCheatV4:"
  		( 84	 bytecodePrimLessOrEqualV4) "for booleanCheatV4:"
  		( 85	 bytecodePrimGreaterOrEqualV4) "for booleanCheatV4:"
  		( 86	 bytecodePrimEqualV4) "for booleanCheatV4:"
  		( 87	 bytecodePrimNotEqualV4) "for booleanCheatV4:"
  		( 88	 bytecodePrimMultiply)
  		( 89	 bytecodePrimDivide)
  		( 90	 bytecodePrimMod)
  		( 91	 bytecodePrimMakePoint)
  		( 92	 bytecodePrimBitShift)
  		( 93	 bytecodePrimDiv)
  		( 94	 bytecodePrimBitAnd)
  		( 95	 bytecodePrimBitOr)
  
  		( 96	 bytecodePrimAt)
  		( 97	 bytecodePrimAtPut)
  		( 98	 bytecodePrimSize)
  		( 99	 bytecodePrimNext)
  		(100	 bytecodePrimNextPut)
  		(101	 bytecodePrimAtEnd)
  		(102	 bytecodePrimIdenticalV4) "for booleanCheatV4:"
  		(103	 bytecodePrimClass)
  		(104	 bytecodePrimSpecialSelector24) "was blockCopy:"
  		(105	 bytecodePrimValue)
  		(106	 bytecodePrimValueWithArg)
  		(107	 bytecodePrimDo)
  		(108	 bytecodePrimNew)
  		(109	 bytecodePrimNewWithArg)
  		(110	 bytecodePrimPointX)
  		(111	 bytecodePrimPointY)
  
  		(112 127	sendLiteralSelector0ArgsBytecode)
  		(128 143	sendLiteralSelector1ArgBytecode)
  		(144 159	sendLiteralSelector2ArgsBytecode)
  		(160 175	sendAbsentImplicit0ArgsBytecode)
  
  		(176 183	storeAndPopReceiverVariableBytecode)
  		(184 191	storeAndPopTemporaryVariableBytecode)
  
  		(192 199	shortUnconditionalJump)
  		(200 207	shortConditionalJumpTrue)
  		(208 215	shortConditionalJumpFalse)
  
  		(216		returnReceiver)
  		(217		returnTopFromMethod)
  		(218		extReturnTopFromBlock)
  
  		(219		duplicateTopBytecode)
  		(220		popStackBytecode)
  		(221		extNopBytecode)
  		(222 223	unknownBytecode)
  
  		"2 byte bytecodes"
  		(224		extABytecode)
  		(225		extBBytecode)
  
  		(226		extPushReceiverVariableBytecode)
  		(227		extPushLiteralVariableBytecode)
  		(228		extPushLiteralBytecode)
  		(229		extPushIntegerBytecode)
  		(230		longPushTemporaryVariableBytecode)
  		(231		pushNewArrayBytecode)
  		(232		extStoreReceiverVariableBytecode)
  		(233		extStoreLiteralVariableBytecode)
  		(234		longStoreTemporaryVariableBytecode)
  		(235		extStoreAndPopReceiverVariableBytecode)
  		(236		extStoreAndPopLiteralVariableBytecode)
  		(237		longStoreAndPopTemporaryVariableBytecode)
  
  		(238		extSendBytecode)
  		(239		extSendSuperBytecode)
  		(240		extSendAbsentImplicitBytecode)
  		(241		extSendAbsentDynamicSuperBytecode)
  
  		(242		extUnconditionalJump)
  		(243		extJumpIfTrue)
  		(244		extJumpIfFalse)
  
  		(245 248	unknownBytecode)
  
  		"3 byte bytecodes"
  		(249		callPrimitiveBytecode)
  
  		(250		pushRemoteTempLongBytecode)
  		(251		storeRemoteTempLongBytecode)
  		(252		storeAndPopRemoteTempLongBytecode)
  		(253		extPushClosureBytecode)
  
  		(254 255	unknownBytecode)
  	)!

Item was changed:
  ----- Method: StackInterpreter class>>initializeBytecodeTableForSqueakV3PlusClosures (in category 'initialization') -----
  initializeBytecodeTableForSqueakV3PlusClosures
  	"StackInterpreter initializeBytecodeTableForSqueakV3PlusClosures"
  	"Note: This table will be used to generate a C switch statement."
  
  	BytecodeTable := Array new: 256.
+ 	BytecodeEncoderClassName := #EncoderForV3PlusClosures.
+ 	LongStoreBytecode := 129.
  	self table: BytecodeTable from:
  	#(
  		(  0  15 pushReceiverVariableBytecode)
  		( 16  31 pushTemporaryVariableBytecode)
  		( 32  63 pushLiteralConstantBytecode)
  		( 64  95 pushLiteralVariableBytecode)
  		( 96 103 storeAndPopReceiverVariableBytecode)
  		(104 111 storeAndPopTemporaryVariableBytecode)
  		(112 pushReceiverBytecode)
  		(113 pushConstantTrueBytecode)
  		(114 pushConstantFalseBytecode)
  		(115 pushConstantNilBytecode)
  		(116 pushConstantMinusOneBytecode)
  		(117 pushConstantZeroBytecode)
  		(118 pushConstantOneBytecode)
  		(119 pushConstantTwoBytecode)
  		(120 returnReceiver)
  		(121 returnTrue)
  		(122 returnFalse)
  		(123 returnNil)
  		(124 returnTopFromMethod)
  		(125 returnTopFromBlock)
  
  		(126 127 unknownBytecode)
  
  		(128 extendedPushBytecode)
  		(129 extendedStoreBytecode)
  		(130 extendedStoreAndPopBytecode)
  		(131 singleExtendedSendBytecode)
  		(132 doubleExtendedDoAnythingBytecode)
  		(133 singleExtendedSuperBytecode)
  		(134 secondExtendedSendBytecode)
  		(135 popStackBytecode)
  		(136 duplicateTopBytecode)
  
  		(137 pushActiveContextBytecode)
  		(138 pushNewArrayBytecode)
  		(139 unknownBytecode)
  		(140 pushRemoteTempLongBytecode)
  		(141 storeRemoteTempLongBytecode)
  		(142 storeAndPopRemoteTempLongBytecode)
  		(143 pushClosureCopyCopiedValuesBytecode)
  
  		(144 151 shortUnconditionalJump)
  		(152 159 shortConditionalJumpFalse)
  		(160 167 longUnconditionalJump)
  		(168 171 longJumpIfTrue)
  		(172 175 longJumpIfFalse)
  
  		"176-191 were sendArithmeticSelectorBytecode"
  		(176 bytecodePrimAdd)
  		(177 bytecodePrimSubtract)
  		(178 bytecodePrimLessThan)
  		(179 bytecodePrimGreaterThan)
  		(180 bytecodePrimLessOrEqual)
  		(181 bytecodePrimGreaterOrEqual)
  		(182 bytecodePrimEqual)
  		(183 bytecodePrimNotEqual)
  		(184 bytecodePrimMultiply)
  		(185 bytecodePrimDivide)
  		(186 bytecodePrimMod)
  		(187 bytecodePrimMakePoint)
  		(188 bytecodePrimBitShift)
  		(189 bytecodePrimDiv)
  		(190 bytecodePrimBitAnd)
  		(191 bytecodePrimBitOr)
  
  		"192-207 were sendCommonSelectorBytecode"
  		(192 bytecodePrimAt)
  		(193 bytecodePrimAtPut)
  		(194 bytecodePrimSize)
  		(195 bytecodePrimNext)
  		(196 bytecodePrimNextPut)
  		(197 bytecodePrimAtEnd)
  		(198 bytecodePrimIdentical)
  		(199 bytecodePrimClass)
  		(200 bytecodePrimSpecialSelector24)
  		(201 bytecodePrimValue)
  		(202 bytecodePrimValueWithArg)
  		(203 bytecodePrimDo)
  		(204 bytecodePrimNew)
  		(205 bytecodePrimNewWithArg)
  		(206 bytecodePrimPointX)
  		(207 bytecodePrimPointY)
  
  		(208 223 sendLiteralSelector0ArgsBytecode)
  		(224 239 sendLiteralSelector1ArgBytecode)
  		(240 255 sendLiteralSelector2ArgsBytecode)
  	)!

Item was changed:
  ----- Method: StackInterpreter>>checkForAndFollowForwardedPrimitiveState (in category 'primitive support') -----
  checkForAndFollowForwardedPrimitiveState
  	"In Spur a primitive may fail due to encountering a forwarder.
  	 On failure check the accessorDepth for the primitive and
  	 if non-negative scan the args to the depth, following any
  	 forwarders.  Answer if any are found so the prim can be retried."
  	<option: #SpurObjectMemory>
  	| primIndex accessorDepth found |
  	self assert: self successful not.
  	found := false.
- 	primIndex := self primitiveIndexOf: newMethod.
- 	self assert: (primIndex = 117
- 				 or: [primitiveFunctionPointer = (self functionPointerFor: primIndex inClass: objectMemory nilObject)]).
  	self assert: argumentCount = (self argumentCountOf: newMethod).
+ 	primIndex := self primitiveIndexOf: newMethod.
+ 	accessorDepth := primitiveAccessorDepthTable at: primIndex.
+ 	"For the method-executing primitives, failure could have been in those primitives or the
+ 	 primitives of the methods they execute.  find out which failed by seeing what is in effect."
+ 	primIndex caseOf: {
+ 		[117] -> 
+ 			[primitiveFunctionPointer ~~ #primitiveExternalCall ifTrue:
+ 				[accessorDepth := self primitiveAccessorDepthForExternalPrimitiveMethod: newMethod]].
+ 		[118] ->
+ 			[self assert: primitiveFunctionPointer = (self functionPointerFor: primIndex inClass: objectMemory nilObject)].
+ 		[218] ->
+ 			[primitiveFunctionPointer ~~ #primitiveDoNamedPrimitiveWithArgs ifTrue:
+ 				[accessorDepth := self primitiveAccessorDepthForExternalPrimitiveMethod: newMethod]]. }
+ 		otherwise:
+ 			[self assert: primitiveFunctionPointer = (self functionPointerFor: primIndex inClass: objectMemory nilObject)].
+ 	accessorDepth >= 0 ifTrue:
+ 		[0 to: argumentCount do:
+ 			[:index| | oop |
+ 			oop := self stackValue: index.
+ 			(objectMemory isNonImmediate: oop) ifTrue:
+ 				[(objectMemory isForwarded: oop) ifTrue:
+ 					[self assert: index < argumentCount. "receiver should have been caught at send time."
+ 					 found := true.
+ 					 oop := objectMemory followForwarded: oop.
+ 					 self stackValue: index put: oop].
+ 				((objectMemory hasPointerFields: oop)
+ 				 and: [objectMemory followForwardedObjectFields: oop toDepth: accessorDepth]) ifTrue:
+ 					[found := true]]]].
- 	accessorDepth := (primIndex = 117 and: [primitiveFunctionPointer ~~ #primitiveExternalCall])
- 							ifTrue: [self primitiveAccessorDepthForExternalPrimitiveMethod: newMethod]
- 							ifFalse: [primitiveAccessorDepthTable at: primIndex].
- 	accessorDepth < 0 ifTrue:
- 		[^false].
- 	0 to: argumentCount do:
- 		[:index| | oop |
- 		oop := self stackValue: index.
- 		(objectMemory isNonImmediate: oop) ifTrue:
- 			[(objectMemory isForwarded: oop) ifTrue:
- 				[self assert: index < argumentCount. "receiver should have been caught at send time."
- 				 found := true.
- 				 oop := objectMemory followForwarded: oop.
- 				 self stackValue: index put: oop].
- 			((objectMemory hasPointerFields: oop)
- 			 and: [objectMemory followForwardedObjectFields: oop toDepth: accessorDepth]) ifTrue:
- 				[found := true]]].
  	^found!

Item was changed:
  ----- Method: StackInterpreter>>detailedSymbolicMethod: (in category 'debug support') -----
  detailedSymbolicMethod: aMethod
  	<doNotGenerate>
  	| ts prim proxy |
  	(ts := self transcript) ensureCr.
  	(prim := self primitiveIndexOf: aMethod) > 0 ifTrue:
  		[ts nextPutAll: '<primitive: '; print: prim; nextPut: $>.
  		(self isQuickPrimitiveIndex: prim) ifTrue:
  			[ts nextPutAll: ' quick method'; cr; flush.
  			 ^self].
  		ts cr].
  	proxy := VMCompiledMethodProxy new
  					for: aMethod
  					coInterpreter: self
  					objectMemory: objectMemory.
  	(DetailedInstructionPrinter on: proxy)
+ 		stackHeightComputer: (StackDepthFinder on: proxy);
- 		stackHeightComputer: ((NewspeakVM
- 										ifTrue: [NewspeakStackDepthFinder]
- 										ifFalse: [StackDepthFinder])
- 									on: proxy);
  		indent: 0;
  		printInstructionsOn: ts.
  	ts flush!

Item was changed:
  ----- Method: StackInterpreter>>longStoreBytecodeForHeader: (in category 'compiled methods') -----
  longStoreBytecodeForHeader: methodHeader
  	"Answer the relevant long store temp bytecode, which indicates it has a primitive error code."
  	"234		11101010	i i i i i i i i	Store Temporary Variable #iiiiiiii"
  	"129 		10000001 jjkkkkkk 	Store (Receiver Variable, Temporary Location, Illegal, Literal Variable) [jj] #kkkkkk"
  	<api>
  	<inline: true>
  	^self cppIf: MULTIPLEBYTECODESETS
+ 		ifTrue: [(self headerIndicatesAlternateBytecodeSet: methodHeader)
+ 					ifTrue: [AltLongStoreBytecode]
+ 					ifFalse: [LongStoreBytecode]]
+ 		ifFalse: [LongStoreBytecode]!
- 		ifTrue: [(self headerIndicatesAlternateBytecodeSet: methodHeader) ifTrue: [234] ifFalse: [129]]
- 		ifFalse: [129]!

Item was changed:
  ----- Method: StackInterpreter>>printOopShortInner: (in category 'debug printing') -----
  printOopShortInner: oop
  	| classOop name nameLen |
  	<var: #name type: #'char *'>
  	<inline: true>
  	(objectMemory isImmediate: oop) ifTrue:
  		[(objectMemory isImmediateCharacter: oop) ifTrue:
  			[^self
  				printChar: $$;
  				printChar: (objectMemory characterValueOf: oop);
  				printChar: $(;
  				printHex: (objectMemory integerValueOf: oop);
  				printChar: $)].
  		^self
  			printNum: (objectMemory integerValueOf: oop);
  			printChar: $(;
  			printHex: (objectMemory integerValueOf: oop);
  			printChar: $)].
  	(objectMemory addressCouldBeObj: oop) ifFalse:
  		[^self print: ((oop bitAnd: objectMemory allocationUnit - 1) ~= 0
  						ifTrue: [' is misaligned']
  						ifFalse: [self whereIs: oop])].
  	(objectMemory isOopForwarded: oop) ifTrue:
  		[^self printHex: oop; print: ' is a forwarder to '; printHex: (objectMemory followForwarded: oop)].
  	(self isFloatObject: oop) ifTrue:
  		[^self printFloat: (self dbgFloatValueOf: oop)].
  	classOop := objectMemory fetchClassOfNonImm: oop.
  	(objectMemory addressCouldBeObj: classOop) ifFalse:
  		[^self print: 'a ??'].
  	(objectMemory numSlotsOf: classOop) = metaclassNumSlots ifTrue:
  		[^self printNameOfClass: oop count: 5].
  	oop = objectMemory nilObject ifTrue: [^self print: 'nil'].
  	oop = objectMemory trueObject ifTrue: [^self print: 'true'].
  	oop = objectMemory falseObject ifTrue: [^self print: 'false'].
  	nameLen := self lengthOfNameOfClass: classOop.
  	nameLen = 0 ifTrue: [^self print: 'a ??'].
  	name := self nameOfClass: classOop.
  	nameLen = 10 ifTrue:
+ 		[(self str: name n: 'ByteString' cmp: 10) = 0 "strncmp is weird" ifTrue:
- 		[(self str: name n: 'ByteString' cmp: 10) not "strncmp is weird" ifTrue:
  			[^self printChar: $'; printStringOf: oop; printChar: $'].
+ 		 (self str: name n: 'ByteSymbol' cmp: 10) = 0 "strncmp is weird" ifTrue:
- 		 (self str: name n: 'ByteSymbol' cmp: 10) not "strncmp is weird" ifTrue:
  			[self printChar: $#; printStringOf: oop. ^self]].
+ 	(nameLen = 9 and: [(self str: name n: 'Character' cmp: 9) = 0]) ifTrue:
- 	(nameLen = 9 and: [(self str: name n: 'Character' cmp: 9) not]) ifTrue:
  		[^self printChar: $$; printChar: (objectMemory integerValueOf: (objectMemory fetchPointer: 0 ofObject: oop))].
  	self print: 'a(n) '.
  	self
  		cCode: [0 to: nameLen - 1 do: [:i| self printChar: (name at: i)]]
  		inSmalltalk:
  			[name isString
  				ifTrue: [self print: name]
  				ifFalse: [0 to: nameLen - 1 do: [:i| self printChar: (name at: i)]]].
  	"Try to spot association-like things; they're all subclasses of LookupKey"
  	((objectMemory instanceSizeOf: classOop) = (ValueIndex + 1)
  	 and: [(self superclassOf: classOop) = (self superclassOf: (objectMemory fetchClassOfNonImm: (objectMemory splObj: SchedulerAssociation)))
  	 and: [objectMemory isBytes: (objectMemory fetchPointer: KeyIndex ofObject: oop)]]) ifTrue:
  		[self space;
  			printOopShort: (objectMemory fetchPointer: KeyIndex ofObject: oop);
  			print: ' -> ';
  			printHex: (objectMemory fetchPointer: ValueIndex ofObject: oop)]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genPrimitiveNew (in category 'primitive generators') -----
  genPrimitiveNew
+ 	| r numArgs |
+ 	NewspeakVM
+ 		ifTrue:
+ 			[numArgs := coInterpreter argumentCountOf: methodObj.
+ 			 numArgs = 1 ifTrue:
+ 				[((r := objectRepresentation genInnerPrimitiveMirrorNew: 0) < 0
+ 				  and: [r ~= UnimplementedPrimitive]) ifTrue:
+ 					[^r]].
+ 			 numArgs = 0 ifTrue:
+ 				[((r := objectRepresentation genInnerPrimitiveNew: 0) < 0
+ 				  and: [r ~= UnimplementedPrimitive]) ifTrue:
+ 					[^r]]]
+ 		ifFalse:
+ 			[((r := objectRepresentation genInnerPrimitiveNew: 0) < 0
+ 			  and: [r ~= UnimplementedPrimitive]) ifTrue:
+ 				[^r]].
- 	| r |
- 	((r := objectRepresentation genInnerPrimitiveNew: 0) < 0
- 	 and: [r ~= UnimplementedPrimitive]) ifTrue:
- 		[^r].
  	"Call the interpreter primitive either when the machine-code primitive
  	 fails, or if the machine-code primitive is unimplemented."
  	^self compileFallbackToInterpreterPrimitive!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genPrimitiveNewWithArg (in category 'primitive generators') -----
  genPrimitiveNewWithArg
+ 	| r numArgs |
+ 	NewspeakVM
+ 		ifTrue:
+ 			[numArgs := coInterpreter argumentCountOf: methodObj.
+ 			 numArgs = 2 ifTrue:
+ 				[((r := objectRepresentation genInnerPrimitiveMirrorNewWithArg: 0) < 0
+ 				  and: [r ~= UnimplementedPrimitive]) ifTrue:
+ 					[^r]].
+ 			 numArgs = 1 ifTrue:
+ 				[((r := objectRepresentation genInnerPrimitiveNewWithArg: 0) < 0
+ 				  and: [r ~= UnimplementedPrimitive]) ifTrue:
+ 					[^r]]]
+ 		ifFalse:
+ 			[((r := objectRepresentation genInnerPrimitiveNewWithArg: 0) < 0
+ 			  and: [r ~= UnimplementedPrimitive]) ifTrue:
+ 				[^r]].
- 	| r |
- 	((r := objectRepresentation genInnerPrimitiveNewWithArg: 0) < 0
- 	 and: [r ~= UnimplementedPrimitive]) ifTrue:
- 		[^r].
  	"Call the interpreter primitive either when the machine-code primitive
  	 fails, or if the machine-code primitive is unimplemented."
  	^self compileFallbackToInterpreterPrimitive!



More information about the Vm-dev mailing list