[Vm-dev] VM Maker: VMMaker.oscog-cb.2095.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Jan 17 12:27:01 UTC 2017
ClementBera uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-cb.2095.mcz
==================== Summary ====================
Name: VMMaker.oscog-cb.2095
Author: cb
Time: 17 January 2017, 1:26:37.587598 pm
UUID: a685bd8e-f11b-41b3-9d74-b38403dfc9b3
Ancestors: VMMaker.oscog-eem.2094
Ronie, I could not merge with your code (I got "Could no merge because one character keycode is normally not used in code")
Added support for inlined primitive #characterAsInteger.
=============== Diff against VMMaker.oscog-eem.2094 ===============
Item was changed:
----- Method: SistaCogit>>genUnaryInlinePrimitive: (in category 'inline primitive generators') -----
genUnaryInlinePrimitive: prim
"Unary inline primitives."
"SistaV1: 248 11111000 iiiiiiii mjjjjjjj Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution.
See EncoderForSistaV1's class comment and StackInterpreter>>#unaryInlinePrimitive:"
| rcvrReg resultReg |
rcvrReg := self allocateRegForStackEntryAt: 0.
resultReg := self allocateRegNotConflictingWith: (self registerMaskFor: rcvrReg).
prim
caseOf: {
"00 unchecked class"
[1] -> "01 unchecked pointer numSlots"
[self ssTop popToReg: rcvrReg.
self ssPop: 1.
objectRepresentation
genGetNumSlotsOf: rcvrReg into: resultReg;
genConvertIntegerToSmallIntegerInReg: resultReg].
"02 unchecked pointer basicSize"
[3] -> "03 unchecked byte numBytes"
[self ssTop popToReg: rcvrReg.
self ssPop: 1.
objectRepresentation
genGetNumBytesOf: rcvrReg into: resultReg;
genConvertIntegerToSmallIntegerInReg: resultReg].
"04 unchecked short16Type format numShorts"
"05 unchecked word32Type format numWords"
"06 unchecked doubleWord64Type format numDoubleWords"
[11] -> "11 unchecked fixed pointer basicNew"
[self ssTop type ~= SSConstant ifTrue:
[^EncounteredUnknownBytecode].
(objectRepresentation
genGetInstanceOf: self ssTop constant
into: resultReg
initializingIf: self extBSpecifiesInitializeInstance) ~= 0 ifTrue:
[^ShouldNotJIT]. "e.g. bad class"
self ssPop: 1] .
[20] -> "20 identityHash"
[self ssTop popToReg: rcvrReg.
objectRepresentation genGetHashFieldNonImmOf: rcvrReg asSmallIntegerInto: resultReg.
+ self ssPop: 1] .
- self ssPop: 1]
"21 identityHash (SmallInteger)"
"22 identityHash (Character)"
"23 identityHash (SmallFloat64)"
"24 identityHash (Behavior)"
+ "30 immediateAsInteger (Character)
+ 31 immediateAsInteger (SmallFloat64)"
+ [30] ->
+ [self ssTop popToReg: rcvrReg.
+ objectRepresentation genConvertCharacterToSmallIntegerInReg: rcvrReg.
+ self ssPop: 1]
}
+
otherwise:
[^EncounteredUnknownBytecode].
extB := 0.
numExtB := 0.
self ssPushRegister: resultReg.
^0!
Item was changed:
----- Method: StackInterpreter>>unaryInlinePrimitive: (in category 'miscellaneous bytecodes') -----
unaryInlinePrimitive: primIndex
"SistaV1: 248 11111000 iiiiiiii mjjjjjjj Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution."
<option: #SistaVM>
| result |
primIndex caseOf: {
"1000 unchecked class"
[0] -> [result := objectMemory fetchClassOf: self internalStackTop.
self internalStackTopPut: result].
"1001 unchecked pointer numSlots"
[1] -> [result := objectMemory numSlotsOf: self internalStackTop.
self internalStackTopPut: (objectMemory integerObjectOf: result)].
"1002 unchecked pointer basicSize"
[2] -> [result := (objectMemory numSlotsOf: self internalStackTop)
- (objectMemory fixedFieldsOfClass: (objectMemory fetchClassOfNonImm: self internalStackTop)).
self internalStackTopPut: (objectMemory integerObjectOf: result)].
"1003 unchecked byte8Type format numBytes (includes CompiledMethod)"
[3] -> [result := objectMemory numBytesOf: self internalStackTop.
self internalStackTopPut: (objectMemory integerObjectOf: result)].
"1004 unchecked short16Type format numShorts"
[4] -> [result := objectMemory num16BitUnitsOf: self internalStackTop.
self internalStackTopPut: (objectMemory integerObjectOf: result)].
"1005 unchecked word32Type format numWords"
[5] -> [result := objectMemory num32BitUnitsOf: self internalStackTop.
self internalStackTopPut: (objectMemory integerObjectOf: result)].
"1006 unchecked doubleWord64Type format numDoubleWords"
[6] -> [result := objectMemory num64BitUnitsOf: self internalStackTop.
self internalStackTopPut: (objectMemory integerObjectOf: result)].
"1011 unchecked fixed pointer basicNew"
[11] -> [| classObj numSlots |
classObj := self internalStackTop.
numSlots := objectMemory instanceSizeOf: classObj.
result := objectMemory eeInstantiateSmallClass: classObj numSlots: numSlots.
(extB noMask: 1) ifTrue:
[0 to: numSlots - 1 do:
[:i| objectMemory storePointerUnchecked: i ofObject: result withValue: objectMemory nilObject]].
extB := 0.
numExtB := 0.
self internalStackTopPut: result].
"1020 identityHash"
[20] -> [result := objectMemory hashBitsOf: self internalStackTop.
+ self internalStackTopPut: (objectMemory integerObjectOf: result)].
- self internalStackTopPut: (objectMemory integerObjectOf: result)]
"1021 identityHash (SmallInteger)"
"1022 identityHash (Character)"
"1023 identityHash (SmallFloat64)"
"1024 identityHash (Behavior)"
+ "1030 immediateAsInteger (Character)
+ 1031 immediateAsInteger (SmallFloat64)"
+ [30] -> [ result := objectMemory characterValueOf: self internalStackTop.
+ self internalStackTopPut: (objectMemory integerObjectOf: result)]
}
otherwise:
[localIP := localIP - 3.
self respondToUnknownBytecode]!
More information about the Vm-dev
mailing list