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

commits at source.squeak.org commits at source.squeak.org
Tue Dec 17 23:07:49 UTC 2019


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

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

Name: VMMaker.oscog-eem.2618
Author: eem
Time: 17 December 2019, 3:07:30.751137 pm
UUID: 7d2a42ea-d2e4-4859-9152-f15e4d532b4c
Ancestors: VMMaker.oscog-eem.2617

Generalize OutOfLineLiteralsManager to function for 64 bits via CogOutOfLineLiteralsARMCompiler.
CogOutOfLineLiteralsARMCompiler's job is to segregate 32-bit from 64-bit literals for better packing.
Change the hack of using operand 1 in a literal to hold the "isSharable/isUnique not" flag to holding
both the flag (now as an integer in the LSB) and the literal size (in a four bit field above the LSB).
Why four?  Space is hardly pressing right now.

Nuke a method made obsolete by Tim R's much cooler PIC layout.

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

Item was changed:
  ----- Method: CogAbstractInstruction>>initializeSharableLiteral: (in category 'initialization') -----
  initializeSharableLiteral: literal
  	"For out-of-line literal support, initialize a sharable literal."
  	opcode := Literal.
  	annotation := nil. "separate := nil for Slang"
  	address := nil.
  	dependent := nil.
  	operands
  		at: 0 put: literal;
+ 		at: 1 put: (1 + (objectMemory bytesPerOop << 1));	"isSharable/isUnique not plus the size of the literal"
- 		at: 1 put: true;		"isSharable/isUnique not"
  		at: 2 put: -1			"opcodeIndex"!

Item was changed:
  ----- Method: CogAbstractInstruction>>initializeUniqueLiteral: (in category 'initialization') -----
  initializeUniqueLiteral: literal
  	"For out-of-line literal support, initialize an unsharable literal."
  	opcode := Literal.
  	annotation := nil. "separate := nil for Slang"
  	address := nil.
  	dependent := nil.
  	operands
  		at: 0 put: literal;
+ 		at: 1 put: 0 + (objectMemory bytesPerOop << 1);	"isSharable/isUnique not plus the size of the literal"
+ 		at: 2 put: -1										"opcodeIndex"!
- 		at: 1 put: false;		"isSharable/isUnique not"
- 		at: 2 put: -1			"opcodeIndex"!

Item was changed:
  ----- Method: CogOutOfLineLiteralsARMCompiler>>isSharable (in category 'generate machine code') -----
  isSharable
+ 	"Hack:  To know if a literal should be unique (not shared) mark the LSB of the second operand."
- 	"Hack:  To know if a literal should be unique (not shared) mark the second operand."
  	<inline: true>
  	self assert: opcode = Literal.
+ 	^(operands at: 1) anyMask: 1!
- 	^operands at: 1!

Item was added:
+ ----- Method: CogOutOfLineLiteralsARMCompiler>>setLiteralSize: (in category 'generate machine code - support') -----
+ setLiteralSize: literalSize
+ 	"Nothing to do in a 32-bit implementation; All out-of-line literals are 32 bits"
+ 	<inline: #always>!

Item was changed:
  ----- Method: Cogit>>CmpC32:R: (in category 'abstract instructions') -----
  CmpC32: wordConstant R: reg
  	"Generate a CmpC32R instruction to compare a 32-bit constant with a
  	 register.  If this is a 32-bit platform, simply generate a CmpCwR instruction,
  	 to avoid needless duplication in the 32-bit code generators.."
  	<inline: true>
  	<returnTypeC: #'AbstractInstruction *'>
  	^self
  		gen: (objectMemory wordSize = 8
  				ifTrue: [CmpC32R]
  				ifFalse: [CmpCwR])
+ 		literal32: wordConstant
- 		literal: wordConstant
  		operand: reg!

Item was changed:
  ----- Method: Cogit>>MoveC32:R: (in category 'abstract instructions') -----
  MoveC32: wordConstant R: reg
  	"Generate a MoveC32R instruction to move a 32-bit constant into a register.
  	 If this is a 32-bit platform, simply generate a MoveCwR instruction, to avoid
  	 needless duplication in the 32-bit code generators.."
  	<inline: true>
  	<returnTypeC: #'AbstractInstruction *'>
  	^self
  		gen: (objectMemory wordSize = 8
  				ifTrue: [MoveC32R]
  				ifFalse: [MoveCwR])
+ 		literal32: wordConstant
- 		literal: wordConstant
  		operand: reg!

Item was changed:
  ----- Method: Cogit>>MoveUniqueC32:R: (in category 'abstract instructions') -----
  MoveUniqueC32: wordConstant R: reg
  	"Generate a MoveC32R instruction to move a 32-bit constant into a register.
  	 If the backEnd is using out-of-line literals then those for inline caches cannot be shared,
  	 and this method ensures the instruction has its own unique label.  If the backEnd is using
  	 in-line literals then the literal is unique anyway and this is equivalent to MoveC32:R:.
  	 If this is a 32-bit platform, simply generate a MoveCwR instruction, to avoid
  	 needless duplication in the 32-bit code generators.."
  	<inline: true>
  	<returnTypeC: #'AbstractInstruction *'>
  	^self
  		gen: (objectMemory wordSize = 8
  				ifTrue: [MoveC32R]
  				ifFalse: [MoveCwR])
