You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 766e992
Browse filesBrowse the repository at this point in the historyBrowse files
perf(runtime): skip the jweak check while Java holds the object strongly
Every cache hit in GetJavaObjectByJsObject asked JNI whether the cached weak
global ref was cleared (IsSameObject, a thread-state transition). While a
linked wrapper's Java side has not been weakened, Java's ObjectTable holds the
object strongly under its id, so the jweak cached for that id cannot have been
cleared and the check is skipped. Wrappers whose Java side was weakened (and
may have been handed back to JS since) keep it.
Two cases broke that invariant and are closed here:
- A finalizer batch that failed part way could leave objects weakened on the
Java side with javaWeakened still false. The flag is now set before the
call, so a failure leaves it conservative.
- While JS constructs an object, an instance of the same class that Java
creates inside the constructor takes the reserved id until
registerConstructedInstance replaces it. A jweak cached in that window named
the nested instance, so calls on the constructed object reached the nested
one (and, once it was collected, relied on the jweak check). The cached
entry is now dropped after registration.
0 commit comments