VM Maker: VMMaker.oscogSPC-cb.2105.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscogSPC-cb.2105.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscogSPC-cb.2105.mcz

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

Name: VMMaker.oscogSPC-cb.2105
Author: eem
Time: 19 January 2017, 8:59:20.328004 am
UUID: 1917b0eb-51a0-442f-abae-5c3b09d7b82d
Ancestors: VMMaker.oscogSPC-eem.2102, VMMaker.oscog-cb.2105

Temporary branch for SpurPlanningCompactor as default compactor.  Otherwise the same as VMMaker.oscog-cb.2105.

Set deadCode to true in trap bytecode to avoid generating merge machne code that is never reached.

Fixed a bug in eventualTargetOf: where nExts was misscomputed, leading jumps targeting jumps with extensions to be incorrectly computed.

Fixed a bug where branchIfNotInstanceOf: span function misscomputed the distance when ExtB is negated to inverse the branch.

Fixed CharacterAsInteger inlined primitive.

=============== Diff against VMMaker.oscogSPC-eem.2102 ===============

Item was changed:
  ----- Method: SimpleStackBasedCogit>>v4:Long:BranchIfNotInstanceOf:Distance: (in category 'span functions') -----
  v4: descriptor Long: pc BranchIfNotInstanceOf: nExts Distance: aMethodObj
  "** 254 11111110 kkkkkkkk jjjjjjjj branch If Not Instance Of Behavior/Array Of Behavior kkkkkkkk (+ Extend A * 256, where Extend A >= 0) distance jjjjjjjj (+ Extend B * 256, where Extend B >= 0)"
  <var: #descriptor type: #'BytecodeDescriptor *'>
  | extBValue |
  self assert: nExts >= 0.
  self parseV4Exts: nExts priorTo: pc in: aMethodObj into: [:ea :eb| extBValue := eb].
+ extBValue < 0 ifTrue: [extBValue := extBValue + 128].
  ^(objectMemory fetchByte: pc + 2 ofObject: aMethodObj) + (extBValue << 8)!

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] .
  "21 identityHash (SmallInteger)"
  "22 identityHash (Character)"
  "23 identityHash (SmallFloat64)"
  "24 identityHash (Behavior)"
  "30 immediateAsInteger (Character)
  31 immediateAsInteger (SmallFloat64)"
  [30] ->
+ [self ssTop popToReg: resultReg.
+ objectRepresentation genConvertCharacterToSmallIntegerInReg: resultReg.
- [self ssTop popToReg: rcvrReg.
- objectRepresentation genConvertCharacterToSmallIntegerInReg: rcvrReg.
  self ssPop: 1]
   }
 
  otherwise:
  [^EncounteredUnknownBytecode].
  extB := 0.
  numExtB := 0.
  self ssPushRegister: resultReg.
  ^0!

Item was changed:
  ----- Method: SistaCogit>>genUnconditionalTrapBytecode (in category 'bytecode generators') -----
  genUnconditionalTrapBytecode
  "SistaV1: * 217 Trap"
  self ssFlushTo: simStackPtr.
  self CallRT: ceTrapTrampoline.
  self annotateBytecode: self Label.
+ deadCode := true.
  ^0!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>eventualTargetOf: (in category 'peephole optimizations') -----
  eventualTargetOf: targetBytecodePC
  "Attempt to follow a branch to a pc.  Handle branches to unconditional jumps
  and branches to push: aBoolean; conditional branch pairs.  If the branch cannot
  be followed answer targetBytecodePC."
 
  | currentTarget nextPC nExts descriptor span cond |
  <var: #descriptor type: #'BytecodeDescriptor *'>
  nextPC := currentTarget := targetBytecodePC.
+ [ nExts := 0.
+ [descriptor := self generatorAt: bytecodeSetOffset
- [[nExts := 0.
-  descriptor := self generatorAt: bytecodeSetOffset
  + (objectMemory fetchByte: nextPC ofObject: methodObj).
   descriptor isReturn ifTrue: [^currentTarget]. "avoid stepping off the end of methods"
   descriptor isExtension]
  whileTrue:
  [nExts := nExts + 1.
  nextPC := nextPC + descriptor numBytes].
  descriptor isUnconditionalBranch
  ifTrue:
  [span := self spanFor: descriptor at: nextPC exts: nExts in: methodObj.
  span < 0 ifTrue: "Do *not* follow backward branches; these are interrupt points and should not be elided."
  [^currentTarget].
  nextPC := nextPC + descriptor numBytes + span]
  ifFalse:
  [descriptor generator == #genPushConstantTrueBytecode ifTrue: [ cond := true ]
  ifFalse: [ descriptor generator == #genPushConstantFalseBytecode ifTrue: [ cond := false ] ifFalse: [ ^currentTarget ] ].
  "Don't step into loops across a pushTrue; jump:if: boundary, so as not to confuse stack depth fixup."
  (fixups at: nextPC - initialPC) isBackwardBranchFixup ifTrue:
  [^currentTarget].
  nextPC := self eventualTargetOf: nextPC + descriptor numBytes.
  nExts := 0.
  [descriptor := self generatorAt: bytecodeSetOffset
  + (objectMemory fetchByte: nextPC ofObject: methodObj).
   descriptor isReturn ifTrue: [^currentTarget]. "avoid stepping off the end of methods"
   descriptor isExtension]
  whileTrue:
  [nExts := nExts + 1.
  nextPC := nextPC + descriptor numBytes].
  descriptor isBranch ifFalse:
  [^currentTarget].
  descriptor isUnconditionalBranch ifTrue:
  [^currentTarget].
  nextPC := cond == descriptor isBranchTrue
  ifTrue: [nextPC
  + descriptor numBytes
  + (self spanFor: descriptor at: nextPC exts: nExts in: methodObj)]
  ifFalse: [nextPC + descriptor numBytes]].
  currentTarget := nextPC]
  repeat!