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

commits at source.squeak.org commits at source.squeak.org
Fri Apr 15 19:24:36 UTC 2016


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

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

Name: VMMaker.oscog-eem.1808
Author: eem
Time: 15 April 2016, 12:22:25.036517 pm
UUID: bf3ecf58-b837-41b3-bc00-a259aa39ea79
Ancestors: VMMaker.oscog-cb.1807

In the 64-bit Spur Cogit the selector index dereference routine neds to be full block aware.

=============== Diff against VMMaker.oscog-cb.1807 ===============

Item was added:
+ ----- Method: CogMethodSurrogate>>at:memory:headerSize:cogit: (in category 'instance initialization') -----
+ at: anAddress memory: memoryArray headerSize: headerSize cogit: aCogit
+ 	address := anAddress.
+ 	memory := memoryArray.
+ 	baseHeaderSize := headerSize.
+ 	cogit := aCogit!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>bitAndByteOffsetOfIsFullBlockBitInto: (in category 'in-line cacheing') -----
+ bitAndByteOffsetOfIsFullBlockBitInto: aBlock
+ 	<inline: true>
+ 	"This supplies the bitmask for the isFullBlock bit, and the offset of the byte containing
+ 	 that bit in a CogMethod header to aBlock.  We don't have named variables holding this
+ 	 offset.  Th efollowing assert tsts whether the values are correct by creating a surrogate
+ 	 on an empty ByteArray, setting the bit, and checking that the exopected values are set
+ 	 in the ByteArray."
+ 	self cCode: [] inSmalltalk:
+ 		[| m |
+ 		m := ByteArray new: 16.
+ 		CogBlockMethodSurrogate64 new
+ 			at: 0 memory: m headerSize: 8 cogit: nil;
+ 			cpicHasMNUCaseOrCMIsFullBlock: true.
+ 		self assert: m = #[0 0 0 0 0 0 0 0 0 16 0 0 0 0 0 0].
+ 		self assert: (m at: objectMemory baseHeaderSize + 2) = 16].
+ 	aBlock value: 16 value: objectMemory baseHeaderSize + 2!

Item was changed:
  ----- Method: CogObjectRepresentationFor64BitSpur>>maybeGenerateSelectorIndexDereferenceRoutine (in category 'initialization') -----
  maybeGenerateSelectorIndexDereferenceRoutine
  	"Generate the routine that converts selector indices into selector objects.
  	 It is called from the send trampolines.
  	 If the selector index is negative, convert it into a positive index into the
+ 	 special selectors array and index that.  Otherwise, index the current method.
+ 	 The routine uses Scratch0Reg & Scratch1Reg, which are available, since they
+ 	 are not live at point of send."
+ 	| jumpNegative jumpNotBlock jumpFullBlock |
- 	 special selectors array and index that.  Otherwise, index the current method."
- 	| jumpNegative jumpNotBlock |
  	<var: 'jumpNegative' type: #'AbstractInstruction *'>
  	<var: 'jumpNotBlock' type: #'AbstractInstruction *'>
+ 	<var: 'jumpFullBlock' type: #'AbstractInstruction *'>
  	cogit zeroOpcodeIndex.
  	cogit CmpCq: 0 R: ClassReg.
  	jumpNegative := cogit JumpLess: 0.
- 	self halt: 'Add handling of full blocks!!!!'.
  	cogit
  		MoveMw: FoxMethod r: FPReg R: Scratch0Reg;
  		AddCq: 2 R: ClassReg; "Change selector index to 1-relative, skipping the method header"
  		TstCq: MFMethodFlagIsBlockFlag R: Scratch0Reg.
  	jumpNotBlock := cogit JumpZero: 0.
+ 	"If in a block, need to find the home method...  If using full blocks, need to test the cpicHasMNUCaseOrCMIsFullBlock bit"
+ 	cogit AndCq: methodZone alignment negated R: Scratch0Reg.
+ 	SistaV1BytecodeSet ifTrue:
+ 		[self bitAndByteOffsetOfIsFullBlockBitInto:
+ 			[:bitmask :byteOffset|
+ 			jumpFullBlock := cogit
+ 				MoveMb: byteOffset r: Scratch0Reg R: Scratch1Reg;
+ 				TstCq: bitmask R: Scratch1Reg;
+ 				JumpNonZero: 0]].
+ 	cogit 
- 	cogit "If in a block, need to find the home method..."
- 		AndCq: methodZone alignment negated R: Scratch0Reg;
  		MoveM16: 0 r: Scratch0Reg R: Scratch1Reg;
  		SubR: Scratch1Reg R: Scratch0Reg.
  	jumpNotBlock jmpTarget: cogit Label.
+ 	SistaV1BytecodeSet ifTrue:
+ 		[jumpFullBlock jmpTarget: jumpNotBlock getJmpTarget].
  	cogit "Now fetch the method object and index with the literal index to retrieve the selector"
  		AndCq: methodZone alignment negated R: Scratch0Reg;
  		MoveMw: (cogit offset: CogMethod of: #methodObject) r: Scratch0Reg R: Scratch1Reg;
  		MoveXwr: ClassReg R: Scratch1Reg R: ClassReg;
  		RetN: 0.
  	jumpNegative jmpTarget: cogit Label.
  	cogit
  		NegateR: ClassReg;
  		LogicalShiftLeftCq: 1 R: ClassReg;
  		MoveAw: objectMemory specialObjectsArrayAddress R: Scratch0Reg;
  		SubCq: 1 R: ClassReg;
  		MoveMw: SpecialSelectors + 1 * objectMemory wordSize r: Scratch0Reg R: Scratch1Reg; "Index, including header size"
  		MoveXwr: ClassReg R: Scratch1Reg R: ClassReg;
  		RetN: 0.
  	ceDereferenceSelectorIndex := cogit methodZoneBase.
  	cogit
  		outputInstructionsForGeneratedRuntimeAt: ceDereferenceSelectorIndex;
  		recordGeneratedRunTime: 'ceDereferenceSelectorIndex' address: ceDereferenceSelectorIndex;
  		recordRunTimeObjectReferences!



More information about the Vm-dev mailing list