-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Enhancing Insight to allow tracking of reads/writes of local variables #12760
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: master
Are you sure you want to change the base?
Conversation
JaroslavTulach
left a comment
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.
@chumer please review the concept of my change. I'll polish it and provide some documentation then.
...e.tools.agentscript/src/com/oracle/truffle/tools/agentscript/impl/AbstractContextObject.java
Outdated
Show resolved
Hide resolved
...e.truffle.tools.agentscript/src/com/oracle/truffle/tools/agentscript/impl/InsightFilter.java
Show resolved
Hide resolved
|
Can you describe what your use-case for this feature is? Please note that reads and write tags for dynamic languages are typically not fully reliable, so they typically fall short of being useful. So I am curious what you are using them for. |
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.
Looks mostly good. Please also add a changelog entry to tools changelog.md.
...e.tools.agentscript/src/com/oracle/truffle/tools/agentscript/impl/AbstractContextObject.java
Outdated
Show resolved
Hide resolved
|
I don't see the use-case there. What feature would you use this instrumentation for? Or how would you recommend your users to use it?
Implicit local reads and writes without a dedicated node won't be instrumented. For example reads from objects often happen implicitly as part of the semantics of other operations. This makes read/write instrumentation not really useful if you want to e.g. track side-effects of a method. This is why I asked for the use-case. It is possible that Enso actually does not do implicit reads/writes. JS certainly does, so instrumenting reads/writes won't actually instrument all reads/writes.
See above. Of course when the tags are specified the individual instrumentations are reliable, but incomplete. |
Enso Runtime Cache
|
|
Why would you want to use instrumentation for that and not make this behavior part of the language? From what I understand caching is really a first-class citizen in Enso, no? It also does not really translate across languages, because for example you cannot cache values in JS with read/write tags without changing JS semantics. Instrumentation comes with all sorts of footprint overheads, that you typically don't care for debugging, but for language feature use-cases its not ideal. It typically is better to implement that directly in the language. |
|
|
I still would implement this as an embedding extension point for the language. I do not think this approach will work well for Python, because it is potentially side-effecting pretty much everywhere. We currently have no plan to implement READ/WRITE instrumentation there (to my knowledge).
I was mostly talking about memory footprint and interpretation overhead. It is still several indirections to get to your instrumentation code (even more with insight). A language specific implementation would be better in terms of memory footprint and interpreter performance. For peak performance, instrumentation has no overhead on its own. Insight is worse than pure instrumentation for peak performance in the sense that it is always at least one guest level call which is comparable to a TruffleBoundary call (one that sets alllowInlining=true). With pure Truffle instrumentation you can implement this also without any call boundary, so you can theoretically achieve better performance than with insight (but its arguably less flexible as it needs to be baked into the native-image).
It seams READ and WRITE instrumentation is covering all reads and writes in Enso, so this feature makes sense there. We also support it in Truffle instrumentation as a standard tag, so it also makes sense to support it in Insight. I mostly wanted to understand what your use-case and recommend alternatives, which I did now. The change looks fine to me. Will integrate this. |
|
@JaroslavTulach gate is still failing. Can you still adress this? |
|
|
|
Thanks for your contribution! I am currently running the internal CI. There is no action required on your end. I will take it from here.
I think they should go out as part of EA soon. We do not have a release date for 25.1 yet. |
roots,expressionsandstatementsare instrumentation types, but also:{ reads: true, writes: true }getNodeObjectviactx.attrsInstrumentationTestLanguagewith support for these tags, CCing @chumer