harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r434076 [2/18] - in /incubator/harmony/enhanced/drlvm/trunk: build/make/components/ build/make/components/vm/ build/make/targets/ build/patches/lnx/ build/patches/lnx/APR/ build/patches/lnx/APR/threadproc/ build/patches/lnx/APR/threadproc/u...
Date Wed, 23 Aug 2006 16:49:21 GMT
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/gc_v4.cpp Wed Aug 23 09:48:41 2006
@@ -26,8 +26,9 @@
 using namespace std;
 
 // VM interface header files
-#include "platform_lowlevel.h"
+#include "open/vm_util.h"
 #include "open/vm_gc.h"
+#include "open/hythread_ext.h"
 
 // GC header files
 #include "gc_cout.h"
@@ -100,7 +101,7 @@
 
     _p_block_store  = new Block_Store(initial_heap_size, final_heap_size, block_size_bytes);
     
-    _gc_thread_work_finished_event_handles = (HANDLE *) STD_MALLOC(sizeof(HANDLE) * get_num_worker_threads());
+    _gc_thread_work_finished_event_handles = (hysem_t *) STD_MALLOC(sizeof(hysem_t ) * get_num_worker_threads());
     
     if (mark_scan_load_balanced) {
         _mark_scan_pool = new Work_Packet_Manager();
@@ -721,8 +722,8 @@
     for (unsigned int y = 0; y < get_num_worker_threads(); y++) {
         
         _gc_threads[y]->set_task_to_do(task);
-        Boolean UNUSED sstat = SetEvent(_gc_threads[y]->get_gc_thread_start_work_event_handle());
-        assert(sstat);
+        IDATA UNUSED sstat = hysem_post(_gc_threads[y]->get_gc_thread_start_work_event_handle());
+        assert(sstat == TM_ERROR_NONE);
     }
 }
 
@@ -730,9 +731,8 @@
 void 
 Garbage_Collector::wait_for_gc_threads_to_complete_assigned_task()
 {
-    DWORD UNUSED ret = WaitForMultipleObjects( (DWORD) get_num_worker_threads(), (const HANDLE *)_gc_thread_work_finished_event_handles, TRUE, INFINITE);
-    assert(ret != WAIT_TIMEOUT);
-    assert(ret != WAIT_FAILED);
+    IDATA UNUSED sstat = wait_for_multiple_semaphores( get_num_worker_threads(), _gc_thread_work_finished_event_handles);
+    assert(sstat == TM_ERROR_NONE);
 }
 
 #undef LOG_DOMAIN

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/work_packet_manager.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/work_packet_manager.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/work_packet_manager.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/gc/src/work_packet_manager.cpp Wed Aug 23 09:48:41 2006
@@ -26,6 +26,7 @@
 #include <memory.h>
 #include <assert.h>
 #include <time.h>
+#include <open/hythread_ext.h>
 
 
 // VM interface header files
@@ -299,7 +300,7 @@
             }
         }
 
-        Sleep(0);
+        hythread_sleep(0);
 
 #ifndef _IPF_
 #ifndef PLATFORM_POSIX

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h Wed Aug 23 09:48:41 2006
@@ -20,7 +20,7 @@
 
 /**
  * @file This file describes the JNI interface as per the JNI
- * specification 1.4 available from Sun.
+ * specification 1.5 available from Sun.
  */
 
 #ifndef _JNI_H_

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/include/jvmti_types.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/jvmti_types.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/jvmti_types.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/jvmti_types.h Wed Aug 23 09:48:41 2006
@@ -42,8 +42,7 @@
     typedef jobject jthread;
     typedef jlong jlocation;
     typedef jobject jthreadGroup;
-    struct jrawMonitorID_struct;
-    typedef struct jrawMonitorID_struct *jrawMonitorID;
+    typedef int jrawMonitorID;
     typedef struct JNINativeInterface_ jniNativeInterface;
 
 

