graal icon indicating copy to clipboard operation
graal copied to clipboard

HostObject interop with wrapping TruffleObject

Open JaroslavTulach opened this issue 3 years ago • 3 comments

Enso language supports values with warnings. They are implemented as a TruffleObject that wraps original object, holds the warnings and delegates all messages via ReflectionLibrary to the original object. Find more details in the implementation.

This PR provides a test showing the use-case and demonstrating the failure as the first commit. Additional commits follow showing possible implementation making the test work: 629d3df

JaroslavTulach avatar Sep 10 '22 07:09 JaroslavTulach

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA). The following contributors of this PR have not signed the OCA:

  • PR author: @JaroslavTulach

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When singing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

Are you using WrapObject.wrap in production code, if so why?

I agree the kind of refactoring sketched in https://github.com/oracle/graal/pull/4916/commits/6b9dfae0ef8157a09510dcea9d1860e1411755b2 would roughly do the trick. We cannot however just use uncached everywhere, that would lead to a performance regression. We would need to create cached libraries and use them where appropriate. We also have some dependent EE code we would need to fix on our side for this.

chumer avatar Sep 12 '22 09:09 chumer

Are you using WrapObject.wrap in production code, if so why?

No, that's just for the test. The production code has EnsoLanguage extends TruffleLanguage and obtains TruffleObject via lookupHostSymbol. I can rewrite the test to avoid reflection, if I get guidance what to copy. I have found tests for HostObject and tests for looking Java classes up, but none that mixes both together.

JaroslavTulach avatar Sep 12 '22 10:09 JaroslavTulach

@JaroslavTulach has now signed an OCA.

dougxc avatar Oct 10 '22 07:10 dougxc

I have to put this PR on hold as I don't have time to finish it right now.

JaroslavTulach avatar Jan 31 '23 05:01 JaroslavTulach