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

Avoid Interop TypeOfNode specializations for EnsoObject #9431

Merged
merged 11 commits into from
Mar 15, 2024

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Mar 14, 2024

Pull Request Description

Fixing inconsistency in @Specialization in TypeOfNode discovered by Radek. Testing the node in two situations - directly and after being primed to access interop TruffleObject first.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • All code follows the
    Java,
    style guides.- All code has been tested:
    • Unit tests have been written where possible.

@JaroslavTulach JaroslavTulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Mar 14, 2024
@JaroslavTulach JaroslavTulach self-assigned this Mar 14, 2024
Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for such a quick fix!

}

@ExportMessage
Type getType(@Bind("$node") Node node) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per suggestion of Christian Humber:

you should use @Bind("$node") for context references in libraries instead of arbitrary nodes. In general they might not be adoptable:

  @ExportLibrary(value = TypesLibrary.class, receiverType = Long.class)
    public static class DefaultLongExports {

        @ExportMessage
        static boolean hasType(Long receiver) {
            return true;
        }

        @ExportMessage
        static Class<?> getType(Long receiver, @Bind("$node") Node node) {
            SLContext.get(node);
            return Long.class;
        }
    }

we don't have to use @Cached("1") int ignore anymore...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... if it works. Sometimes it doesn't work and I had to add the @Cached("1") int ignore trick back.

Copy link
Contributor

@hubertp hubertp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have the same problem with long and double?

@JaroslavTulach
Copy link
Member Author

Don't we have the same problem with long and double?

I've added ValuesGenerator based test in fb59778 and both long and double seem to work.

@JaroslavTulach JaroslavTulach added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Mar 15, 2024
@JaroslavTulach JaroslavTulach merged commit 4332eab into develop Mar 15, 2024
41 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/TypeOfUnresolvedSymbol_9300 branch March 15, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants