harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ronald Servant (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-3090) Create a new table based API for thread library functions
Date Tue, 30 Jan 2007 15:45:33 GMT
Create a new table based API for thread library functions
---------------------------------------------------------

                 Key: HARMONY-3090
                 URL: https://issues.apache.org/jira/browse/HARMONY-3090
             Project: Harmony
          Issue Type: Improvement
          Components: Classlib
            Reporter: Ronald Servant
         Attachments: thread_api_harmony_patch_20070130.txt

Both DRLVM and the IBM VME maintain their own implementations of the hythr shared library
(not always named hythr).  This leads to a situation where the VM is linked against one of
the shared libraries and the classlib is linked against another.  The internal implementation
of hythr assumes a certain amount of coordination between the threading functions.  For the
most part this does not lead to problems when things aren't co-ordinated.  However there have
been issues.

One such issue would involve thread local storage (TLS).  The Harmony implementation of TLS
uses static variables as the basis for its implementation.  Those statics are confined on
a shared library basis.  Meaning that if a TLS value was being set when the VM called a thread
lib function, a call to a thread lib function from the classlib would not see that TLS data.
 This is due to the VM and classlib using different thread library shared libraries.  

The above is the case when the shared libraries contain the same implementation.  A similar
scenario arises when the shared libraries for threading do not contain the same implementation.
 

The thread library used by the VM, for example, could be relying on some storing values in
TLS that will modify the behaviour of other calls to thread library functions.  When the classlib
calls it's own implementation of thread library functions, the behvaiour of those functions
will not be modified by the values set in TLS by the VM.  This could lead interesting hard
to diagnose failures in the runtime as a whole.

A solution to these problems would be to create a standard thread API, much like the one created
for the port library.

The VM would become responsible for providing the hythr shared library. The classlib (and
other tools that use threading functions) would compile against the API and no-opt implementation
of hythr.

The attached patch is one possible implementation of this idea.  It creates a thread library
table (HyThreadLibrary) much like the port library table.  The thread library is created by
the port library during the port library's initialization.  The thread library can be obtained
from the port library using the new port_get_thread_library() function.  

Also, the VMI has been extended to include a new GetThreadLibrary() function.  Alternatively,
we could leave the VMI as is and modify the following defines in hythread.h to:
#define THREAD_ACCESS_FROM_VMI(vmi) HyPortLibrary *privatePortLibraryForThread = (*vmi)->GetPortLibrary(vmi);
\
HyThreadLibrary *privateThreadLibrary = privatePortLibraryForThread ->port_get_thread_library(privatePortLibraryForThread)

THREAD_ACCESS_FROM_ENV and THREAD_ACCESS_FROM_JAVAVM would need to be modified in a similar
way.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message