-
Notifications
You must be signed in to change notification settings - Fork 9
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
Harness hook #21
base: master
Are you sure you want to change the base?
Harness hook #21
Conversation
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.
mmtk-jikesrvm/mmtk/src/glue.asm
Line 73 in 3be34fc
jikesrvm_harness_begin: |
harness_begin
and harness_end
are reentrent, the glue code needs to be updated
memory_manager::harness_begin(&SINGLETON, tls) | ||
pub extern "C" fn harness_begin(id: usize) { | ||
unsafe { | ||
let thread_from_id = VMCollection::thread_from_id(id); |
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.
How does the application know thread IDs, which are internal to the VM
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.
It's the ID from Thread.getId()
, which is an application level ID.
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.
Umm, the application level thread ID Thread.getID()
is the same as RVMThread.getCurrentThread().getJavaLangThread().getId()
.
But VMCollection::thread_from_id
expects VMThread.getCurrentThread().threadSlot
.
Is there any guarantee/code/documentation that suggests they are the same?
Can you be more specific? |
Any Rust code callable from Java (either implicitly due to allocation, or explicitly due to user requested GC, harness begin, etc.) that may call into Java needs to be wrapper in some glue code written in assembly. See https://gitlab.anu.edu.au/mmtk/jikesrvm/-/issues/39 for details. |
This PR adds proper code so the harness hooks can be invoked by the Rust MMTk probe (https://github.com/mmtk/ci-perf-kit/tree/master/probes/rust_mmtk).
harness_begin()/end()
takes the current thread ID as an argument to identify the current thread.harness_begin()/end()
takestls
as an argument,tls
is VM specific and we cannot get it from the probe code (application code).harness_begin()/end()
is invoked during executing JNI code (IN_JNI
), but inside MMTk'sharness_begin()
, MMTk will invoke some VM code such asblockForGC()
. There are multiple assertions to check if the thread is in a proper state. We need to make sure the thread invokingharness_begin()/end()
is set to in a proper state.enter_vm()
/leave_vm()
to set the thread status toIN_JAVA
, and set it back.enter_vm()
before callingharness_begin()/end()
into MMTk, and callleave_vm()
after returning from MMTk.RVMThread.setExecStatus()
as public)