+ 		uniqueLiteral32: wordConstant
- 		uniqueLiteral: wordConstant
  		operand: reg!

Item was added:
+ ----- Method: Cogit>>gen:literal32:operand: (in category 'compile abstract instructions') -----
+ gen: opcode "<Integer>" literal32: operandOne "<Integer>" operand: operandTwo "<Integer|CogAbstractInstruction>"
+ 	"Literals are constants that either represent objects on the heap that may get updated by
+ 	 the garbage collector, or pc-relative spans that may get changed by code compaction, and
+ 	 must hence always be encoded in a form that allows updating to refer to a different value."
+ 	<inline: true>
+ 	<returnTypeC: #'AbstractInstruction *'>
+ 	^literalsManager
+ 		checkLiteral32: operandOne
+ 		forInstruction: (self gen: opcode operand: operandOne operand: operandTwo)!

Item was added:
+ ----- Method: Cogit>>gen:uniqueLiteral32:operand: (in category 'compile abstract instructions') -----
+ gen: opcode "<Integer>" uniqueLiteral32: operandOne "<Integer>" operand: operandTwo "<Integer|CogAbstractInstruction>"
+ 	<inline: true>
+ 	<returnTypeC: #'AbstractInstruction *'>
+ 	^literalsManager
+ 		uniqueLiteral32: operandOne
+ 		forInstruction: (self gen: opcode operand: operandOne operand: operandTwo)!

Item was added:
+ ----- Method: InLineLiteralsManager>>checkLiteral32:forInstruction: (in category 'compile abstract instructions') -----
+ checkLiteral32: literal forInstruction: anInstruction
+ 	<var: #anInstruction type: #'AbstractInstruction *'>
+ 	<inline: true>
+ 	^anInstruction!

Item was added:
+ ----- Method: InLineLiteralsManager>>uniqueLiteral32:forInstruction: (in category 'compile abstract instructions') -----
+ uniqueLiteral32: literal forInstruction: anInstruction
+ 	<var: #anInstruction type: #'AbstractInstruction *'>
+ 	<returnTypeC: #'AbstractInstruction *'>
+ 	<inline: true>
+ 	^anInstruction!

Item was added:
+ ----- Method: OutOfLineLiteralsManager>>checkLiteral32:forInstruction: (in category 'compile abstract instructions') -----
+ checkLiteral32: literal forInstruction: anInstruction
+ 	<inline: #always>
+ 	^self checkLiteral: literal forInstruction: anInstruction!

Item was changed:
  ----- Method: OutOfLineLiteralsManager>>checkQuickConstant:forInstruction: (in category 'compile abstract instructions') -----
  checkQuickConstant: literal forInstruction: anInstruction
  	<var: #anInstruction type: #'AbstractInstruction *'>
  	<returnTypeC: #'AbstractInstruction *'>
  	<inline: true>
  	anInstruction usesOutOfLineLiteral ifTrue:
+ 		[anInstruction dependent: (self locateLiteral: (self cCode: [literal] inSmalltalk: [literal bitAnd: 1 << (objectMemory wordSize * 8) - 1])
+ 										size: objectMemory bytesPerOop)].
- 		[anInstruction dependent: (self locateLiteral: (self cCode: [literal] inSmalltalk: [literal bitAnd: 1 << (objectMemory wordSize * 8) - 1]))].
  	^anInstruction!

Item was removed:
- ----- Method: OutOfLineLiteralsManager>>endSizeOffset (in category 'closed PIC parsing') -----
- endSizeOffset
- 	"return the offset need from the cPICEndSize in order to point to just after the last instruction - here that means bytesPerOop * list size"
- 	^nextLiteralIndex * objectMemory bytesPerOop!

Item was added:
+ ----- Method: OutOfLineLiteralsManager>>locateLiteral:size: (in category 'compile abstract instructions') -----
+ locateLiteral: aLiteral size: ignored
+ 	<inline: #always>
+ 	^self locateLiteral: aLiteral!

Item was added:
+ ----- Method: OutOfLineLiteralsManager>>uniqueLiteral32:forInstruction: (in category 'compile abstract instructions') -----
+ uniqueLiteral32: literal forInstruction: anInstruction
+ 	<var: #anInstruction type: #'AbstractInstruction *'>
+ 	<returnTypeC: #'AbstractInstruction *'>
+ 	<inline: true>
+ 	| literalInstruction |
+ 	self assert: anInstruction usesOutOfLineLiteral.
+ 	literalInstruction := self allocateLiteral: literal.
+ 	literalInstruction setLiteralSize: 4.
+ 	anInstruction dependent: literalInstruction.
+ 	^anInstruction!



More information about the Vm-dev mailing list