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

Adding supernodes #185

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open

Adding supernodes #185

wants to merge 38 commits into from

Conversation

smarr
Copy link
Member

@smarr smarr commented Apr 24, 2023

This PR attempts to merge all the supernodes that were developed into the main branch.

Though, at this point, it's still a work in progress, and this PR is helping to track the work that needs to be done.

TODOs

  • have full list of supported supernode patterns
  • have full test coverage for all supported supernode pattern
  • ensure we do not regress performance of the bytecode interpreter, which seems to be currently the case
  • make sure all supernodes from all the branches are included

List of Supernodes

Increment/Decrement Nodes

  • add/subtract literal (implemented with Implement more supernodes for incrementing/decrementing #221)
    • e - k or e + k (e: arbitrary expression, k: constant integer)
    • for field inc/dec: field := field + 1 and field := field - 323
    • for field with arbitrary expression: field := field + e, field := field - e.

Square Nodes

  • implemented with Add Square supernodes #220
    • basic multiplication of a variable with itself:
      • local * local
      • | l | [ l * l ]
    • multiplication and assigning result to local
      • b := l * l
      • also for non-local variants

Literal Comparison Nodes

smarr and others added 30 commits April 23, 2023 21:57
The most common version of this is sending to self.

Signed-off-by: Stefan Marr <[email protected]>
This also adds the support in the bytecode interpreter (this is mostly incidental, since I had to remove it completely, too)

Signed-off-by: Stefan Marr <[email protected]>
- also supports `-` as operator in parser
- add tests
- add fallback support

Signed-off-by: Stefan Marr <[email protected]>
Cherry-picked from supernodes branch
- do specialization in the parser to do it as early as possible
- remove AssignLocalSquareToLocalNode which is the run-time specialization version

Signed-off-by: Stefan Marr <[email protected]>
…string comparions.

For the nil case in the string comparison, we store `nil` in a local static field to avoid type restrictions of the DSL.

Signed-off-by: Stefan Marr <[email protected]>
This node inlines the argument and field reading and does the string equal.
There's theoretical an early abort for non-object fields.
Though, we don't have those in our benchmarks.
Well, perhaps uninitialized fields.
Though, the structure of the lookup, and caching makes that tricky. Not sure it's worth optimizing that.

Signed-off-by: Stefan Marr <[email protected]>
SomSom's parser also has `text := text + self currentChar.` where `text` is a field in the lexer.

Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
…ntexts…

Make sure we track the context correctly for each variable.

Add a specialization that fetches the context only once if possible.
This avoids issues in Eclipse with the SomTests interferring with the context of TruffleTestSetup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants