Add Jvm object monitor and remove rust_object_field from Object/Thread#138
Add Jvm object monitor and remove rust_object_field from Object/Thread#138
Conversation
ccb4fae to
b689ca9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccb4fae105
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #138 +/- ##
==========================================
- Coverage 78.76% 78.60% -0.17%
==========================================
Files 178 178
Lines 7286 7287 +1
==========================================
- Hits 5739 5728 -11
- Misses 1547 1559 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b689ca9 to
ab975de
Compare
There was a problem hiding this comment.
Pull request overview
This PR moves object/thread wait/notify mechanics out of rust_object_field storage and into a JVM-managed per-object monitor table, and updates java.lang.Thread/java.lang.Object to use it.
Changes:
- Added
Jvm::{object_listen, object_wait, object_notify}backed by a JVM-level monitor map. - Replaced
Object.waitEvent/Thread.joinEventrust-object-field storage with JVM monitors and a newThread.alivefield. - Updated
Thread.jointo register a listener before checking liveness, and implementedThread.isAliveto reflect actual state.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
jvm/src/jvm.rs |
Adds JVM-level monitor storage and APIs for object wait/notify. |
jvm/Cargo.toml |
Introduces the event-listener dependency for monitor implementation. |
java_runtime/src/classes/java/lang/thread.rs |
Reworks Thread join/isAlive to use JVM monitors and a new alive field. |
java_runtime/src/classes/java/lang/object.rs |
Reworks Object.wait/notify to use JVM monitors rather than per-object rust fields. |
Cargo.lock |
Locks the new dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ab975de to
70c6193
Compare
Summary
object_wait,object_listen,object_notifymethods toJvmbacked by a per-objectEventmonitor tableArc<Event>stored viarust_object_fieldinObject.waitEventandThread.joinEventwith Jvm-level monitorThread.joinnow usesobject_listen+ alive check pattern to avoid race condition (listen registered before condition check)Thread.isAlivenow returns actual alive state instead of stubtruewaitEvent: [Bfrom Object,joinEvent: [Bfrom Thread, addsalive: Zto ThreadThis completes removal of all
rust_object_fieldusage fromjava_runtime. Onlyjava_lang_class.rs(jvm crate) remains, using byte array for class name due to circular dependency with String class.