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

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

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

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

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

Name: VMMaker.oscog-cb.2105
Author: cb
Time: 19 January 2017, 12:19:42.246677 pm
UUID: 1f5ef635-cb7b-48c2-be74-4345d39c620f
Ancestors: VMMaker.oscog-cb.2104

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

Something is fishy in debugStackPointers in the SistaVM. It fails multiple assertion. I believe it's related tobranchIfInstanceOf bytecodes

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

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!

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-cb.2105.mcz

Ronie Salgado
 
Hi Clement,

Something is fishy in debugStackPointers in the SistaVM. It fails multiple assertion. I believe it's related tobranchIfInstanceOf bytecodes
I think that the problem is in  stackDeltaForPrimitive:in:. An unary inline primitive has a stack delta of zero (Consumes one value and produce another value: -1 + 1 = 0). A binary inline primitive has a stack delta of -1 (Consumes 2 value, produce one value: -2 + 1 = -1) . A ternary inline primitive has a stack delta of -2. (Consume three values, produce one value: -3 + 1 = -2).

I think that this is the correct definition for the method:

stackDeltaForPrimitive: primitiveIndex in: method
"Answer the stack delta for the callPrimitive: bytecode (see my class comment).
There is no delta for non-inlined primitives (its implicitly 0 - method numArgs).
Inlined primitives are grouped by the thousand by argument count, 32 args max ;-)."
| prim primSet |
^primitiveIndex < 32678
ifTrue: [0]
ifFalse: [
primSet := (primitiveIndex - 32768) >> 13 bitAnd: 3.
prim := (primitiveIndex - 32768) bitAnd: 8191.
1 - (prim // 1000)
]

Best regards,
Ronie

2017-01-19 8:19 GMT-03:00 <[hidden email]>:

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

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

Name: VMMaker.oscog-cb.2105
Author: cb
Time: 19 January 2017, 12:19:42.246677 pm
UUID: 1f5ef635-cb7b-48c2-be74-4345d39c620f
Ancestors: VMMaker.oscog-cb.2104

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

Something is fishy in debugStackPointers in the SistaVM. It fails multiple assertion. I believe it's related tobranchIfInstanceOf bytecodes

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

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!


Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-cb.2105.mcz

Clément Béra
 


On Thu, Jan 19, 2017 at 2:31 PM, Ronie Salgado <[hidden email]> wrote:
 
Hi Clement,

Something is fishy in debugStackPointers in the SistaVM. It fails multiple assertion. I believe it's related tobranchIfInstanceOf bytecodes
I think that the problem is in  stackDeltaForPrimitive:in:. An unary inline primitive has a stack delta of zero (Consumes one value and produce another value: -1 + 1 = 0). A binary inline primitive has a stack delta of -1 (Consumes 2 value, produce one value: -2 + 1 = -1) . A ternary inline primitive has a stack delta of -2. (Consume three values, produce one value: -3 + 1 = -2).

I think that this is the correct definition for the method:

stackDeltaForPrimitive: primitiveIndex in: method
"Answer the stack delta for the callPrimitive: bytecode (see my class comment).
There is no delta for non-inlined primitives (its implicitly 0 - method numArgs).
Inlined primitives are grouped by the thousand by argument count, 32 args max ;-)."
| prim primSet |
^primitiveIndex < 32678
ifTrue: [0]
ifFalse: [
primSet := (primitiveIndex - 32768) >> 13 bitAnd: 3.
prim := (primitiveIndex - 32768) bitAnd: 8191.
1 - (prim // 1000)
]

Right.

Currently the StackDepthFinder implements both callPrimitive: and callInlinePrimitive:, the dispatch being done in the instructionStream based on the higher bit.

I think there are problems for your set because your set index is non zero, but my set index is 0 and StackDepthFinder>>#callInlinePrimitive: compute, as far as I understand it, the correct value.

Maybe we change the InstructionStream to call only callPrimitive, or we change callInlinedPrimitive code to make this work with Lowcode.


Best regards,
Ronie

2017-01-19 8:19 GMT-03:00 <[hidden email]>:

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

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

Name: VMMaker.oscog-cb.2105
Author: cb
Time: 19 January 2017, 12:19:42.246677 pm
UUID: 1f5ef635-cb7b-48c2-be74-4345d39c620f
Ancestors: VMMaker.oscog-cb.2104

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

Something is fishy in debugStackPointers in the SistaVM. It fails multiple assertion. I believe it's related tobranchIfInstanceOf bytecodes

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

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!