Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile primitiveAtPut - Problem with Null s #134

Open
PalumboN opened this issue Apr 2, 2024 · 2 comments
Open

Compile primitiveAtPut - Problem with Null s #134

PalumboN opened this issue Apr 2, 2024 · 2 comments
Labels
primitive Compiling primitives

Comments

@PalumboN
Copy link
Contributor

PalumboN commented Apr 2, 2024

  • 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" (store the expected value in the expected object) 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:
      image
    • but the CodeGenerator is ignoring the copies to Null:
      DRCogitCodeGenerator >> visitCopy: aDRMove [
      | moveOperands |
      "Do not generate moves of null values"
      aDRMove operand1 isNullValue ifTrue: [ ^ self ].
    • So at the end, the Cogit code is copying trash to the ReceiverResultReg 👎
@PalumboN
Copy link
Contributor Author

PalumboN commented Apr 2, 2024

Some work around the commented bug was done in https://github.com/Alamvic/druid/pull/132/files

But it needs more work, this primitive was not fixed.

@PalumboN PalumboN added the primitive Compiling primitives label Apr 2, 2024
@PalumboN
Copy link
Contributor Author

PalumboN commented Apr 4, 2024

Also check if we can rollback this dangerous change: #132 (comment)

@PalumboN PalumboN changed the title Compile primitiveAtPut Compile primitiveAtPut - Problem with Null s Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
primitive Compiling primitives
Projects
None yet
Development

No branches or pull requests

1 participant