You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ivan Volosyuk (JIRA)" <ji...@apache.org> on 2007/01/19 14:38:29 UTC

[jira] Commented: (HARMONY-3023) [drlvm][jni] optimized some jni functions

    [ https://issues.apache.org/jira/browse/HARMONY-3023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466047 ] 

Ivan Volosyuk commented on HARMONY-3023:
----------------------------------------

More comments about gc pinning here.

Pining is not strict requirement for GetPrimitiveArrayCritical. But if the pining is supported the function will work much faster. The patch contains optimization of both code paths (with pinning and without it). Code path with pining is faster because of absence of heavy CPU-intensive memcpy() calls.

As for GC v4.1, pining support is improved in it by the patch following way: per object pin counter update now is a fallback case. There are now 2 per-thread pined object slots where information about last pinned object now stored. This slots are thread-local and there is no need to use expensive atomic operations here. When garbage collection starts all thread-local pin slots are flushed into the heap in corresponding per-object pin counters. This is done after stopping all thread and before actual enumeration of root set.

As for GC interfaces for pining. This quite old idea to merge gc_pin_object() and gc_is_object_pinned() into one function. Later function is quite unreliable. It can return true if other thread just pinned the object, but a moment after that object may become unpined. New variant of interface is safer (may be it even fixes some stability bug in some scenario). Now VM requests object to be pined and receives its new state in atomic manner.

> [drlvm][jni] optimized some jni functions
> -----------------------------------------
>
>                 Key: HARMONY-3023
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3023
>             Project: Harmony
>          Issue Type: Improvement
>         Environment: All
>            Reporter: Ivan Volosyuk
>         Attachments: h3023_jni_opt.diff
>
>
> Merged JNIEnv and VM_thread
> Introduced faster functions:
>    hythread_suspend_enable2(hythread_t)
>    hythread_suspend_disable2(hythread_t)
>    exn_raised(JNIEnv*)
>    exn_get(JNIEnv*)
> Optimized exn_get(), exn_raised()
> Optimized pining of objects in gc_cc. Changed interface of pinning.
> Optimized JNI: GetPrimitiveArrayCritical, GetByteArrayElements, IsInstanceOf

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira