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

commits at source.squeak.org commits at source.squeak.org
Sun Dec 22 17:00:26 UTC 2019


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

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

Name: VMMaker.oscog-eem.2627
Author: eem
Time: 22 December 2019, 9:00:07.446301 am
UUID: 8bf5571e-4111-45c0-b4ac-e6921df808b8
Ancestors: VMMaker.oscog-eem.2626

Cogit: hashMultiply never fails in SmallInteger.

Generalise the lit crawler in initializeSpecificOpcodes:in: so that exotically initialized class vars are less likely to get sent to Undeclared.

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

Item was changed:
  ----- Method: CogAbstractInstruction class>>initializeSpecificOpcodes:in: (in category 'class initialization') -----
  initializeSpecificOpcodes: opcodeSymbolSequence in: initializeMethod
  	"Declare as class variables, the opcodes in opcodeSymbolSequence.
  	 Assign values to them from LastRTLOpcode on.  Undeclare any obsolete
  	 class vars.  The assumption is that initializeMethod defines all class vars
  	 in the class. This method should be used by subclasses wishing to declare
  	 their own specific opcodes."
  	| pool classVariablesDefinedInMethod |
  	self assert: self ~~ CogAbstractInstruction.
  	pool := initializeMethod methodClass classPool.
  	LastRTLCode ifNil:
  		[CogRTLOpcodes initialize].
+ 	classVariablesDefinedInMethod := Set new.
+ 	initializeMethod allLiteralsDo:
+ 		[:lit|
+ 		(lit isSymbol and: [pool includesKey: lit])
+ 			ifTrue: [classVariablesDefinedInMethod add: lit]
+ 			ifFalse:
+ 				[(lit isVariableBinding and: [pool includesKey:lit key]) ifTrue:
+ 					[classVariablesDefinedInMethod add: lit key]]].
- 	classVariablesDefinedInMethod := (initializeMethod allLiterals select: [:l| l isVariableBinding and: [pool includesKey: l key]]) collect:
- 											[:ea| ea key].
  	"Undeclare any class var not defined in opcodeSymbolSequence or by the method."
  	(pool keys reject: [:k| (opcodeSymbolSequence includes: k) or: [classVariablesDefinedInMethod includes: k]]) do:
  		[:k|
  		Undeclared declare: k from: pool].
  	"Declare opcodeSymbolSequence's elements from LastRTLCode on up."
  	opcodeSymbolSequence withIndexDo:
  		[:classVarName :value|
  		pool
  			declare: classVarName from: Undeclared;
  			at: classVarName put: value + LastRTLCode - 1]!

Item was changed:
  ----- Method: SimpleStackBasedCogit>>genPrimitiveHashMultiply (in category 'primitive generators') -----
  genPrimitiveHashMultiply
  	"Implement 28-bit hashMultiply for SmallInteger and LargePositiveInteger receivers."
  	| jmpFailImm jmpFailNotPositiveLargeInt |
  	backEnd canMulRR ifFalse:
  		[^UnimplementedPrimitive].
  
  	self mclassIsSmallInteger ifTrue:
  		[objectRepresentation genConvertSmallIntegerToIntegerInReg: ReceiverResultReg.
  		 self MoveCq: HashMultiplyConstant R: TempReg.
  		 self MulR: TempReg R: ReceiverResultReg.
  		 self AndCq: HashMultiplyMask R: ReceiverResultReg.
  		 objectRepresentation genConvertIntegerToSmallIntegerInReg: ReceiverResultReg.
  		 self RetN: 0.
+ 		 ^CompletePrimitive].
- 		 ^0].
  
  	"This check is necessary.  LargeNegativeInteger is a subclass of LargePositiveInteger in Squeak, Pharo, Cuis, et al."
  	jmpFailImm := objectRepresentation genJumpImmediate: ReceiverResultReg.
  	objectRepresentation genGetCompactClassIndexNonImmOf: ReceiverResultReg into: ClassReg.
  	self CmpCq: ClassLargePositiveIntegerCompactIndex R: ClassReg.
  	jmpFailNotPositiveLargeInt := self JumpNonZero: 0.
  	objectRepresentation genLoadSlot: 0 sourceReg: ReceiverResultReg destReg: ReceiverResultReg.
  	self MoveCq: HashMultiplyConstant R: TempReg.
  	self MulR: TempReg R: ReceiverResultReg.
  	self AndCq: HashMultiplyMask R: ReceiverResultReg.
  	objectRepresentation genConvertIntegerToSmallIntegerInReg: ReceiverResultReg.
  	self RetN: 0.
  
  	jmpFailImm jmpTarget: (jmpFailNotPositiveLargeInt jmpTarget: self Label).
+ 	^CompletePrimitive!
- 	^0!



More information about the Vm-dev mailing list