-
Notifications
You must be signed in to change notification settings - Fork 29
New Examples: Dialects and Dynamic Function Builds #549
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
base: code-reflection
Are you sure you want to change the base?
Conversation
👋 Welcome back jfumero! A progress list of the required criteria for merging this PR into |
@jjfumero This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
Webrevs
|
/integrate |
|
||
@Override | ||
public Map<String, Object> externalize() { | ||
return Map.of("", this.typeElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typeElement
is already part of the operation, it's result type so this is duplicating information. Instead consider a property of addition as an example e.g., the kind of addition for integral types like signed, unsigned, or saturating.
|
||
private TypeElement typeElement; | ||
|
||
MyAdd(String name, List<Value> operands, TypeElement typeElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The operation name should not generally be something the user provides when constructing an operation. The name is for human readability in text, and the key that allows (re-)construction when parsing text back into code models. It's something that should be derived from other inputs and/or constant data. Further, its not something we should really use for pattern matching.
I would like to see if we could remove the name from the state of Op. OpWriter
of course needs it. Maybe by default the written operation name is the operation (fully qualified) class name, and implementations can override it maybe via a separate interface. We might be able to group the name and externalization of state under one concept for reading/parsing.
|
||
@Override | ||
public Map<String, Object> externalize() { | ||
return Map.of("", this.typeDescriptor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be the name of the function to invoke, which you are currently using as the operation name.
Thanks Paul for the feedback. I will make some modifications to adapt to these changes. |
DialectSample
: Example of how to extends the code reflectionOp
to create a new dialect.DynamicFunctionBuild
: Example of how to create a new function dynamically to compute the inverse of a square root. The code model is built dynamically for a new method and it is evaluated in theInterpreter
.How to run?
Progress
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/babylon.git pull/549/head:pull/549
$ git checkout pull/549
Update a local copy of the PR:
$ git checkout pull/549
$ git pull https://git.openjdk.org/babylon.git pull/549/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 549
View PR using the GUI difftool:
$ git pr show -t 549
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/babylon/pull/549.diff
Using Webrev
Link to Webrev Comment