Interface between fronted and trampolines: I changed the trampoline definitions in DruidJIT to use always the TempReg to send 1 parameter and get the result. Not implemented for >1 parameter (I think that I left a halt in that case).
Fix some cases of spilling (discovered by primitiveAtPut compilation).
After the last changes in the canonicalizer, we lost some optimizations (like staging) because we are performing transformation in the CFG. So I have to touch the list of optimisations 😱
Small fixes / refactors...
New primitives
Many primitiveFloat* were supported without problem.
primitiveIdentityHash -> after fixing the trampolines.
primitiveAs[Immediate] -> add intrinsics in the interpreter
Future work
primitiveValue for many args
Now Druid is compiling it only for args = 0 version.
We need to support meta-compilation of variable arguments.
primitive(Small)FloatDivide
Fix float comparison: self CmpCq: 0.0 Rd: DPFPReg1 is not implemented.
primitiveStringReplace
It expects >2 args, so they travel through the stack (similar to the SimpleStackCogit calling convention).
primitiveAtPut
I was going to compile this primitive, fixing many bugs in the meta-compiler and bah.... BUT I arrived at a problem that is better to see in another issue.
Now the primitive "works" but it is returning a trash value:
The problem is a phi function created during tail duplication:
since we duplicate a block, then new merge points are created, and the phi should be propagated. See DRBasicBlock >> mergeInstructionsWithDuplicatedBlock: duplicatedBlock withSuccessors: successors usingUsers: getUsersBlock
this algorithm creates phis of phis based on the dominator tree (ok), and it leaves Null values if any value dominates the phi (bad).
in this case, the problem is on splitting the exitBlock, which has many predecessors.
this is a "real" problem because, in the end, a copy to Null is saved as result:
See also https://github.com/pharo-project/pharo-vm/pull/757
Fixes
TempReg
to send 1 parameter and get the result. Not implemented for >1 parameter (I think that I left a halt in that case).primitiveAtPut
compilation).New primitives
primitiveFloat*
were supported without problem.primitiveIdentityHash
-> after fixing the trampolines.primitiveAs[Immediate]
-> add intrinsics in the interpreterFuture work
primitiveValue
for many argsargs = 0
version.primitive(Small)FloatDivide
self CmpCq: 0.0 Rd: DPFPReg1
is not implemented.primitiveStringReplace
primitiveAtPut
I was going to compile this primitive, fixing many bugs in the meta-compiler and bah.... BUT I arrived at a problem that is better to see in another issue.
Now the primitive "works" but it is returning a trash value:
The problem is a phi function created during tail duplication:
DRBasicBlock >> mergeInstructionsWithDuplicatedBlock: duplicatedBlock withSuccessors: successors usingUsers: getUsersBlock
Null
values if any value dominates the phi (bad).exitBlock
, which has many predecessors.ReceiverResultReg
👎