Added: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hycomp.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hycomp.h?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hycomp.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hycomp.h Wed Aug 23 09:48:41 2006
@@ -0,0 +1,324 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(hycomp_h)
+#define hycomp_h
+
+/*
+USE_PROTOTYPES:       Use full ANSI prototypes.
+CLOCK_PRIMS:          We want the timer/clock prims to be used
+LITTLE_ENDIAN:        This is for the intel machines or other
+                      little endian processors. Defaults to big endian.
+NO_LVALUE_CASTING:    This is for compilers that don't like the left side
+                      of assigns to be cast.  It hacks around to do the
+                      right thing.
+ATOMIC_FLOAT_ACCESS:  So that float operations will work.
+LINKED_USER_PRIMITIVES: Indicates that user primitives are statically linked
+                        with the VM executeable.
+OLD_SPACE_SIZE_DIFF:  The 68k uses a different amount of old space.
+                      This "legitimizes" the change.
+SIMPLE_SIGNAL:        For machines that don't use real signals in C.
+                      (eg: PC, 68k)
+OS_NAME_LOOKUP:       Use nlist to lookup user primitive addresses.
+VMCALL:               Tag for all functions called by the VM.
+VMAPICALL:            Tag for all functions called via the PlatformFunction
+                      callWith: mechanism.
+      
+SYS_FLOAT:  For some math functions where extended types (80 or 96 bits) are returned
+            Most platforms return as a double
+FLOAT_EXTENDED: If defined, the type name for extended precision floats.
+PLATFORM_IS_ASCII: Must be defined if the platform is ASCII
+EXE_EXTENSION_CHAR: the executable has a delimiter that we want to stop at as part of argv[0].
+*/
+/* By default order doubles in the native (i.e. big/little endian) ordering. */
+#define HY_PLATFORM_DOUBLE_ORDER
+#if defined(LINUX)
+/* NOTE: Linux supports different processors -- do not assume 386 */
+#if defined(LINUXPPC64)
+#define DATA_TYPES_DEFINED
+typedef unsigned long int UDATA;        /* 64bits */
+typedef unsigned long int U_64;
+typedef unsigned int U_32;
+typedef unsigned short U_16;
+typedef unsigned char U_8;
+typedef signed long int IDATA;  /* 64bits */
+typedef long int I_64;
+typedef signed int I_32;
+typedef signed short I_16;
+typedef signed char I_8;
+//typedef U_32 BOOLEAN;
+#if defined(LINUXPPC64)
+#define TOC_UNWRAP_ADDRESS(wrappedPointer) ((void *) (wrappedPointer)[0])
+#define TOC_STORE_TOC(dest,wrappedPointer) (dest = ((UDATA*)wrappedPointer)[1])
+#endif
+#else
+typedef long long I_64;
+typedef unsigned long long U_64;
+#endif
+typedef double SYS_FLOAT;
+#define HYCONST64(x) x##LL
+#define NO_LVALUE_CASTING
+#define FLOAT_EXTENDED  long double
+#define PLATFORM_IS_ASCII
+#define PLATFORM_LINE_DELIMITER "\012"
+#define DIR_SEPARATOR '/'
+#define DIR_SEPARATOR_STR "/"
+
+/* no priorities on Linux */
+#define HY_PRIORITY_MAP {0,0,0,0,0,0,0,0,0,0,0,0}
+
+#if (defined(LINUXPPC) && !defined(LINUXPPC64))
+#define VA_PTR(valist) (&valist[0])
+#endif
+#endif
+
+#define GLOBAL_DATA(symbol) ((void*)&(symbol))
+#define GLOBAL_TABLE(symbol) GLOBAL_DATA(symbol)
+
+/* Win32 - Windows 3.1 & NT using Win32 */
+#if defined(WIN32)
+
+typedef __int64 I_64;
+typedef unsigned __int64 U_64;
+
+typedef double SYS_FLOAT;
+#define NO_LVALUE_CASTING
+#define VMAPICALL _stdcall
+#define VMCALL _cdecl
+#define EXE_EXTENSION_CHAR  '.'
+
+#define DIR_SEPARATOR '\\'
+#define DIR_SEPARATOR_STR "\\"
+
+/* Modifications for the Alpha running WIN-NT */
+#if defined(_ALPHA_)
+#undef small                    /* defined as char in rpcndr.h */
+typedef double FLOAT_EXTENDED;
+#endif
+
+#define HY_PRIORITY_MAP { \
+  THREAD_PRIORITY_IDLE,             /* 0 */\
+  THREAD_PRIORITY_LOWEST,           /* 1 */\
+  THREAD_PRIORITY_BELOW_NORMAL,     /* 2 */\
+  THREAD_PRIORITY_BELOW_NORMAL,     /* 3 */\
+  THREAD_PRIORITY_BELOW_NORMAL,     /* 4 */\
+  THREAD_PRIORITY_NORMAL,           /* 5 */\
+  THREAD_PRIORITY_ABOVE_NORMAL,     /* 6 */\
+  THREAD_PRIORITY_ABOVE_NORMAL,     /* 7 */\
+  THREAD_PRIORITY_ABOVE_NORMAL,     /* 8 */\
+  THREAD_PRIORITY_ABOVE_NORMAL,     /* 9 */\
+  THREAD_PRIORITY_HIGHEST,          /*10 */\
+  THREAD_PRIORITY_TIME_CRITICAL     /*11 */}
+#endif
+
+#if !defined(VMCALL)
+#define VMCALL
+#define VMAPICALL
+#endif
+#define PVMCALL VMCALL *
+/* Provide some reasonable defaults for the VM "types":
+  UDATA     unsigned data, can be used as an integer or pointer storage.
+  IDATA     signed data, can be used as an integer or pointer storage.
+  U_64 / I_64 unsigned/signed 64 bits.
+  U_32 / I_32 unsigned/signed 32 bits.
+  U_16 / I_16 unsigned/signed 16 bits.
+  U_8 / I_8   unsigned/signed 8 bits (bytes -- not to be confused with char)
+  BOOLEAN something that can be zero or non-zero.
+*/
+#if !defined(DATA_TYPES_DEFINED)
+typedef unsigned int UDATA;
+typedef unsigned int U_32;
+typedef unsigned short U_16;
+typedef unsigned char U_8;
+/* no generic U_64 or I_64 */
+typedef int IDATA;
+typedef int I_32;
+typedef short I_16;
+typedef char I_8;
+/* don't typedef BOOLEAN since it's already def'ed on Win32 */
+#ifdef LINUX
+#define BOOLEAN UDATA
+#endif
+#endif
+
+#if !defined(HYCONST64)
+#define HYCONST64(x) x##L
+#endif
+
+#if !defined(HY_DEFAULT_SCHED)
+/* by default, pthreads platforms use the SCHED_OTHER thread scheduling policy */
+#define HY_DEFAULT_SCHED SCHED_OTHER
+#endif
+
+#if !defined(HY_PRIORITY_MAP)
+/* if no priority map if provided, priorities will be determined algorithmically */
+#endif
+
+#if !defined(FALSE)
+#define FALSE   ((BOOLEAN) 0)
+#if !defined(TRUE)
+#define TRUE    ((BOOLEAN) (!FALSE))
+#endif
+#endif
+
+#if !defined(NULL)
+#if defined(__cplusplus)
+#define NULL    (0)
+#else
+#define NULL    ((void *)0)
+#endif
+#endif
+#define USE_PROTOTYPES
+#if defined(USE_PROTOTYPES)
+#define PROTOTYPE(x)  x
+#define VARARGS   , ...
+#else
+#define PROTOTYPE(x)  ()
+#define VARARGS
+#endif
+/* Assign the default line delimiter if it was not set */
+#if !defined(PLATFORM_LINE_DELIMITER)
+#define PLATFORM_LINE_DELIMITER "\015\012"
+#endif
+/* Set the max path length if it was not set */
+#if !defined(MAX_IMAGE_PATH_LENGTH)
+#define MAX_IMAGE_PATH_LENGTH (2048)
+#endif
+typedef double ESDOUBLE;
+typedef float ESSINGLE;
+/* helpers for U_64s */
+#define CLEAR_U64(u64)  (u64 = (U_64)0)
+#define LOW_LONG(l) (*((U_32 *) &(l)))
+#define HIGH_LONG(l)  (*(((U_32 *) &(l)) + 1))
+#define I8(x)       ((I_8) (x))
+#define I8P(x)      ((I_8 *) (x))
+#define U16(x)      ((U_16) (x))
+#define I16(x)      ((I_16) (x))
+#define I16P(x)     ((I_16 *) (x))
+#define U32(x)      ((U_32) (x))
+#define I32(x)      ((I_32) (x))
+#define I32P(x)     ((I_32 *) (x))
+#define U16P(x)     ((U_16 *) (x))
+#define U32P(x)     ((U_32 *) (x))
+#define OBJP(x)     ((HyObject *) (x))
+#define OBJPP(x)    ((HyObject **) (x))
+#define OBJPPP(x)   ((HyObject ***) (x))
+#define CLASSP(x)   ((Class *) (x))
+#define CLASSPP(x)  ((Class **) (x))
+#define BYTEP(x)    ((BYTE *) (x))
+/* Test - was conflicting with OS2.h */
+#define ESCHAR(x)   ((CHARACTER) (x))
+#define FLT(x)      ((FLOAT) x)
+#define FLTP(x)     ((FLOAT *) (x))
+#if defined(NO_LVALUE_CASTING)
+#define LI8(x)      (*((I_8 *) &(x)))
+#define LI8P(x)     (*((I_8 **) &(x)))
+#define LU16(x)     (*((U_16 *) &(x)))
+#define LI16(x)     (*((I_16 *) &(x)))
+#define LU32(x)     (*((U_32 *) &(x)))
+#define LI32(x)     (*((I_32 *) &(x)))
+#define LI32P(x)    (*((I_32 **) &(x)))
+#define LU16P(x)    (*((U_16 **) &(x)))
+#define LU32P(x)    (*((U_32 **) &(x)))
+#define LOBJP(x)    (*((HyObject **) &(x)))
+#define LOBJPP(x)   (*((HyObject ***) &(x)))
+#define LOBJPPP(x)  (*((HyObject ****) &(x))
+#define LCLASSP(x)  (*((Class **) &(x)))
+#define LBYTEP(x)   (*((BYTE **) &(x)))
+#define LCHAR(x)    (*((CHARACTER) &(x)))
+#define LFLT(x)     (*((FLOAT) &x))
+#define LFLTP(x)    (*((FLOAT *) &(x)))
+#else
+#define LI8(x)      I8((x))
+#define LI8P(x)     I8P((x))
+#define LU16(x)     U16((x))
+#define LI16(x)     I16((x))
+#define LU32(x)     U32((x))
+#define LI32(x)     I32((x))
+#define LI32P(x)    I32P((x))
+#define LU16P(x)    U16P((x))
+#define LU32P(x)    U32P((x))
+#define LOBJP(x)    OBJP((x))
+#define LOBJPP(x)   OBJPP((x))
+#define LOBJPPP(x)  OBJPPP((x))
+#define LIOBJP(x)   IOBJP((x))
+#define LCLASSP(x)  CLASSP((x))
+#define LBYTEP(x)   BYTEP((x))
+#define LCHAR(x)    CHAR((x))
+#define LFLT(x)     FLT((x))
+#define LFLTP(x)    FLTP((x))
+#endif
+/* Macros for converting between words and longs and accessing bits */
+#define HIGH_WORD(x)  U16(U32((x)) >> 16)
+#define LOW_WORD(x)   U16(U32((x)) & 0xFFFF)
+#define LOW_BIT(o)    (U32((o)) & 1)
+#define LOW_2_BITS(o) (U32((o)) & 3)
+#define LOW_3_BITS(o) (U32((o)) & 7)
+#define LOW_4_BITS(o) (U32((o)) & 15)
+#define MAKE_32(h, l) ((U32((h)) << 16) | U32((l)))
+#define MAKE_64(h, l) ((((I_64)(h)) << 32) | (l))
+#if defined(__cplusplus)
+#define HY_CFUNC "C"
+#define HY_CDATA "C"
+#else
+#define HY_CFUNC
+#define HY_CDATA
+#endif
+/* Macros for tagging functions which read/write the vm thread */
+#define READSVMTHREAD
+#define WRITESVMTHREAD
+#define REQUIRESSTACKFRAME
+/* macro for tagging functions which never return */
+#if defined(__GNUC__)
+/* on GCC, we can actually pass this information on to the compiler */
+#define NORETURN __attribute__((noreturn))
+#else
+#define NORETURN
+#endif
+/* on some systems va_list is an array type.  This is probably in
+ * violation of the ANSI C spec, but it's not entirely clear.  Because of this, we end
+ * up with an undesired extra level of indirection if we take the address of a
+ * va_list argument. 
+ *
+ * To get it right ,always use the VA_PTR macro
+ */
+#if !defined(VA_PTR)
+#define VA_PTR(valist) (&valist)
+#endif
+#if !defined(TOC_UNWRAP_ADDRESS)
+#define TOC_UNWRAP_ADDRESS(wrappedPointer) (wrappedPointer)
+#endif
+
+#if !defined(TOC_STORE_TOC)
+#define TOC_STORE_TOC(dest,wrappedPointer)
+#endif
+/* Macros for accessing I_64 values */
+#if defined(ATOMIC_LONG_ACCESS)
+#define PTR_LONG_STORE(dstPtr, aLongPtr) ((*U32P(dstPtr) = *U32P(aLongPtr)), (*(U32P(dstPtr)+1) = *(U32P(aLongPtr)+1)))
+#define PTR_LONG_VALUE(dstPtr, aLongPtr) ((*U32P(aLongPtr) = *U32P(dstPtr)), (*(U32P(aLongPtr)+1) = *(U32P(dstPtr)+1)))
+#else
+#define PTR_LONG_STORE(dstPtr, aLongPtr) (*(dstPtr) = *(aLongPtr))
+#define PTR_LONG_VALUE(dstPtr, aLongPtr) (*(aLongPtr) = *(dstPtr))
+#endif
+/* Macro used when declaring tables which require relocations.*/
+#if !defined(HYCONST_TABLE)
+#define HYCONST_TABLE const
+#endif
+/* ANSI qsort is not always available */
+#if !defined(HY_SORT)
+#define HY_SORT(base, nmemb, size, compare) qsort((base), (nmemb), (size), (compare))
+#endif
+
+#endif /* hycomp_h */

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hycomp.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread.h?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread.h Wed Aug 23 09:48:41 2006
@@ -0,0 +1,291 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(HYTHREAD_H)
+#define HYTHREAD_H
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#include <stddef.h>
+#include "hycomp.h"
+
+typedef UDATA hythread_tls_key_t;
+
+#define HYTHREAD_PROC VMCALL
+
+typedef int(HYTHREAD_PROC* hythread_entrypoint_t)(void*);
+typedef void(HYTHREAD_PROC* hythread_tls_finalizer_t)(void*);
+typedef struct HyThread *hythread_t;
+typedef struct HyThreadMonitor *hythread_monitor_t;
+typedef struct HySemaphore *hysem_t;
+
+struct HyPortLibrary;
+
+#define HYTHREAD_PRIORITY_MIN  0
+#define HYTHREAD_PRIORITY_USER_MIN  1
+#define HYTHREAD_PRIORITY_NORMAL  5
+#define HYTHREAD_PRIORITY_USER_MAX  10
+
+#define HYTHREAD_PRIORITY_MAX  11
+
+#define HYTHREAD_LOCKING_DEFAULT    0 /* default locking policy for platform */ 
+#define HYTHREAD_LOCKING_NO_DATA    (-1)    /* if no policy data is provided */
+#define HYTHREAD_FLAG_BLOCKED  1
+#define HYTHREAD_ALREADY_INITIALIZED  4
+#define HYTHREAD_TIMED_OUT  3
+#define HYTHREAD_FLAG_STARTED  0x800
+#define HYTHREAD_FLAG_JLM_HAS_BEEN_ENABLED  0x20000
+#define HYTHREAD_ILLEGAL_MONITOR_STATE  1
+#define HYTHREAD_FLAG_PRIORITY_INTERRUPTED  0x100
+#define HYTHREAD_FLAG_JLMHST_ENABLED  0x10000
+#define HYTHREAD_FLAG_JLM_ENABLED  0x4000
+#define HYTHREAD_FLAG_INTERRUPTED  4
+#define HYTHREAD_INVALID_ARGUMENT  7
+#define HYTHREAD_FLAG_DETACHED  0x80
+#define HYTHREAD_PRIORITY_INTERRUPTED  5
+#define HYTHREAD_FLAG_CANCELED  0x400
+#define HYTHREAD_FLAG_NOTIFIED  16
+#define HYTHREAD_FLAG_ATTACHED  0x200
+#define HYTHREAD_WOULD_BLOCK  8
+#define HYTHREAD_FLAG_DEAD  32
+#define HYTHREAD_FLAG_WAITING  2
+#define HYTHREAD_FLAG_PARKED  0x40000
+#define HYTHREAD_FLAG_UNPARKED  0x80000
+#define HYTHREAD_FLAG_INTERRUPTABLE  0x2000
+#define HYTHREAD_FLAG_TIMER_SET  0x100000
+#define HYTHREAD_FLAG_JLM_ENABLED_ALL  0x1C000
+#define HYTHREAD_FLAG_JLMTS_ENABLED  0x8000
+#define HYTHREAD_INTERRUPTED  2
+#define HYTHREAD_FLAG_BLOCKED_AFTER_WAIT  0x1000
+#define HYTHREAD_ALREADY_ATTACHED  6
+#define HYTHREAD_FLAG_SUSPENDED  8
+#define HYTHREAD_FLAG_SLEEPING  64
+#define HYTHREAD_MONITOR_INFLATED  0x10000
+#define HYTHREAD_MONITOR_INTERRUPTABLE  0x20000
+#define HYTHREAD_MONITOR_PRIORITY_INTERRUPTABLE  0x40000
+#define HYTHREAD_MONITOR_SYSTEM  0
+#define HYTHREAD_MONITOR_OBJECT  0x60000
+#define HYTHREAD_MONITOR_MUTEX_UNINITIALIZED  0x80000
+#define HYTHREAD_MONITOR_SUPPRESS_CONTENDED_EXIT  0x100000
+#define HYTHREAD_MONITOR_MUTEX_IN_USE  0x200000
+#define HYTHREAD_MONITOR_SPINLOCK_UNOWNED  0
+#define HYTHREAD_MONITOR_SPINLOCK_OWNED  1
+#define HYTHREAD_MONITOR_SPINLOCK_EXCEEDED  2
+#define HYTHREAD_LIB_FLAG_JLMHST_ENABLED  0x10000
+#define HYTHREAD_LIB_FLAG_JLM_ENABLED  0x4000
+#define HYTHREAD_LIB_FLAG_JLM_ENABLED_ALL  0x1C000
+#define HYTHREAD_LIB_FLAG_JLM_HAS_BEEN_ENABLED  0x20000
+#define HYTHREAD_LIB_FLAG_JLMTS_ENABLED  0x8000
+
+typedef struct HyThreadMonitorTracing {
+    char* monitor_name;
+    UDATA enter_count;
+    UDATA slow_count;
+    UDATA recursive_count;
+    UDATA spin2_count;
+    UDATA yield_count;
+} HyThreadMonitorTracing;
+
+#define HYSIZEOF_HyThreadMonitorTracing 24
+
+extern HY_CFUNC void VMCALL
+hythread_detach PROTOTYPE((hythread_t thread));
+extern HY_CFUNC UDATA VMCALL
+hythread_lib_set_flags PROTOTYPE((UDATA flags));
+extern HY_CFUNC IDATA VMCALL 
+hythread_tls_alloc PROTOTYPE((hythread_tls_key_t* handle));
+extern HY_CFUNC IDATA VMCALL 
+hythread_sleep_interruptable PROTOTYPE((I_64 millis, IDATA nanos));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_enter_using_threadId PROTOTYPE((hythread_monitor_t monitor, hythread_t threadId));
+extern HY_CFUNC void  VMCALL 
+hythread_cancel PROTOTYPE((hythread_t thread));
+extern HY_CFUNC UDATA VMCALL
+hythread_clear_interrupted PROTOTYPE((void));
+extern HY_CFUNC void VMCALL 
+hythread_lib_unlock PROTOTYPE((hythread_t self));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_enter PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL
+hythread_monitor_notify_all PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL 
+hythread_attach PROTOTYPE((hythread_t* handle));
+extern HY_CFUNC HyThreadMonitorTracing* VMCALL 
+hythread_jlm_get_gc_lock_tracing PROTOTYPE(());
+extern HY_CFUNC UDATA VMCALL 
+hythread_priority_interrupted PROTOTYPE((hythread_t thread));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_destroy PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL 
+hysem_post PROTOTYPE((hysem_t s));
+extern HY_CFUNC UDATA VMCALL 
+hythread_monitor_num_waiting PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC UDATA VMCALL
+hythread_interrupted PROTOTYPE((hythread_t thread));
+
+extern HY_CFUNC void VMCALL 
+hythread_monitor_lock PROTOTYPE((hythread_t self, hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL 
+hythread_park PROTOTYPE((I_64 millis, IDATA nanos));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_init_with_name PROTOTYPE((hythread_monitor_t* handle, UDATA flags, char* name));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_try_enter PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC void VMCALL 
+hythread_jlm_thread_clear PROTOTYPE((hythread_t thread));
+extern HY_CFUNC hythread_t VMCALL hythread_self PROTOTYPE((void));
+extern HY_CFUNC IDATA VMCALL 
+hythread_tls_free PROTOTYPE((hythread_tls_key_t key));
+extern HY_CFUNC UDATA VMCALL
+hythread_clear_priority_interrupted PROTOTYPE((void));
+extern HY_CFUNC void VMCALL 
+hythread_jlm_thread_init PROTOTYPE((hythread_t thread));
+
+extern HY_CFUNC void VMCALL 
+hythread_jlm_gc_lock_init PROTOTYPE(());
+extern HY_CFUNC void VMCALL 
+hythread_monitor_unlock PROTOTYPE((hythread_t self, hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL 
+hysem_wait PROTOTYPE((hysem_t s));
+extern HY_CFUNC void VMCALL 
+hythread_yield PROTOTYPE((void));
+extern HY_CFUNC void VMCALL 
+hythread_suspend PROTOTYPE((void));
+extern HY_CFUNC void VMCALL 
+hythread_interrupt PROTOTYPE((hythread_t thread));
+extern HY_CFUNC IDATA VMCALL 
+hythread_tls_set PROTOTYPE((hythread_t thread, hythread_tls_key_t key, void* value));
+extern HY_CFUNC IDATA VMCALL 
+hythread_create PROTOTYPE((hythread_t* handle, UDATA stacksize, UDATA priority, UDATA suspend, hythread_entrypoint_t entrypoint, void* entryarg));
+extern HY_CFUNC IDATA VMCALL
+hysem_init PROTOTYPE((hysem_t* sp, I_32 initValue));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_wait PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_init_policy PROTOTYPE((hythread_monitor_t* handle, UDATA flags, IDATA policy, IDATA policyData));
+extern HY_CFUNC void VMCALL 
+hythread_jlm_monitor_init PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL
+hysem_destroy PROTOTYPE((hysem_t s));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_wait_interruptable PROTOTYPE((hythread_monitor_t monitor, I_64 millis, IDATA nanos));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_try_enter_using_threadId PROTOTYPE((hythread_monitor_t monitor, hythread_t threadId));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_exit PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL 
+hythread_set_priority PROTOTYPE((hythread_t thread, UDATA priority));
+extern HY_CFUNC void VMCALL 
+hythread_unpark PROTOTYPE((hythread_t thread));
+extern HY_CFUNC void VMCALL 
+hythread_lib_lock PROTOTYPE((hythread_t self));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_init PROTOTYPE((hythread_monitor_t* handle, UDATA flags));
+extern HY_CFUNC IDATA VMCALL 
+hythread_sleep PROTOTYPE((I_64 millis));
+extern HY_CFUNC UDATA* VMCALL 
+hythread_global PROTOTYPE((char* name));
+extern HY_CFUNC IDATA VMCALL 
+hythread_tls_alloc_with_finalizer PROTOTYPE((hythread_tls_key_t* handle, hythread_tls_finalizer_t finalizer));
+extern HY_CFUNC void VMCALL 
+hythread_jlm_monitor_clear PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_wait_timed PROTOTYPE((hythread_monitor_t monitor, I_64 millis, IDATA nanos));
+extern HY_CFUNC void VMCALL
+hythread_resume PROTOTYPE((hythread_t thread));
+extern HY_CFUNC UDATA VMCALL 
+hythread_lib_clear_flags PROTOTYPE((UDATA flags));
+extern HY_CFUNC void VMCALL 
+hythread_priority_interrupt PROTOTYPE((hythread_t thread));
+extern HY_CFUNC void VMCALL NORETURN 
+hythread_exit PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_exit_using_threadId PROTOTYPE((hythread_monitor_t monitor, hythread_t threadId));
+
+extern HY_CFUNC UDATA VMCALL 
+hythread_lib_get_flags PROTOTYPE(());
+extern HY_CFUNC IDATA VMCALL 
+hythread_monitor_notify PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC void VMCALL 
+hythread_enable_stack_usage PROTOTYPE((UDATA enable));
+
+extern HY_CFUNC UDATA VMCALL 
+hythread_get_handle PROTOTYPE((hythread_t thread));
+
+extern HY_CFUNC UDATA VMCALL 
+hythread_get_stack_usage PROTOTYPE((hythread_t thread));
+
+extern HY_CFUNC I_64 VMCALL 
+hythread_get_cpu_time PROTOTYPE((hythread_t thread));
+
+extern HY_CFUNC UDATA VMCALL 
+hythread_get_stack_size PROTOTYPE((hythread_t thread));
+extern HY_CFUNC I_64 VMCALL 
+hythread_get_user_time PROTOTYPE((hythread_t thread));
+extern HY_CFUNC IDATA VMCALL hythread_get_os_priority PROTOTYPE((hythread_t thread, IDATA* policy, IDATA *priority));
+extern HY_CFUNC UDATA VMCALL 
+hythread_get_flags PROTOTYPE((hythread_t thread, hythread_monitor_t* blocker));
+extern HY_CFUNC HyThreadMonitorTracing* VMCALL 
+hythread_monitor_get_tracing PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC UDATA VMCALL 
+hythread_get_priority PROTOTYPE((hythread_t thread));
+extern HY_CFUNC void* VMCALL
+hythread_tls_get PROTOTYPE((hythread_t thread, hythread_tls_key_t key));
+extern HY_CFUNC char* VMCALL 
+hythread_monitor_get_name PROTOTYPE((hythread_monitor_t monitor));
+extern HY_CFUNC hythread_monitor_t VMCALL 
+hythread_monitor_walk PROTOTYPE((hythread_monitor_t monitor));
+struct RWMutex;
+typedef struct RWMutex* hythread_rwmutex_t;
+extern HY_CFUNC IDATA VMCALL
+hythread_rwmutex_enter_read PROTOTYPE((hythread_rwmutex_t mutex));
+extern HY_CFUNC IDATA VMCALL
+hythread_rwmutex_destroy PROTOTYPE((hythread_rwmutex_t mutex));
+extern HY_CFUNC IDATA VMCALL
+hythread_rwmutex_exit_read PROTOTYPE((hythread_rwmutex_t mutex));
+extern HY_CFUNC IDATA VMCALL
+hythread_rwmutex_exit_write PROTOTYPE((hythread_rwmutex_t mutex));
+extern HY_CFUNC IDATA VMCALL
+hythread_rwmutex_init PROTOTYPE((hythread_rwmutex_t* handle, UDATA flags, const char* name));
+extern HY_CFUNC IDATA VMCALL
+hythread_rwmutex_enter_write PROTOTYPE((hythread_rwmutex_t mutex));
+
+/* HyVMThreadHelpers*/
+#if !defined(_HYVMTHREADHELPERS_)
+#define _HYVMTHREADHELPERS_
+extern HY_CFUNC UDATA  VMCALL current_stack_depth ();
+extern HY_CFUNC void  VMCALL hythread_monitor_unpin ( hythread_monitor_t monitor, hythread_t osThread);
+extern HY_CFUNC void  VMCALL hythread_monitor_pin ( hythread_monitor_t monitor, hythread_t osThread);
+#endif /* _HYVMTHREADHELPERS_ */
+
+/* HyVMThreadSpinlocks*/
+#if !defined(_HYVMTHREADSPINLOCKS_)
+#define _HYVMTHREADSPINLOCKS_
+extern HY_CFUNC IDATA  VMCALL hythread_spinlock_acquire (hythread_t self, hythread_monitor_t monitor);
+extern HY_CFUNC UDATA  VMCALL hythread_spinlock_swapState (hythread_monitor_t monitor, UDATA newState);
+#endif /* _HYVMTHREADSPINLOCKS_ */
+
+#define hythread_global_monitor() (*(hythread_monitor_t*)hythread_global("global_monitor"))
+#define hythread_monitor_init(pMon,flags)  hythread_monitor_init_with_name(pMon,flags, #pMon)
+#define hythread_monitor_set_name(pMon,pName)
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* HYTHREAD_H */
+

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h Wed Aug 23 09:48:41 2006
@@ -0,0 +1,361 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * @brief Extended Treading and synchronization support
+ * @details
+ * Thread Manager native interface. Provides basic capablitites for managing native threads in the system.
+ *
+ * <p>
+ * <h2>Overview</h2>
+ * The Thread Manager (TM) component provides various threading functionality for VM and class libraries code.
+ * provides support for threading inside the virtual machine and for class libraries. 
+ * The implementation of thread management uses the black-box approach exposing two interfaces: Java and native. 
+ * The whole component is divided into two layers: the middle layer of native threading with the layer of 
+ * Java threading on top. The implementation of Thread manager is based solely on the Apache Portable Runtime (APR) layer. 
+ * <p>
+ * The top layer provides the following functionality (see jthread, thread_ti.h): 
+ * <ul>
+ * <li> Maps Java threads onto OS native threads
+ * <li> Support kernel classes support 
+ * <li> Support JVMTI
+ * </ul>
+ * The middle layer does the following (see hythread.h, hythread_ext.h): 
+ * <li> Provides API for native threading
+ * <li> Wrapping 223shield224 on top of porting layer
+ * <li> Provides support for safe suspension and interrupt
+ * <li> Additional functionality that missed in porting layer
+ * <p> 
+ * 
+ * <h2>Interaction</h2>
+ * The following components are primary customers of the Thread Manager:
+ * <ul>
+ * <li> Kernel classes 
+ * <li> Garbage collector
+ * <li> java.util.concurrent classes
+ * <li> java.lang.management classes
+ * <li> JVMTI
+ * </ul>
+ * These components interact with different parts of thread management: some work with Java threads and objects, 
+ * while others interact with the middle layer of native threading. Whenever the component operates with Java 
+ * objects and threads, it would call the top (Java) interface functions. Otherwise, it would call the middle (native) 
+ * interface functions.
+ * <h2>Safe suspension</h2>
+ * One of the key features of thread management in the VM is the safe suspension functionality. 
+ * The purpose of the safe suspension mechanism is mostly to ensure that:
+ * <ul>
+ * <li> Suspended thread can be safely explored by the Garbage Collector while enumerating live references;
+ * <li> Suspended thread is guaranteed to do not hold any system-critical locks which can be requested by the other parts of VM, 
+ * such as the locks associated with the native memory heap.
+ * </ul>
+ * At every time moment, thread can be in one of three possible states:
+ * <ul>
+ * <li> Safe region. A period of time during thread execution when the thread can be safely suspended. This would typically be a region of a
+ native C code where java objects and stack are not changed. An example is native file I/O call which reads a big amount of data from disk.
+ * <li> Unsafe region. A period of time during thread execution when the code is in process of changing java objects or impacts java stack, 
+such as parts of the JITT-ed java code or JNI function calls. Suspending a thread in that region would typically be unsafe.
+ * <li> Safe point. A single point during the thread execution time when the thread can safely suspended. For example, JIT may want to injec
+t the safe points in the Java code between the selected chunks of the assembly code, those size is determined in terms of performance balanc
+e between safe point function call overhead and suspension time overhead.
+ * </ul>
+ * Each thread managed by TM has the following fields:
+ * <ul>
+ * <li>    safe_region 226 boolean flag which reports whether suspend is safe at this moment or not.
+ * <li>    suspend_request 226 integer indicating how many requests for suspension were made for this thread
+ * <li>    safe_region_event 226 event indicating that thread has reached safe region
+ * <li>    resume_event 226 event indicating that thread needs to be awakened
+ * </ul>
+ * The suspension algorithm typically invokes two threads 226 223suspender224 thread and 223suspendee224 thread.
+ * A typical example is than "suspender" is GC thread, and the "suspendee" is Java thread. 
+ * The safe thread suspension algorithm works as follows:
+ * <pre>
+ *   1.  GC thread invokes thread_supend() method of a thread manager which does the following:
+ *       a.  If  Java thread was already requested to suspend, increase the suspend_request count and return;
+ *       b.  Increase suspend_request for Java thread;
+ *       c.  If Java thread is currently in unsafe region, wait while it reaches the safe region.
+ *   2.  GC thread, after completing the enumeration-related activities, calls the resume_thread() method which does the following:
+ *       a.  If suspend_request was previously set, decrease the number of suspend requests;
+ *       b.  If the number of suspend requests reaches zero, notifies the Java thread that it can wake up now.
+ *   3.  A Java thread may reach safe point, which is denoted by calling the safe_point() method in the Java thread. 
+ *       The safe_point() method does the following:
+ *       a.  If there was request for suspension then: 
+ *           i.  notify GC thread that it can proceed with enumeration activities
+ *           ii. wait for the resume notification to come from the GC thread
+ *   4.  A Java thread may enter the safe region, which is denoted by calling the suspend_enable() method in the Java thread. 
+ *       The suspend_enable() method does the following:
+ *       a.  Sets the flag safe_region to true;
+ *       b.  If there was a request for suspension, notifies the GC thread that Java thread has reached safe region so GC may 
+ *           proceed with enumeration activities
+ *   5.  A Java thread may leave the safe region, which is denoted by calling the suspend_disable() method in the Java thread. 
+ *       The suspend_disable() method does the following:
+ *       a.  Sets the flag safe_region to false;
+ *       b.  Calls the safe_point() method.
+ * </pre>
+ *
+ * For more detailes see thread manager component documentation located at vm/thread/doc/ThreadManager.htm
+ *
+ */
+
+#if !defined(HYTHREAD_EXT_H)
+#define HYTHREAD_EXT_H
+
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#include "hythread.h"
+
+//@{
+/**
+ * Opaque structures
+ */
+//@{
+
+typedef struct HyMutex *hymutex_t;
+typedef struct HyCond  *hycond_t;
+typedef struct HyLatch *hylatch_t;
+typedef struct HyThreadGroup *hythread_group_t;
+typedef struct HyThread *hythread_iterator_t;
+typedef struct HyThreadLibrary *hythread_library_t;
+
+typedef IDATA  hythread_thin_monitor_t;
+
+typedef void (*hythread_event_callback_proc)(void);
+
+//@}
+/** @name Thread Manager initialization / shutdown
+ */
+//@{
+//temporary, should be static for the file containing dinamic library 
+//initialization
+////
+
+IDATA VMCALL hythread_global_lock();
+IDATA VMCALL hythread_global_unlock();
+void VMCALL hythread_init (hythread_library_t lib);
+IDATA VMCALL hythread_shutdown();
+IDATA VMCALL hythread_wait_for_all_nondaemon_threads();
+UDATA* VMCALL hythread_global (char* name);
+
+//@}
+/** @name  Basic manipulation 
+ */
+//@{
+
+IDATA VMCALL hythread_attach_to_group(hythread_t *handle, hythread_group_t group);
+ IDATA hythread_create_with_group(hythread_t *ret_thread, hythread_group_t group, UDATA stacksize, UDATA priority, UDATA suspend, hythread_entrypoint_t func, void *data);
+UDATA VMCALL hythread_clear_interrupted_other(hythread_t thread);
+IDATA VMCALL hythread_join(hythread_t t);
+IDATA VMCALL hythread_join_timed(hythread_t t, I_64 millis, IDATA nanos);
+IDATA VMCALL hythread_join_interruptable(hythread_t t, I_64 millis, IDATA nanos);
+IDATA VMCALL hythread_get_self_id();
+IDATA VMCALL hythread_get_id(hythread_t t);
+hythread_t VMCALL hythread_get_thread(IDATA id);
+IDATA VMCALL hythread_struct_init(hythread_t *ret_thread, hythread_group_t group);
+IDATA VMCALL hythread_cancel_all(hythread_group_t group);
+IDATA VMCALL hythread_wait_for_all_nondaemon_threads();
+ IDATA hythread_group_create(hythread_group_t *group);
+IDATA VMCALL hythread_group_release(hythread_group_t group);
+IDATA VMCALL hythread_group_get_list(hythread_group_t **list, int* size);
+void* VMCALL hythread_get_private_data(hythread_t  t);
+IDATA VMCALL hythread_set_private_data(hythread_t  t, void* data);
+
+//@}
+/** @name Conditional variable
+ */
+//@{
+
+IDATA VMCALL hycond_create (hycond_t *cond);
+IDATA VMCALL hycond_wait (hycond_t cond, hymutex_t mutex);
+IDATA VMCALL hycond_wait_timed (hycond_t cond, hymutex_t mutex, I_64 millis, IDATA nanos);
+IDATA VMCALL hycond_wait_interruptable (hycond_t cond, hymutex_t mutex, I_64 millis, IDATA nanos);
+IDATA VMCALL hycond_notify (hycond_t cond);
+IDATA VMCALL hycond_notify_all (hycond_t cond);
+IDATA VMCALL hycond_destroy (hycond_t cond);
+
+//@}
+/** @name Safe suspension support
+ */
+//@{
+
+ IDATA hythread_is_suspend_enabled();
+ void hythread_suspend_enable();
+ void hythread_suspend_disable();
+ void hythread_safe_point();
+void VMCALL hythread_suspend_other(hythread_t thread);
+
+IDATA VMCALL hythread_set_safepoint_callback(hythread_t thread, hythread_event_callback_proc callback);
+hythread_event_callback_proc VMCALL hythread_get_safepoint_callback(hythread_t t);
+IDATA VMCALL hythread_suspend_all(hythread_iterator_t *t, hythread_group_t group);
+IDATA VMCALL hythread_resume_all(hythread_group_t  group);
+
+//@}
+/** @name Latch
+ */
+//@{
+
+IDATA VMCALL hylatch_create(hylatch_t *latch, IDATA count);
+IDATA VMCALL hylatch_wait(hylatch_t latch);
+IDATA VMCALL hylatch_wait_timed(hylatch_t latch, I_64 ms, IDATA nano);
+IDATA VMCALL hylatch_wait_interruptable(hylatch_t latch, I_64 ms, IDATA nano);
+IDATA VMCALL hylatch_set(hylatch_t latch, IDATA count);
+IDATA VMCALL hylatch_count_down(hylatch_t latch);
+IDATA VMCALL hylatch_get_count(IDATA *count, hylatch_t latch);
+IDATA VMCALL hylatch_destroy(hylatch_t latch);
+
+//@}
+/** @name Thread iterator support
+ */
+//@{
+
+hythread_iterator_t VMCALL hythread_iterator_create(hythread_group_t group);
+IDATA VMCALL hythread_iterator_release(hythread_iterator_t *it);
+IDATA VMCALL hythread_iterator_reset(hythread_iterator_t *it);
+hythread_t VMCALL hythread_iterator_next(hythread_iterator_t *it);
+IDATA VMCALL hythread_iterator_has_next(hythread_iterator_t it);
+IDATA VMCALL hythread_iterator_size(hythread_iterator_t iterator);
+
+//@}
+/** @name Semaphore
+ */
+//@{
+
+ IDATA hysem_create(hysem_t *sem, UDATA initial_count, UDATA max_count);
+IDATA VMCALL hysem_wait(hysem_t sem);
+IDATA VMCALL hysem_wait_timed(hysem_t sem, I_64 ms, IDATA nano);
+IDATA VMCALL hysem_wait_interruptable(hysem_t sem, I_64 ms, IDATA nano);
+IDATA VMCALL hysem_getvalue(IDATA *count, hysem_t sem);
+ IDATA hysem_set(hysem_t sem, IDATA count);
+IDATA VMCALL hysem_post(hysem_t sem);
+IDATA VMCALL hysem_destroy(hysem_t sem);
+
+//@}
+/** @name Mutex
+ */
+//@{
+
+ IDATA hymutex_create (hymutex_t *mutex, UDATA flags);
+ IDATA hymutex_lock(hymutex_t mutex);
+ IDATA hymutex_trylock (hymutex_t mutex);
+ IDATA hymutex_unlock (hymutex_t mutex);
+ IDATA hymutex_destroy (hymutex_t mutex);
+
+//@}
+/** @name Thin monitors support
+ */
+//@{
+
+IDATA VMCALL hythread_thin_monitor_create(hythread_thin_monitor_t *lockword);
+IDATA VMCALL hythread_thin_monitor_enter(hythread_thin_monitor_t *lockword);
+IDATA VMCALL hythread_thin_monitor_try_enter(hythread_thin_monitor_t *lockword);
+IDATA VMCALL hythread_thin_monitor_exit(hythread_thin_monitor_t *lockword);
+IDATA VMCALL hythread_thin_monitor_wait(hythread_thin_monitor_t *lockword);
+IDATA VMCALL hythread_thin_monitor_wait_timed(hythread_thin_monitor_t *lockword_ptr, I_64 ms, IDATA nano);
+IDATA VMCALL hythread_thin_monitor_wait_interruptable(hythread_thin_monitor_t *lockword_ptr, I_64 ms, IDATA nano);
+IDATA VMCALL hythread_thin_monitor_notify(hythread_thin_monitor_t *lockword);
+IDATA VMCALL hythread_thin_monitor_notify_all(hythread_thin_monitor_t *lockword);
+IDATA VMCALL hythread_thin_monitor_destroy(hythread_thin_monitor_t *lockword);
+hythread_t VMCALL hythread_thin_monitor_get_owner(hythread_thin_monitor_t *lockword);
+IDATA VMCALL hythread_thin_monitor_get_recursion(hythread_thin_monitor_t *lockword);
+
+//@}
+/** @name State query
+ */
+//@{
+
+int VMCALL hythread_is_alive(hythread_t thread) ;
+int VMCALL hythread_is_terminated(hythread_t thread) ;
+int VMCALL hythread_is_runnable(hythread_t thread) ;
+int VMCALL hythread_is_blocked_on_monitor_enter(hythread_t thread) ;
+int VMCALL hythread_is_waiting(hythread_t thread) ;
+int VMCALL hythread_is_waiting_indefinitely(hythread_t thread) ;
+int VMCALL hythread_is_waiting_with_timeout(hythread_t thread) ;
+int VMCALL hythread_is_sleeping(hythread_t thread) ;
+int VMCALL hythread_is_in_monitor_wait(hythread_t thread) ;
+int VMCALL hythread_is_parked(hythread_t thread) ;
+int VMCALL hythread_is_suspended(hythread_t thread) ;
+
+/**
+ * Returns non-zero if thread is interrupted.
+ *
+ * @param[in] thread those attribute is read
+ */
+int VMCALL hythread_is_interrupted(hythread_t thread) ;
+int VMCALL hythread_is_in_native(hythread_t thread) ;
+
+
+/**
+ * //@}
+ * TM Thread states constants. They are compatible with JVMTI.
+ * //@{
+ */
+#define TM_THREAD_STATE_ALIVE JVMTI_THREAD_STATE_ALIVE  // 0x0001 Thread is alive. Zero if thread is new (not started) or terminated.  
+#define TM_THREAD_STATE_TERMINATED JVMTI_THREAD_STATE_TERMINATED // 0x0002Thread has completed execution.  
+#define TM_THREAD_STATE_RUNNABLE JVMTI_THREAD_STATE_RUNNABLE // 0x0004 Thread is runnable.  
+#define TM_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER // 0x0400  Thread is waiting to enter a synchronization block/method or, after an Object.wait(), waiting to re-enter a synchronization block/method.  
+#define TM_THREAD_STATE_WAITING JVMTI_THREAD_STATE_WAITING // 0x0080  Thread is waiting.  
+#define TM_THREAD_STATE_WAITING_INDEFINITELY JVMTI_THREAD_STATE_WAITING_INDEFINITELY // 0x0010  Thread is waiting without a timeout. For example, Object.wait().  
+#define TM_THREAD_STATE_WAITING_WITH_TIMEOUT JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT // 0x0020  Thread is waiting with a maximum time to wait specified. For example, Object.wait(long).  
+#define TM_THREAD_STATE_SLEEPING JVMTI_THREAD_STATE_SLEEPING // 0x0040  Thread is sleeping -- Thread.sleep(long).  
+#define TM_THREAD_STATE_IN_MONITOR_WAIT JVMTI_THREAD_STATE_IN_OBJECT_WAIT // 0x0100  Thread is waiting on an object monitor -- Object.wait.  
+#define TM_THREAD_STATE_PARKED JVMTI_THREAD_STATE_PARKED // 0x0200  Thread is parked, for example: LockSupport.park, LockSupport.parkUtil and LockSupport.parkNanos.  
+#define TM_THREAD_STATE_SUSPENDED JVMTI_THREAD_STATE_SUSPENDED // 0x100000  Thread suspended. java.lang.Thread.suspend() or a JVMTI suspend function (such as SuspendThread) has been called on the thread. If this bit is set, the other bits refer to the thread state before suspension.  
+#define TM_THREAD_STATE_INTERRUPTED JVMTI_THREAD_STATE_INTERRUPTED // 0x200000  Thread has been interrupted.  
+#define TM_THREAD_STATE_IN_NATIVE JVMTI_THREAD_STATE_IN_NATIVE // 0x400000  Thread is in native code--that is, a native method is running which has not called back into the VM or Java programming language code. 
+
+#define TM_THREAD_STATE_ALLOCATED JVMTI_THREAD_STATE_VENDOR_1 // 0x10000000 Thread just has been allocated.
+#define TM_THREAD_STATE_RESERVED1 JVMTI_THREAD_STATE_VENDOR_2 // 0x20000000 Defined by VM vendor.  
+#define TM_THREAD_STATE_RESERVED2 JVMTI_THREAD_STATE_VENDOR_3 // 0x40000000 Defined by VM vendor 
+
+
+#define TM_MUTEX_DEFAULT  0   
+#define TM_MUTEX_NESTED   1  
+#define TM_MUTEX_UNNESTED 2 
+
+#define WAIT_INTERRUPTABLE    1
+#define WAIT_NONINTERRUPTABLE 0
+
+/**
+ * TM functions error codes (they are mostly coming from APR).
+ */
+#define TM_ERROR_NONE (0)  // No error has occurred. This is the error code that is returned on successful completion of the function. 
+#define TM_ERROR_INVALID_MONITOR (50) // Monitor pointer provided to the function id invalid
+#define TM_ERROR_NOT_MONITOR_OWNER (51) // Thread is not owner of the monitor
+#define TM_ERROR_INTERRUPT (52) // The call has been interrupted before completion. 
+#define TM_ERROR_NULL_POINTER (100)  // Pointer is unexpectedly NULL. 
+#define TM_ERROR_OUT_OF_MEMORY (110) // The function attempted to allocate memory and no more memory was available for allocation. 
+#define TM_ERROR_ACCESS_DENIED (111) // The desired functionality has not been enabled in this virtual machine. 
+#define TM_ERROR_WRONG_PHASE (112)  // The desired functionality is not available in the current phase. Always returned if the virtual machine has completed running. 
+#define TM_ERROR_INTERNAL (113) // An unexpected internal error has occurred. 
+#define TM_ERROR_UNATTACHED_THREAD (115) // The thread being used to call this function is not attached to the virtual machine. Calls must be made from attached threads. See AttachCurrentThread in the JNI invocation API. 
+#define TM_ERROR_INVALID_ENVIRONMENT (116) // The JVMTI environment provided is no longer connected or is not an environment. 
+#define TM_ERROR_MAX_THREADS (117) //Max number of threads exceeded
+#define TM_ERROR_ILLEGAL_STATE (51) //incorrect syncronizer state For example monitor wait without lock.
+#define TM_ERROR_RUNNING_THREADS (119) //error relesing group/destroying library if there are running threads
+#define TM_ERROR_EBUSY  APR_EBUSY // returned by try_lock 
+#define TM_ERROR_TIMEOUT  APR_TIMEUP  // returned by try_lock 
+
+#define TM_ERROR_START 1000
+
+// possible values for tm_status_t
+#define TM_OS_ERROR (TM_ERROR_START+1)
+    
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* HYTHREAD_EXT_H */

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/jthread.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/jthread.h?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/jthread.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/jthread.h Wed Aug 23 09:48:41 2006
@@ -0,0 +1,213 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/**
+ * @author Andrey Chernyshev
+ * @version $Revision$
+ */
+
+#ifndef _OPEN_THREAD_GENERIC_H
+#define _OPEN_THREAD_GENERIC_H
+
+/**
+ * @file jthread_.h
+ * @brief Java threading interface
+ * @details
+ * Java threading interface - contains functions to work with Java threads. 
+ * The generic part od Java thrading interface is mostly targeted to address 
+ * the needs of java.lang.Object and java.lang.Thread classes implementations.
+ * All functions in this interface start with jthread_* prefix.
+ * The implemnentation of this layer provides the mapping of Java thrads onto native/OS threads.
+ * 
+ * For more detailes see thread manager component documentation located at vm/thread/doc/ThreadManager.htm
+ * 
+ */
+
+#include "open/types.h"
+#include "open/hythread_ext.h"
+#include <jni.h>
+#include <jvmti.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/** @name Basic manipulation
+ */
+//@{
+
+typedef struct JVMTIThread *jvmti_thread_t;
+
+/**
+ * Java thread creation attributes.
+ */
+typedef struct {
+  
+   /**
+    * Thread scheduling priority.
+    */  
+    jint priority;
+
+   /**
+    * Thread stack size.
+    */  
+    jint stacksize;
+
+   /**
+    * Denotes whether Java thread is daemon.  
+    * JVM exits when the only threads running are daemon threads.
+    */  
+    jboolean daemon;
+
+   /**
+    * JVM TI Environment.
+    */  
+    jvmtiEnv * jvmti_env;
+
+} jthread_threadattr_t;
+
+jlong jthread_thread_init(jvmti_thread_t *ret_thread, JNIEnv* env, jthread java_thread, jobject weak_ref, jlong old_thread);
+ IDATA jthread_create(JNIEnv *env, jthread thread, jthread_threadattr_t *attrs);
+ IDATA jthread_create_with_function(JNIEnv *env, jthread thread, jthread_threadattr_t *attrs, jvmtiStartFunction proc, const void* arg);
+ IDATA jthread_attach(JNIEnv* env, jthread thread);
+ IDATA jthread_detach(jthread thread);
+IDATA jthread_join(jthread thread);
+IDATA jthread_timed_join(jthread thread, jlong millis, jint nanos);
+IDATA jthread_yield();
+IDATA jthread_stop(jthread thread);
+IDATA jthread_exception_stop(jthread thread, jobject throwable);
+IDATA jthread_sleep(jlong millis, jint nanos);
+JNIEnv *jthread_get_JNI_env(jthread thread);
+
+
+
+//@}
+/** @name Identification
+ */
+//@{
+
+jthread jthread_self(void);
+jlong jthread_get_id(jthread thread);
+jthread jthread_get_thread(jlong thread_id);
+
+
+
+//@}
+/** @name Top&lt;-&gt;middle pointer conversion
+ */
+//@{
+
+
+hythread_t  jthread_get_native_thread(jthread thread);
+jthread jthread_get_java_thread(hythread_t thread);
+
+
+//@}
+/** @name Attributes access
+ */
+//@{
+
+
+/**
+ * Sets the daemon attribute for the <code>thread</code>.
+ *
+ * JVM exits when the only threads running are all daemon threads.
+ *
+ * @param[in] thread those attribute is set
+ * @param[in] on daemon off or on
+ * @sa java.lang.Thread.setDaemon()
+ */
+IDATA jthread_set_daemon(jthread thread, jboolean on);
+
+/**
+ * Returns true if the <code>thread</code>is daemon.
+ *
+ * @param[in] thread those attribute is read
+ * @sa java.lang.Thread.isDaemon()
+ */
+jboolean jthread_is_daemon(jthread thread);
+
+IDATA jthread_set_priority(jthread thread, int priority);
+int jthread_get_priority(jthread thread);
+
+/**
+ * Sets the name for the <code>thread</code>.
+ *
+ * @param[in] thread those attribute is set
+ * @param[in] name thread name
+ * @sa java.lang.Thread.setName()
+ */
+IDATA jthread_set_name(jthread thread, jstring name);
+
+/**
+ * Returns the name for the <code>thread</code>.
+ *
+ * @param[in] thread those attribute is read
+ * @sa java.lang.Thread.getName()
+ */
+jstring jthread_get_name(jthread thread);
+
+
+//@}
+/** @name Interruption
+ */
+//@{
+
+IDATA jthread_interrupt(jthread thread);
+jboolean jthread_is_interrupted(jthread thread);
+IDATA jthread_clear_interrupted(jthread thread);
+
+
+//@}
+/** @name Monitors
+ */
+//@{
+
+ IDATA jthread_monitor_init(jobject mon);
+VMEXPORT IDATA jthread_monitor_enter(jobject mon);
+ IDATA jthread_monitor_try_enter(jobject mon);
+VMEXPORT IDATA jthread_monitor_exit(jobject mon);
+ IDATA jthread_monitor_notify(jobject mon);
+ IDATA jthread_monitor_notify_all(jobject mon);
+ IDATA jthread_monitor_wait(jobject mon);
+ IDATA jthread_monitor_timed_wait(jobject mon, jlong millis, jint nanos);
+
+//@}
+/** @name Parking
+ */
+//@{
+
+ IDATA jthread_park();
+ IDATA jthread_timed_park(jlong millis, jint nanos);
+ IDATA jthread_unpark(jthread thread);
+
+//@}
+/** @name Suspension
+ */
+//@{
+
+ IDATA jthread_suspend(jthread thread);
+ IDATA jthread_suspend_all(jvmtiError* results, jint count, const jthread* thread_list);
+ IDATA jthread_resume(jthread thread);
+ IDATA jthread_resume_all(jvmtiError* results, jint count, const jthread* thread_list);
+ IDATA jthread_cancel_all();
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _OPEN_THREAD_GENERIC_H */

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/jthread.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread.h Wed Aug 23 09:48:41 2006
@@ -1,377 +0,0 @@
-/*
- *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-/** 
- * @author Sergey Petrovsky
- * @version $Revision: 1.1.2.1.4.3 $
- */  
-#ifndef _OPEN_THREAD_H_
-#define _OPEN_THREAD_H_
-
-#include "open/types.h"
-#include "jvmti_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file thread_generic.h
- * 
- * This module describes VM interfaces to work with Java threads.
- * 
- */
-
-//---------------------- Object -------------------------------------
-
-/**
- * Just one thread from the set of threads 
- * waiting on the <code>object</code> object's monitor is waked up.
- *
- * Nothing happens if the set is empty.
- *
- * @param object
- */
-void thread_object_notify(jobject object); 
-
-/**
- * Each thread from the set of threads waiting on the 
- * <code>object</code> object's monitor is waked up.
- *
- * Nothing happens if the set is empty.
- *
- * @param object
- */
-void thread_object_notify_all(jobject object); 
-
-/**
- * Current thread gets waiting on the <code>object</code> object's monitor.
- * 
- * The thread <code>object</code> waiting on <code>object</code>
- * object's monitor is waked up if:
- * <UL>
- * <LI>another thread invokes <code>thread_notify(object)</code> 
- * and VM chooses this thread to wake up;
- * <LI>another thread invokes <code>thread_notifyAll(object);</code>
- * <LI>another thread invokes <code>thread_interrupt(thread);</code> 
- * <LI>real time elapsed from the wating begin is 
- * greater or equal the time specified. 
- * </UL>
- *
- * @param object
- * @param millis
- */
-void thread_object_wait (jobject object, int64 millis);
-
-/**
- * Current thread gets waiting on the <code>object</code> object's monitor.
- * 
- * The thread <code>object</code> waiting on <code>object</code>
- * object's monitor is waked up if:
- * <UL>
- * <LI>another thread invokes <code>thread_notify(object)</code> 
- * and VM chooses this thread to wake up;
- * <LI>another thread invokes <code>thread_notifyAll(object);</code>
- * <LI>another thread invokes <code>thread_interrupt(thread);</code> 
- * <LI>real time elapsed from the wating begin is 
- * greater or equal the time specified. 
- * </UL>
- *
- * @param object
- * @param millis
- * @param nanos
- */
-void thread_object_wait_nanos (jobject object, int64 millis, int nanos);
-
-//---------------------- Thread -------------------------------------
-/**
- * Returns the monitor the thread <code>thread</code> is contended for. 
- *
- * Returns <code>NULL</code> if there's no such monitor.
- *
- * @param thread
- * @return monitor the thread <code>thread</code> is contended for.
- */
-jobject thread_contends_for_lock(jobject thread); 
-
-/**
- * Returns current thread.
- */
-jobject thread_current_thread();
-
-/**
- * Safe point.
- */
-VMEXPORT void tmn_safe_point();
-
-/**
- * Disables suspend for the current thread.
- */
-VMEXPORT void tmn_suspend_disable();
-
-/**
- * Disables suspend for the current thread and increments the recursion counter.
- */
-void tmn_suspend_disable_recursive();
-
-/**
- * Checks if suspend enabled, if so calls thread_disable suspend and returns true;
- * otherwise returns false.
- */
-//VMEXPORT bool tmn_suspend_disable_and_return_old_value();
-
-/**
- * Notify that it's safe to suspend thread.
- * 
- * After a call of this function and till <code>thread_disable_suspend()</code>
- * is called any call of <code>thread_is_suspend_enabled()</code> 
- * returns <code>true</code>.
- */
-VMEXPORT void tmn_suspend_enable();
-
-/**
- * Decrements a recursion counter. 
- * 
- * If the counter value becomes zero, 
- * after a call of this function and till <code>thread_disable_suspend()</code>
- * is called any call of <code>thread_is_suspend_enabled()</code> 
- * returns <code>true</code>.
- */
-void tmn_suspend_enable_recursive();
-
-/**
- * Returns <code>true</code> if it's safe to suspend the thread <code>thread</code>.
- *
- * Otherwise returns <code>false</code>. 
- *
- * @return <code>true</code> if it's safe to suspend the thread <code>thread</code>;
- * <code>false</code> otherwise.
- */
-VMEXPORT bool tmn_is_suspend_enabled();
-
-/**
- * Returns a set of of all existig alive threads.
- *
- * The set is returned as an array of <code>jthread</code> pointers.
- * The value returned is the number of alive threads.
- * No array is returned if <code>threads == NULL</code>.
- *
- * @param threads
- * @return the number of alive threads.
- */
-int thread_get_all_threads(jthread** threads); 
-
-/**
- * Gets <code>thread</code> thread's local storage. 
- *
- * @param env
- * @param thread
- * @param data_ptr
- */
-int thread_get_jvmti_thread_local_storage(jvmtiEnv* env,
-                                      jthread thread, void** data_ptr);
-/**
- * Gets all monitors owned by the thread <code>thread</code>. 
- *
- * @param thread
- * @param monitors
- */
-int thread_get_owned_monitor_info(jthread thread, jobject ** monitors);
-
-/**
- * Returns the <code>thread</code> thread's state according 
- * JVM TI specification.
- *
- * @param thread
- * @return the <code>thread</code> thread's state.
- */
-int thread_get_thread_state(jthread thread); 
-
-/**
- * Returns <code>true</code> if the thread <code>thread</code> 
- * holds monitor <code>monitor</code>.
- *
- * Otherwise returns <code>false</code>.
- *
- * @param thread
- * @param monitor
- * @return <code>true</code> if the thread <code>thread</code>
- * holds monitor <code>monitor</code>; <code>false</code> otherwise.
- */
-bool thread_holds_lock(jthread thread, jobject monitor); 
-
-/**
- * Returns a set of monitors the thread <code>thread</code> holds.
- *
- * The set is returned as an array of <code>jobject</code> pointers.
- * The value returned is the number of monitors the thread holds.
- * No array is returned if <code>monitors == NULL</code>.
- *
- * @param thread
- * @param monitors
- * @return the number of monitors the thread <code>thread</code> holds.
- */
-int thread_holds_locks(jthread thread, jobject* monitors); 
-
-/**
- * Wakes up the thread <code>thread</code> or marks it as 'interrupted'. 
- *
- * If the thread <code>thread</code> is wating due to 
- * <code>thread_wait(...)</code> or <code>thread_sleep(...)</code> 
- * function call it's waked up.
- * 
- * Else <code>thread</code> thread's state is changed so that 
- * <code>thread.isInterrupted()</code> returns <code>true</code>. 
- *
- * @param thread
- */
-void thread_interrupt(jthread thread); 
-
-/**
- * Returns <code>true</code> if the thread <code>thread</code> is alive.
- *
- * Otherwise returns <code>false</code>. 
- * A thread gets alive just after it has been started 
- * and is alive till it has died. 
- *
- * @param thread
- * @return <code>true</code> if the thread <code>thread</code>
- * is alive; <code>false</code> otherwise.
- */
-bool thread_is_alive(jthread thread); 
-
-/**
- * Returns <code>true</code> if the thread <code>thread</code> is interrupted.
- *
- * Otherwise returns <code>false</code>. 
- *
- * @param thread
- * @param clear
- * @return <code>true</code> if the thread <code>thread</code>
- * is interrupted; <code>false</code> otherwise.
- */
-bool thread_is_interrupted(jthread thread, bool clear);
-
-/**
- * Waits till the thread <code>thread</code> is dead or time specified is expired.
- *
- * Precisely, the function is returned if the thread <code>thread</code> 
- * is dead or real time elapsed from wating begin 
- * is greater or equal the time specified.
- *
- * @param thread
- * @param millis
- * @param nanos
- */
-void thread_join(jthread thread, long millis, int nanos); 
-
-/**
- * Resumes suspended thread <code>thread</code> execution.
- *
- * Precisely, cancels the effect of all previous <
- * code>thread_suspend(thread)</code> calls. 
- * <P>So, the thread <code>thread</code> may proceed execution.
- *
- * @param thread
- */
-void thread_resume(jthread thread); 
-
-/**
- * Sets <code>thread</code> thread's local storage. 
- *
- * @param env
- * @param thread
- * @param data
- */
-int thread_set_jvmt_thread_local_storage(jvmtiEnv* env,
-                                      jthread thread, const void* data);
-/**
- * Sets <code>thread</code> thread's priority. 
- *
- * The <code>thread</code> thread's priority gets 
- * equal to <code>newPriority</code>. 
- *
- * @param thread
- * @param newPriority
- */
-void thread_set_priority(jthread thread, int newPriority); 
-
-/**
- * Makes thread <code>thread</code> to sleep for specified time. 
- *
- * Thread <code>thread</code> gets sleeping till another thread
- * invokes the <code>thread_interrupt(thread)</code> method or real time 
- * elapsed from sleeping begin is greater or equal the time specified. 
- *
- * @param thread
- * @param millis
- * @param nanos
- */
-void thread_sleep(jthread thread, long millis, int nanos); 
-
-/**
- * Thread <code>thread</code> execution begins. 
- *
- * The <code>thread</code> thread's <code>run()</code> method is called. 
- *
- * @param thread
- */
-VMEXPORT void  thread_start(JNIEnv*, jthread thread);
-
-/**
- * Forces thread <code>thread</code> termination.
- *
- * Precisely, makes the thread <code>thread</code> to throw 
- * <code>threadDeathException</code> from the current execution point.
- *
- * @param thread
- * @param threadDeathException
- */
-void thread_stop(jthread thread, jobject threadDeathException); 
-
-// GC can only be disabled in native code.  In jitted code GC is always
-// "enabled."  Of course it doesn't mean that GC can happen at any point
-// in jitted code -- only at GC-safe points.
-
-/**
- * Suspends the thread <code>thread</code> execution. 
- *
- * The <code>thread</code> thread's execution is suspended till 
- * <code>thread_resume(thread)</code> is called from another thread.
- *
- * @param thread
- */
-void thread_suspend(jthread thread); 
-
-/**
- * Suspends the thread <code>thread</code> execution for a while. 
- *
- * So, the other threads have possibility to be executed.
- *
- * @param thread
- */
-void thread_yield(jthread thread);
-//------------------------------------------------------------
-//------------------------------------------------------------
-
-/**
- * Get the current thread's interrupt event. 
- */
-VMEXPORT void* thread_get_interrupt_event();
-
-#ifdef __cplusplus
-}
-#endif
-#endif // _OPEN_THREAD_H_

Added: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_externals.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_externals.h?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_externals.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_externals.h Wed Aug 23 09:48:41 2006
@@ -0,0 +1,128 @@
+ /* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ * @author Artem Aliev
+ * @version $Revision$
+ */
+
+#ifndef OPEN_THREAD_EXTERNALS_H
+#define OPEN_THREAD_EXTERNALS_H
+
+#include "open/types.h"
+#include <jni.h>
+#include "jvmti_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/**
+ * Returns the address of the memory chunk in the object which can be used by the 
+ * Thread Manager for synchronization purposes.
+ *
+ * @param[in] obj jobject those address needs to be given
+ * @return 
+ */
+VMEXPORT void *vm_object_get_lockword_addr(jobject obj);
+
+/**
+ * Returns the size of the memory chunk in the object that can be used by
+ * Thread Manager for synchronization purposes. 
+ *
+ * The returned size must be equal for all Java objets and is constant over time. 
+ * It should be possible to call this method during initialization time.
+ *
+ * @return the size 
+ */
+ VMEXPORT size_t vm_object_get_lockword_size();
+
+
+/**
+ * Stores a pointer to TM-specific data in the java.lang.Thread object.
+ *
+ * A typical implementation may store a pointer within a private
+ * non-static field of Thread.
+ *
+ * @param[in] thread a java.lang.Thread object those private field is going to be used for data storage
+ * @param[in] data_ptr a pointer to data to be stored
+ */
+VMEXPORT void vm_jthread_set_tm_data(jthread thread, void *data_ptr);
+
+/**
+ * Retrieves TM-specific data from the java.lang.Thread object
+ *
+ * @param[in] thread a thread 
+ * @return TM-specific data previously stored, or NULL if there are none.
+ */
+VMEXPORT void *vm_jthread_get_tm_data(jthread thread);
+
+/** 
+  * registtrate thread in VM, so it could execute Java
+  */
+VMEXPORT int vm_attach();
+/**
+  * free java related resources before thread exit
+  */
+VMEXPORT int vm_detach();
+
+/* throw exception
+ * @param[in] name char* -name
+ * @param[in] message char* -message
+ * @return int.
+ */
+VMEXPORT int jthread_throw_exception(char* name, char* message);
+
+// TI support interface
+VMEXPORT void jvmti_send_thread_start_end_event(int);
+VMEXPORT void jvmti_send_contended_enter_or_entered_monitor_event(jobject obj, int isEnter);
+VMEXPORT void jvmti_send_waited_monitor_event(jobject obj, jboolean is_timed_out);
+VMEXPORT void jvmti_send_wait_monitor_event(jobject obj, jlong timeout);
+
+/**
+ * vm_objects_are_equal
+ * obj1 jobject
+ * obj2 jobject
+ * @return int
+ */
+VMEXPORT int vm_objects_are_equal(jobject obj1, jobject obj2);
+
+/**
+ * ti is enabled
+ * @return int
+ */
+VMEXPORT int ti_is_enabled();
+
+/**
+ * get JNIEnv *
+ * @return JNIEnv *
+ */
+VMEXPORT JNIEnv * get_jnienv(void);
+
+
+#ifdef __cplusplus
+}
+
+/**
+  * all folowing entries is requiried for VM helpers only 
+  */
+
+#include "encoder.h"
+
+
+#endif
+
+#endif  /* OPEN_THREAD_EXTERNALS_H */
+

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_externals.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_helpers.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_helpers.h?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_helpers.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_helpers.h Wed Aug 23 09:48:41 2006
@@ -0,0 +1,52 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/**
+ * @author Artem Aliev
+ * @version $Revision$
+ */
+
+#ifndef OPEN_THREAD_HELPERS_H
+#define OPEN_THREAD_HELPERS_H
+
+/**
+ * @file 
+ * @brief Provides optimized assambly code generators for common monitor functions.
+ *
+ * For more detailes see thread manager component documentation located at vm/thread/doc/ThreadManager.htm
+ */
+
+#include "open/types.h"
+#include "open/hythread_ext.h"
+#include "encoder.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+typedef void * fast_tls_func();
+
+fast_tls_func* get_tls_helper(hythread_tls_key_t key);
+char* gen_hythread_self_helper(char *ss);
+char* gen_monitorenter_fast_path_helper(char *ss, const R_Opnd & input_param1);
+char* gen_monitorenter_slow_path_helper(char *ss, const R_Opnd & input_param1);
+char* gen_monitor_exit_helper(char *ss, const R_Opnd & input_param1);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* OPEN_THREAD_NATIVE_H */

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/thread_helpers.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/ti_thread.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/ti_thread.h?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/ti_thread.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/ti_thread.h Wed Aug 23 09:48:41 2006
@@ -0,0 +1,142 @@
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/**
+ * @author Andrey Chernyshev
+ * @version $Revision$
+ */
+
+#ifndef OPEN_THREAD_TI_H
+#define OPEN_THREAD_TI_H
+
+/**
+ * @file ti_thread.h
+ * @brief JVMTI support 
+ * @details
+ * TI part of the Java threading interface.
+ * The TI part is mostly targeted to address the needs of JVMTI and java.lang.management classes needs.
+ * All functions start with jthread_* prefix.
+ */
+
+#include "jvmti_types.h"
+#include "hythread.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * JVM TI local storage structure
+ *
+ * @param[in] thread 
+ */
+typedef struct {
+    jvmtiEnv * env;
+    void * data;
+} JVMTILocalStorage;
+
+typedef struct HyThread *jthread_iterator_t;
+/** @name State query
+ */
+//@{
+
+IDATA jthread_get_state(jthread thread, jint *thread_state);
+
+//@}
+/** @name Instrumentation
+ */
+//@{
+
+IDATA jthread_get_all_threads(jthread** threads, jint *count);
+IDATA jthread_get_deadlocked_threads(jthread* thread_list, jint thread_count, jthread** dead_list, jint *dead_count);
+IDATA jthread_get_thread_count(jint *count);
+IDATA jthread_get_blocked_count(jint* count);
+IDATA jthread_get_waited_count(jint* count);
+
+//@}
+/** @name Local storage
+ */
+//@{
+
+IDATA jthread_set_local_storage(jthread thread, const void* data);
+IDATA jthread_get_local_storage(jthread thread, void** data_ptr);
+
+//@}
+/** @name Monitor info
+ */
+//@{
+
+IDATA jthread_get_contended_monitor(jthread thread, jobject* monitor);
+IDATA jthread_get_wait_monitor(jthread thread, jobject* monitor);
+jboolean jthread_holds_lock(jthread thread, jobject monitor);
+IDATA jthread_get_lock_owner(jobject monitor, jthread* lock_owner);
+IDATA jthread_get_lock_recursion(jobject monitor, jthread lock_owner);
+IDATA jthread_get_owned_monitors(jthread thread, jint* mon_count_ptr, jobject** monitors);
+
+//@}
+/** @name CPU timing
+ */
+//@{
+
+IDATA jthread_get_thread_cpu_time(jthread thread, jlong *nanos_ptr);
+IDATA jthread_get_thread_user_cpu_time(jthread thread, jlong *nanos_ptr);
+IDATA jthread_get_thread_blocked_time(jthread thread, jlong *nanos_ptr);
+IDATA jthread_get_thread_waited_time(jthread thread, jlong *nanos_ptr);
+IDATA jthread_get_thread_cpu_timer_info(jvmtiTimerInfo* info_ptr);
+
+//@}
+/** @name Peak count
+ */
+//@{
+
+IDATA jthread_reset_peak_thread_count();
+IDATA jthread_get_peak_thread_count(jint *threads_count_ptr);
+
+//@}
+/** @name Raw monitors
+ */
+//@{
+
+IDATA jthread_raw_monitor_create(jrawMonitorID *mon_ptr);
+IDATA jthread_raw_monitor_destroy(jrawMonitorID mon_ptr);
+IDATA jthread_raw_monitor_enter(jrawMonitorID mon_ptr);
+IDATA jthread_raw_monitor_try_enter(jrawMonitorID mon_ptr);
+IDATA jthread_raw_monitor_exit(jrawMonitorID mon_ptr);
+IDATA jthread_raw_monitor_notify(jrawMonitorID mon_ptr);
+IDATA jthread_raw_monitor_notify_all(jrawMonitorID mon_ptr);
+IDATA jthread_raw_monitor_wait(jrawMonitorID mon_ptr, I_64 millis);
+
+//@}
+
+JVMTILocalStorage* jthread_get_jvmti_local_storage(jthread java_thread);
+
+/** @name jthread iterators
+ */
+//@{
+
+jthread_iterator_t jthread_iterator_create(void);
+jthread jthread_iterator_next(jthread_iterator_t *it);
+IDATA jthread_iterator_reset(jthread_iterator_t *it);
+IDATA jthread_iterator_size(jthread_iterator_t iterator);
+IDATA jthread_iterator_release(jthread_iterator_t *it);
+
+//@}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* OPEN_THREAD_TI_H */

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/ti_thread.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/types.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/types.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/types.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/types.h Wed Aug 23 09:48:41 2006
@@ -37,7 +37,7 @@
 
 #else  // !PLATFORM_POSIX
 
-#if defined(BUILDING_VM)
+#if defined(BUILDING_VM) && !defined(STATIC_BUILD)
 #define VMEXPORT __declspec(dllexport)
 #define JITEXPORT __declspec(dllimport)
 #define EMEXPORT __declspec(dllimport)

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/include/open/vm_util.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/open/vm_util.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/open/vm_util.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/open/vm_util.h Wed Aug 23 09:48:41 2006
@@ -26,17 +26,17 @@
 #include "port_malloc.h"
 #include "open/types.h"
 
-class CriticalSection
-{
-public:
-    VMEXPORT CriticalSection();
-    VMEXPORT ~CriticalSection();
-    VMEXPORT void lock();
-    VMEXPORT void unlock();
-    VMEXPORT bool tryLock();
-private:
-    /*CRITICAL_SECTION*/ void *m_cs;
-};
+#include "hythread_ext.h"
+
+inline IDATA wait_for_multiple_semaphores(int num, hysem_t *sems) {
+    for (int i = 0; i < num; i ++) {
+           IDATA stat = hysem_wait(sems[i]);
+           if (stat !=TM_ERROR_NONE) {
+                return stat;
+           }
+    }
+    return TM_ERROR_NONE;
+}
 
 typedef struct String String;
 
@@ -65,22 +65,6 @@
 private:
     void *_pcontext; // this would be a pointer to CONTEXT on NT
 };
-
-/**
- * Low level thread and sync primitives. Should be replaced
- * with java threading analogues during refactoring.
- */
-VmThreadHandle vm_beginthreadex( void * security, unsigned stack_size, unsigned(__stdcall *start_address)(void *), void *arglist, unsigned initflag, pthread_t *thrdaddr);
-VmThreadHandle vm_beginthread(void(__cdecl *start_address)(void *), unsigned stack_size, void *arglist);
-void vm_endthreadex(int);
-void vm_endthread(void);
-
-VmEventHandle vm_create_event(int *, unsigned int, unsigned int, char *);
-BOOL vm_reset_event(VmEventHandle hEvent);
-BOOL vm_set_event(VmEventHandle hEvent);
-DWORD vm_wait_for_single_object(VmEventHandle hHandle, DWORD dwMilliseconds);
-DWORD vm_wait_for_multiple_objects(DWORD num, const VmEventHandle * handle, BOOL flag, DWORD dwMilliseconds);
-
 
 VMEXPORT void vm_exit(int exit_code);
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_defs.h Wed Aug 23 09:48:41 2006
@@ -260,7 +260,7 @@
 /********* INLINE FUNCTIONS *******/
 static inline StackFrame*
 getLastStackFrame() {
-    return (StackFrame*)p_TLS_vmthread->lastFrame;
+    return (StackFrame*)get_thread_ptr()->lastFrame;
 }
 
 static inline StackFrame*
@@ -273,7 +273,7 @@
 };
 
 static inline void setLastStackFrame(StackFrame *frame) {
-    p_TLS_vmthread->lastFrame = frame;
+    get_thread_ptr()->lastFrame = frame;
 }
 
 void

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native.h Wed Aug 23 09:48:41 2006
@@ -31,7 +31,7 @@
 
 
 #define M2N_ALLOC_MACRO                                     \
