VM Maker: VMMaker.oscog-cb.2104.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.oscog-cb.2104.mcz

commits-2
 
ClementBera uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-cb.2104.mcz

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

Name: VMMaker.oscog-cb.2104
Author: cb
Time: 19 January 2017, 11:58:35.234079 am
UUID: 90bbfa32-c00f-4e99-a486-2febcdc203da
Ancestors: VMMaker.oscog-cb.2103

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.

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

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: 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!