-    assert(!tmn_is_suspend_enabled());                      \
+    assert(!hythread_is_suspend_enabled());                      \
     M2nFrame m2n;                                           \
     memset((void*)&m2n, 0, sizeof(M2nFrame));               \
     m2n.prev_m2nf = m2n_get_last_frame();                   \
@@ -47,7 +47,7 @@
     m2n_set_local_handles(&m2n, (ObjectHandles*)&handles)
 
 #define M2N_FREE_MACRO                                      \
-    assert(!tmn_is_suspend_enabled());                      \
+    assert(!hythread_is_suspend_enabled());                      \
     free_local_object_handles2(m2n_get_local_handles(&m2n));\
     m2n_set_last_frame(m2n_get_previous_frame(&m2n))
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp Wed Aug 23 09:48:41 2006
@@ -22,6 +22,7 @@
 #include "interpreter_exports.h"
 #include "interpreter_imports.h"
 
+#include "find_natives.h"
 #include "exceptions.h"
 #include "mon_enter_exit.h"
 
@@ -29,7 +30,7 @@
 #include "interp_defs.h"
 #include "ini.h"
 
-#include "open/thread.h"
+
 
 // ppervov: HACK: allows using STL modifiers (dec/hex) and special constants (endl)
 using namespace std;
@@ -70,7 +71,7 @@
         Method *method,
         jvalue *return_value,
         jvalue *args) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     DEBUG_TRACE("\n<<< interpreter_invoke_native: "
            << method->get_class()->name->bytes << " "
@@ -181,8 +182,8 @@
         method_entry_callback(method);
 
     if (method->is_synchronized()) {
-        assert(tmn_is_suspend_enabled());
-        vm_monitor_enter_slow_handle(_this);
+        assert(hythread_is_suspend_enabled());
+        jthread_monitor_enter(_this);
     }
 
     jvalue *resultPtr = return_value;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp Wed Aug 23 09:48:41 2006
@@ -26,7 +26,7 @@
 #include "interp_native.h"
 #include "interp_defs.h"
 #include "ini.h"
-#include "open/thread.h"
+#include "open/jthread.h"
 
 using namespace std;
 
@@ -80,7 +80,7 @@
         Method *method,
         jvalue *return_value,
         jvalue *args) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     DEBUG_TRACE("\n<<< interpreter_invoke_native: "
            << method->get_class()->name->bytes << " "
@@ -160,8 +160,8 @@
 
 
     if (method->is_synchronized()) {
-        assert(tmn_is_suspend_enabled());
-        vm_monitor_enter_slow_handle(_this);
+        assert(hythread_is_suspend_enabled());
+        jthread_monitor_enter(_this);
     }
 
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp Wed Aug 23 09:48:41 2006
@@ -27,7 +27,7 @@
 #include "interp_defs.h"
 #include "ini.h"
 
-#include "open/thread.h"
+
 
 // ppervov: HACK: allows using STL modifiers (dec/hex) and special constants (endl)
 using namespace std;
@@ -71,7 +71,7 @@
         Method *method,
         jvalue *return_value,
         jvalue *args) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     DEBUG_TRACE("\n<<< interpreter_invoke_native: "
            << method->get_class()->name->bytes << " "
@@ -167,8 +167,8 @@
         method_entry_callback(method);
 
     if (method->is_synchronized()) {
-        assert(tmn_is_suspend_enabled());
-        vm_monitor_enter_slow_handle(_this);
+        assert(hythread_is_suspend_enabled());
+        jthread_monitor_enter(_this);
     }
 
     int frameSize = 0;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_vm_helpers.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_vm_helpers.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_vm_helpers.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_vm_helpers.cpp Wed Aug 23 09:48:41 2006
@@ -27,9 +27,9 @@
 
 void interp_throw_exception(const char* exc) {
     M2N_ALLOC_MACRO;
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     tmn_suspend_enable();
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     throw_java_exception(exc);
     tmn_suspend_disable();
     M2N_FREE_MACRO;
@@ -37,9 +37,9 @@
 
 void interp_throw_exception(const char* exc, const char *message) {
     M2N_ALLOC_MACRO;
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     tmn_suspend_enable();
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     throw_java_exception(exc, message);
     tmn_suspend_disable();
     M2N_FREE_MACRO;
@@ -56,7 +56,7 @@
 
 
 Class* interp_resolve_class(Class *clazz, int classId) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Compilation_Handle handle;
     handle.env = VM_Global_State::loader_env;
     handle.jit = 0;
@@ -73,7 +73,7 @@
 }
 
 Class* interp_resolve_class_new(Class *clazz, int classId) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Compilation_Handle handle;
     handle.env = VM_Global_State::loader_env;
     handle.jit = 0;
@@ -91,7 +91,7 @@
 
 
 Field* interp_resolve_static_field(Class *clazz, int fieldId, bool putfield) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Compilation_Handle handle;
     handle.env = VM_Global_State::loader_env;
     handle.jit = 0;
@@ -109,7 +109,7 @@
 }
 
 Field* interp_resolve_nonstatic_field(Class *clazz, int fieldId, bool putfield) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Compilation_Handle handle;
     handle.env = VM_Global_State::loader_env;
     handle.jit = 0;
@@ -128,13 +128,13 @@
 
 
 Method* interp_resolve_virtual_method(Class* clazz, int methodId) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Compilation_Handle handle;
     handle.env = VM_Global_State::loader_env;
     handle.jit = 0;
 
     tmn_suspend_enable();
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     Method *method = resolve_virtual_method(
             (Compile_Handle*)&handle, clazz, methodId);
     tmn_suspend_disable();
@@ -146,13 +146,13 @@
 }
 
 Method* interp_resolve_interface_method(Class* clazz, int methodId) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Compilation_Handle handle;
     handle.env = VM_Global_State::loader_env;
     handle.jit = 0;
 
     tmn_suspend_enable();
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     Method *method = resolve_interface_method(
             (Compile_Handle*)&handle, clazz, methodId);
     tmn_suspend_disable();
@@ -164,7 +164,7 @@
 }
 
 Method *interp_resolve_static_method(Class *clazz, int methodId) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Compilation_Handle handle;
     handle.env = VM_Global_State::loader_env;
     handle.jit = 0;
@@ -181,7 +181,7 @@
 }
 
 Method *interp_resolve_special_method(Class *clazz, int methodId) {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Compilation_Handle handle;
     handle.env = VM_Global_State::loader_env;
     handle.jit = 0;



Mime
View raw message