You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/08/23 18:49:21 UTC

svn commit: r434076 [18/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/...

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_generic_rt_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_generic_rt_support_ia32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_generic_rt_support_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_generic_rt_support_ia32.cpp Wed Aug 23 09:48:41 2006
@@ -31,7 +31,7 @@
 #include "cxxlog.h"
 
 #include "jit_runtime_support.h"
-#include "open/thread.h"
+
 #include "nogc.h" // for malloc_fixed_code_for_jit()
 #include "encoder.h"
 #include "vm_stats.h"
@@ -49,7 +49,7 @@
 
 //static uint64 vm_lshl(unsigned count, uint64 n)
 //{
-//    assert(!tmn_is_suspend_enabled());
+//    assert(!hythread_is_suspend_enabled());
 //    return n << (count & 0x3f);
 //} //vm_lshl
 
@@ -69,7 +69,7 @@
 
 //static int64 vm_lshr(unsigned count, int64 n)
 //{
-//    assert(!tmn_is_suspend_enabled());
+//    assert(!hythread_is_suspend_enabled());
 //    return n >> (count & 0x3f);
 //} //vm_lshr
 
@@ -89,7 +89,7 @@
 
 //static uint64 vm_lushr(unsigned count, uint64 n)
 //{
-//    assert(!tmn_is_suspend_enabled());
+//    assert(!hythread_is_suspend_enabled());
 //    return n >> (count & 0x3f);
 //} //vm_lushr
 
@@ -111,7 +111,7 @@
 
 static int64 __stdcall vm_lmul(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     return m * n;
 } //vm_lmul
@@ -121,7 +121,7 @@
 
 static int64 __stdcall vm_lmul_const_multiplier(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     __asm{
         mov  eax,dword ptr [ebp+0ch]
         mov  ecx,dword ptr [ebp+10h]
@@ -139,7 +139,7 @@
 
 //static int64 __stdcall do_lrem(int64 m, int64 n)
 //{
-//    assert(!tmn_is_suspend_enabled());
+//    assert(!hythread_is_suspend_enabled());
 //
 //    return m % n;
 //} //do_lrem
@@ -203,7 +203,7 @@
 
 static int64 __stdcall vm_d2l(double d)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
 #ifdef VM_STATS
     vm_stats_total.num_d2l++;
@@ -288,7 +288,7 @@
 
 static int64 __stdcall vm_f2l(float f)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
 #ifdef VM_STATS
     vm_stats_total.num_f2l++;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_ia32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_ia32.cpp Wed Aug 23 09:48:41 2006
@@ -42,7 +42,7 @@
 #include "lil_code_generator.h"
 #include "../m2n_em64t_internal.h"
 #include "object_handles.h"
-#include "open/thread.h"
+
 
 extern bool dump_stubs;
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_ia32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_ia32.cpp Wed Aug 23 09:48:41 2006
@@ -48,7 +48,7 @@
 #include "nogc.h"
 #include "encoder.h"
 #include "open/vm_util.h"
-#include "open/thread.h"
+
 #include "vm_threads.h"
 #include "mon_enter_exit.h"
 #include "vm_arrays.h"
@@ -88,11 +88,10 @@
 /////////////////////////////////////////////////////////////////
 // begin VM_Runtime_Support
 /////////////////////////////////////////////////////////////////
-CriticalSection cs;
 /*
 static void vm_throw_java_lang_ClassCastException()
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     throw_java_exception("java/lang/ClassCastException");
 } //vm_throw_java_lang_ClassCastException
 
@@ -153,7 +152,7 @@
     vm_stats_total.num_is_class_initialized++;
     clss->num_class_init_checks++;
 #endif // VM_STATS
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     return clss->state == ST_Initialized;
 } //is_class_initialized
 */
@@ -394,7 +393,7 @@
 /*
 static void vm_throw_java_lang_ArithmeticException()
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     throw_java_exception("java/lang/ArithmeticException");
 } //vm_throw_java_lang_ArithmeticException
 
@@ -460,7 +459,7 @@
 
 static int64 __stdcall vm_lrem(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     return m % n;
 } //vm_lrem
 */
@@ -476,7 +475,7 @@
 
 static int64 __stdcall vm_ldiv(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     assert(n);
     return m / n;
 } //vm_ldiv

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp Wed Aug 23 09:48:41 2006
@@ -36,7 +36,7 @@
 
 #include "lock_manager.h"
 #include "open/types.h"
-#include "open/thread.h"
+
 #include "Class.h"
 #include "environment.h"
 #include "method_lookup.h"
@@ -97,7 +97,7 @@
 
 void compile_protect_arguments(Method_Handle method, GcFrame* gc)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Method_Signature_Handle msh = method_get_signature(method);
     unsigned num_args = method_args_get_number(msh);
     unsigned num_arg_words = ((Method*)method)->get_num_arg_bytes()>>2;
@@ -262,13 +262,13 @@
         // pop args, leaving stack pointer pointing at return address
         ss = alu(ss, add_opc,  esp_opnd,  ecx_opnd);
         ss = ret(ss);
-        break;
     }
+        break;
     case CNP_JmpToRetAddrFinalAction: {
         // Continue execution in, e.g., the newly compiled method.
         ss = jump(ss,  eax_opnd);
-        break;
     }
+        break;
     default:
         ABORT("Wrong final action");
     }
@@ -484,7 +484,6 @@
 //
 //    return addr;
 //} // compile_gen_compile_me_exc_throw
- 
 
 void gen_native_hashcode(Emitter_Handle h, Method *m);
 unsigned native_hashcode_fastpath_size(Method *m);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp Wed Aug 23 09:48:41 2006
@@ -32,7 +32,7 @@
 #include "Class.h"
 #include "exceptions.h"
 #include "vm_threads.h"
-#include "open/thread.h"
+
 #include "compile.h"
 #include "nogc.h"
 #include "encoder.h"
@@ -128,7 +128,7 @@
     int argId = sz;
     int pos = 0;
 
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     if (!method->is_static()) {
         ObjectHandle handle = (ObjectHandle) args[pos++].l;
         assert(handle);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp Wed Aug 23 09:48:41 2006
@@ -31,7 +31,7 @@
 #include "cxxlog.h"
 
 #include "jit_runtime_support.h"
-#include "open/thread.h"
+
 #include "nogc.h" // for malloc_fixed_code_for_jit()
 #include "encoder.h"
 #include "vm_stats.h"
@@ -52,7 +52,7 @@
 
 static uint64 vm_lshl(unsigned count, uint64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     return n << (count & 0x3f);
 } //vm_lshl
 
@@ -108,7 +108,7 @@
 
 static int64 vm_lshr(unsigned count, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     return n >> (count & 0x3f);
 } //vm_lshr
 
@@ -162,7 +162,7 @@
 
 static uint64 vm_lushr(unsigned count, uint64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     return n >> (count & 0x3f);
 } //vm_lushr
 
@@ -218,7 +218,7 @@
 
 static int64 __stdcall vm_lmul(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     return m * n;
 } //vm_lmul
@@ -228,7 +228,7 @@
 
 static int64 __stdcall vm_lmul_const_multiplier(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     __asm{
         mov  eax,dword ptr [ebp+0ch]
         mov  ecx,dword ptr [ebp+10h]
@@ -246,7 +246,7 @@
 
 static int64 __stdcall do_lrem(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     return m % n;
 } //do_lrem
@@ -701,7 +701,7 @@
 
 static int64 __stdcall vm_d2l(double d)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
 #ifdef VM_STATS
     vm_stats_total.num_d2l++;
@@ -883,7 +883,7 @@
 
 static int64 __stdcall vm_f2l(float f)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
 #ifdef VM_STATS
     vm_stats_total.num_f2l++;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp Wed Aug 23 09:48:41 2006
@@ -18,6 +18,8 @@
  * @version $Revision: 1.1.2.2.4.3 $
  */  
 
+#include <open/hythread_ext.h>
+#include <open/thread_helpers.h>
 
 #include "platform_lowlevel.h"
 
@@ -40,7 +42,6 @@
 #include "lil_code_generator.h"
 #include "../m2n_ia32_internal.h"
 #include "object_handles.h"
-#include "open/thread.h"
 #include "Class.h"
 
 #ifdef VM_STATS
@@ -51,7 +52,7 @@
 #include "dump.h"
 extern bool dump_stubs;
 #endif
-
+#define INPUT_ARG_OFFSET 4
 char *gen_setup_j2n_frame(char *s);
 char *gen_pop_j2n_frame(char *s);
 
@@ -77,72 +78,53 @@
 } //gen_convert_struct_class_to_object
 
 
+/*
+ * Helper for monenter intstruction
+ */
 static char * gen_restore_monitor_enter(char *ss, char *patch_addr_null_arg)
 {
+    
+    // Obtain lockword offset for the given object
     const unsigned header_offset = ManagedObject::header_offset();
+    signed offset;
+    assert(header_offset);
 #ifdef VM_STATS
     ss = inc(ss,  M_Opnd((unsigned)&(vm_stats_total.num_monitor_enter)));
 #endif
-
-#ifdef USE_TLS_API
-    ss = call(ss, (char *)get_self_stack_key);
-    ss = mov(ss,  edx_opnd,  eax_opnd);
-#else //USE_TLS_API
-    *ss++ = (char)0x64;
-    *ss++ = (char)0xa1;
-    *ss++ = (char)0x14;
-    *ss++ = (char)0x00;
-    *ss++ = (char)0x00;
-    *ss++ = (char)0x00;
-    ss = mov(ss,  edx_opnd,  M_Base_Opnd(eax_reg, (uint32)&((VM_thread *)0)->stack_key) );
-#endif //!USE_TLS_API
-    
-    ss = alu(ss, xor_opc,  eax_opnd,  eax_opnd);
     ss = mov(ss,  ecx_opnd,  M_Base_Opnd(esp_reg, INPUT_ARG_OFFSET));
     
     ss = test(ss,  ecx_opnd,   ecx_opnd);
     ss = branch8(ss, Condition_Z,  Imm_Opnd(size_8, 0));
     char *backpatch_address__null_pointer = ((char *)ss) - 1;
 
-    ss = prefix(ss, lock_prefix);   
-    ss = cmpxchg(ss,  M_Base_Opnd(ecx_reg, header_offset + STACK_KEY_OFFSET),  edx_opnd, size_16);
+    ss = alu(ss, add_opc, ecx_opnd, Imm_Opnd(header_offset)); // pop parameters
+    ss = gen_monitorenter_fast_path_helper(ss, ecx_opnd);
+    ss = test(ss,  eax_opnd,   eax_opnd);
     ss = branch8(ss, Condition_NZ,  Imm_Opnd(size_8, 0));
     char *backpatch_address__fast_monitor_failed = ((char *)ss) - 1;
-
     ss = ret(ss,  Imm_Opnd(4));
 
-    signed offset = (signed)ss - (signed)backpatch_address__fast_monitor_failed - 1;
+    // Slow path: happens when the monitor is busy (contention case)
+    offset = (signed)ss - (signed)backpatch_address__fast_monitor_failed - 1;
     *backpatch_address__fast_monitor_failed = (char)offset;
 
     ss = gen_setup_j2n_frame(ss);
     ss = push(ss,  M_Base_Opnd(esp_reg, m2n_sizeof_m2n_frame));
  
-/*
-     // packing heap pointer to handle -salikh
     ss = call(ss, (char *)oh_convert_to_local_handle);
     ss = alu(ss, add_opc, esp_opnd, Imm_Opnd(4)); // pop parameters
-    ss = push(ss, eax_opnd); // push the address of the handle
-    ss = call(ss, (char *)tmn_suspend_enable); // enable gc
-    // -salikh
-
-    ss = call(ss, (char *)vm_monitor_enter_slow_handle);
-    ss = alu(ss, add_opc, esp_opnd, Imm_Opnd(4)); // pop parameters
 
-    // disable gc afterwards -salikh
-    ss = call(ss, (char *)tmn_suspend_disable); // disable gc
-    // -salikh
-*/
-    ss = call(ss, (char *)vm_monitor_enter_slow);
-    ss = alu(ss, add_opc,  esp_opnd,  Imm_Opnd(4));
+    ss = gen_monitorenter_slow_path_helper(ss, eax_opnd);
   
     ss = gen_pop_j2n_frame(ss);
     ss = ret(ss,  Imm_Opnd(4));
 
-    offset = (signed)ss - (signed)backpatch_address__null_pointer - 1;
-    *backpatch_address__null_pointer = (char)offset;
+    // Handle NPE here
+    signed npe_offset = (signed)ss - (signed)backpatch_address__null_pointer - 1;
+    *backpatch_address__null_pointer = (char)npe_offset;
     if (patch_addr_null_arg != NULL) {
-        offset = (signed)ss - (signed)patch_addr_null_arg - 1;
-        *patch_addr_null_arg = (char)offset;
+        npe_offset = (signed)ss - (signed)patch_addr_null_arg - 1;
+        *patch_addr_null_arg = (char)npe_offset;
     }
     // Object is null so throw a null pointer exception
     ss = jump(ss, (char*)exn_get_rth_throw_null_pointer());
@@ -197,127 +179,40 @@
 
 static char * gen_restore_monitor_exit(char *ss, char *patch_addr_null_arg)
 {
+
     const unsigned header_offset = ManagedObject::header_offset();
 #ifdef VM_STATS
-    ss = inc(ss,  M_Opnd((unsigned)&(vm_stats_total.num_monitor_exit)));
+    ss = inc(ss,  M_Opnd((unsigned)&(vm_stats_total.num_monitor_enter)));
 #endif
 
-#define CHECK_FOR_ILLEGAL_MONITOR_STATE_EXCEPTION
-#ifdef CHECK_FOR_ILLEGAL_MONITOR_STATE_EXCEPTION
-#ifdef USE_TLS_API
-    ss = call(ss, (char *)get_self_stack_key);
-    ss = shift(ss, shl_opc,  eax_opnd,  Imm_Opnd(16));
-#else
-//#error This code has not been tested.
-    ss = mov(ss,  eax_opnd,  esp_opnd);
-    ss = alu(ss, and_opc,  eax_opnd,  Imm_Opnd(0xffff0000));
-#endif //#ifdef USE_TLS_API else
     ss = mov(ss,  ecx_opnd,  M_Base_Opnd(esp_reg, INPUT_ARG_OFFSET));
-    ss = alu(ss, xor_opc,  eax_opnd,  M_Base_Opnd(ecx_reg, header_offset));
-    ss = test(ss,  eax_opnd,  Imm_Opnd(0xffffff80));
-    ss = branch8(ss, Condition_NZ,  Imm_Opnd(size_8, 0));
-    char *backpatch_address__slow_path = ((char *)ss) - 1;
-    ss = alu(ss, and_opc,  M_Base_Opnd(ecx_reg, header_offset),  Imm_Opnd(0x0000ffff));
-    ss = ret(ss,  Imm_Opnd(4));
-    signed offset1 = (signed)ss-(signed)backpatch_address__slow_path - 1;
-    *backpatch_address__slow_path = (char)offset1;
-#else // !CHECK_FOR_ILLEGAL_MONITOR_STATE_EXCEPTION
-    ss = mov(ss,  ecx_opnd,  M_Base_Opnd(esp_reg, INPUT_ARG_OFFSET));
-    // The current ia32.cpp doesn't support a 16-bit test instruction, so
-    // we hack it here.
-    *ss = 0x66; ss++; // prefix 0x66 means use the 16-bit form instead of the 32-bit form
-    ss = test(ss,  M_Base_Opnd(ecx_reg, header_offset),  Imm_Opnd(0xff80));
-    ss -= 2; // Adjust for a 16-bit immediate instead of a 32-bit immediate.
-    ss = branch8(ss, cc_ne,  Imm_Opnd(size_8, 0), 0);
-    char *backpatch_address__slow_path = ((char *)ss) - 1;
-    ss = mov(ss,  M_Base_Opnd(ecx_reg, header_offset + STACK_KEY_OFFSET),  Imm_Opnd(0), opnd_16);
-    ss = ret(ss,  Imm_Opnd(4));
-    signed offset1 = (signed)ss-(signed)backpatch_address__slow_path - 1;
-    *backpatch_address__slow_path = offset1;
-#endif // !CHECK_FOR_ILLEGAL_MONITOR_STATE_EXCEPTION
-
-#ifdef USE_TLS_API
-    ss = call(ss, (char *)get_self_stack_key);
-    ss = mov(ss,  edx_opnd,  eax_opnd);
-#else //USE_TLS_API
-    *ss++ = (char)0x64;
-    *ss++ = (char)0xa1;
-    *ss++ = (char)0x14;
-    *ss++ = (char)0x00;
-    *ss++ = (char)0x00;
-    *ss++ = (char)0x00;
-    ss = mov(ss,  edx_opnd,  M_Base_Opnd(eax_reg, (uint32)&((VM_thread *)0)->stack_key) );
-#endif //!USE_TLS_API
-
-    ss = mov(ss,  ecx_opnd,  M_Base_Opnd(esp_reg, INPUT_ARG_OFFSET));
-    ss = mov(ss,  eax_opnd,  M_Base_Opnd(ecx_reg, header_offset + STACK_KEY_OFFSET ), size_16);
-    ss = alu(ss, cmp_opc,  eax_opnd,  edx_opnd, size_16);
-    ss = branch8(ss, Condition_NZ,  Imm_Opnd(size_8, 0));
-    char *backpatch_address__illegal_monitor_failed = ((char *)ss) - 1;
-
-    ss = mov(ss,  eax_opnd,  M_Base_Opnd(ecx_reg,header_offset + HASH_CONTENTION_AND_RECURSION_OFFSET), size_16);
-
-    // need to code AH: ESP & size_8 -> AH
-    ss = alu(ss, cmp_opc,  esp_opnd,  Imm_Opnd(size_8, 0), size_8);
-
-    ss = branch8(ss, Condition_NZ,  Imm_Opnd(size_8, 0));
-    char *backpatch_address__recursed_monitor_failed = ((char *)ss) - 1;
-
-    //release the lock
-
-    ss = mov(ss,  edx_opnd,  Imm_Opnd(0));
-    ss = mov(ss,  M_Base_Opnd(ecx_reg, header_offset + STACK_KEY_OFFSET),  edx_opnd, size_16);
-
-    ss = mov(ss,  edx_opnd,  eax_opnd);
-    ss = alu(ss, and_opc,  edx_opnd,  Imm_Opnd(0x80));
+    ss = test(ss,  ecx_opnd,   ecx_opnd);
+    ss = branch8(ss, Condition_Z,  Imm_Opnd(size_8, 0));
+    char *backpatch_address__null_pointer = ((char *)ss) - 1;
 
+    ss = alu(ss, add_opc, ecx_opnd, Imm_Opnd(header_offset));
+    ss = gen_monitor_exit_helper(ss, ecx_opnd);
+    ss = test(ss,  eax_opnd,   eax_opnd);
     ss = branch8(ss, Condition_NZ,  Imm_Opnd(size_8, 0));
-    char *backpatch_address__contended_monitor_failed = ((char *)ss) - 1;
-    ss = ret(ss,  Imm_Opnd(4));
-
-    signed 
-    offset = (signed)ss-(signed)backpatch_address__contended_monitor_failed - 1;
-    *backpatch_address__contended_monitor_failed = (char)offset;
-    ss = push(ss,  M_Base_Opnd(esp_reg, INPUT_ARG_OFFSET));
-    ss = call(ss, (char *)find_an_interested_thread);
-    ss = alu(ss, add_opc,  esp_opnd,  Imm_Opnd(4));
+    char *backpatch_address__fast_monitor_failed = ((char *)ss) - 1;
     ss = ret(ss,  Imm_Opnd(4));
 
-    offset = (signed)ss-(signed)backpatch_address__recursed_monitor_failed - 1;
-    *backpatch_address__recursed_monitor_failed = (char)offset;
-    // esp_opnd & size_8 translates to AH
-    ss = dec(ss, esp_opnd,  size_8);
-    ss = mov(ss,   M_Base_Opnd(ecx_reg, header_offset + RECURSION_OFFSET),  esp_opnd, size_8);
-    ss = ret(ss,  Imm_Opnd(4));
+    signed offset = (signed)ss - (signed)backpatch_address__fast_monitor_failed - 1;
+    *backpatch_address__fast_monitor_failed = (char)offset;
+    //  illegal state happend
+    ss = jump(ss, (char*)exn_get_rth_throw_illegal_state_exception());
 
-    offset = (signed)ss-(signed)backpatch_address__illegal_monitor_failed - 1;
-    *backpatch_address__illegal_monitor_failed = (char)offset;
+    offset = (signed)ss - (signed)backpatch_address__null_pointer - 1;
+    *backpatch_address__null_pointer = (char)offset;
     if (patch_addr_null_arg != NULL) {
         offset = (signed)ss - (signed)patch_addr_null_arg - 1;
         *patch_addr_null_arg = (char)offset;
     }
-    ss = gen_setup_j2n_frame(ss);
-    ss = push(ss,  M_Base_Opnd(esp_reg, m2n_sizeof_m2n_frame));
-
- /*
-     // packing heap pointer to handle -salikh
-    ss = call(ss, (char *)oh_convert_to_local_handle);
-    ss = alu(ss, add_opc, esp_opnd, Imm_Opnd(4)); // pop parameters
-    ss = push(ss, eax_opnd); // push the address of the handle
-    ss = call(ss, (char *)tmn_suspend_enable); // enable gc
-    // -salikh
-
-    ss = call(ss, (char *)vm_monitor_exit_handle);
-    ss = alu(ss, add_opc, esp_opnd, Imm_Opnd(4));
-
-    // disable gc afterwards -salikh
-    ss = call(ss, (char *)tmn_suspend_disable); // disable gc
-    // -salikh
-*/
-    ss = call(ss, (char *)vm_monitor_exit);
-    ss = alu(ss, add_opc,  esp_opnd,  Imm_Opnd(4));
+    // Object is null so throw a null pointer exception
+    ss = jump(ss, (char*)exn_get_rth_throw_null_pointer());
     
     return ss;
+  
 } //gen_restore_monitor_exit
 
 
@@ -372,7 +267,7 @@
         return addr;
     }
 
-    const int stub_size = 126;
+    const int stub_size = 226;
     char *stub = (char *)malloc_fixed_code_for_jit(stub_size, DEFAULT_CODE_ALIGNMENT, CODE_BLOCK_HEAT_MAX/2, CAA_Allocate);
 #ifdef _DEBUG
     memset(stub, 0xcc /*int 3*/, stub_size);
@@ -411,7 +306,7 @@
         return addr;
     }
 
-    const int stub_size = 150;
+    const int stub_size = 250;
     char *stub = (char *)malloc_fixed_code_for_jit(stub_size, DEFAULT_CODE_ALIGNMENT, CODE_BLOCK_HEAT_MAX/2, CAA_Allocate);
 #ifdef _DEBUG
     memset(stub, 0xcc /*int 3*/, stub_size);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp Wed Aug 23 09:48:41 2006
@@ -43,7 +43,9 @@
 #include "nogc.h"
 #include "encoder.h"
 #include "open/vm_util.h"
-#include "open/thread.h"
+
+#include "open/thread_helpers.h"
+
 #include "vm_threads.h"
 #include "mon_enter_exit.h"
 #include "vm_arrays.h"
@@ -77,22 +79,16 @@
 #define SIZE(Struct, Field) \
   (sizeof(((Struct *) NULL)->Field))
 
-
-void * getaddress__vm_monitor_enter_naked();
-void * getaddress__vm_monitor_enter_static_naked();
-void * getaddress__vm_monitor_exit_naked();
-void * getaddress__vm_monitor_exit_static_naked();
 void * get_generic_rt_support_addr_ia32(VM_RT_SUPPORT f);
 
 
 /////////////////////////////////////////////////////////////////
 // begin VM_Runtime_Support
 /////////////////////////////////////////////////////////////////
-CriticalSection cs;
 
 static void vm_throw_java_lang_ClassCastException()
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     throw_java_exception("java/lang/ClassCastException");
     ABORT("The last called function should not return");
 } //vm_throw_java_lang_ClassCastException
@@ -225,7 +221,7 @@
     vm_stats_total.num_is_class_initialized++;
     clss->num_class_init_checks++;
 #endif // VM_STATS
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     return clss->state == ST_Initialized;
 } //is_class_initialized
 
@@ -393,10 +389,10 @@
     memset(stub, 0xcc /*int 3*/, stub_size);
 #endif
     char *ss = stub;
-
-#ifdef PLATFORM_POSIX
+// openTM integration 
+//#ifdef PLATFORM_POSIX
     ss = call(ss, (char *)vm_get_gc_thread_local);
-#else // !PLATFORM_POSIX
+/*#else // !PLATFORM_POSIX
     *ss++ = (char)0x64;
     *ss++ = (char)0xa1;
     *ss++ = (char)0x14;
@@ -405,6 +401,7 @@
     *ss++ = (char)0x00;
     ss = alu(ss, add_opc,  eax_opnd,  Imm_Opnd((uint32)&((VM_thread *)0)->_gc_private_information));
 #endif // !PLATFORM_POSIX
+*/
     ss = push(ss,  eax_opnd);
 
     ss = push(ss,  M_Base_Opnd(esp_reg, 12));
@@ -423,9 +420,10 @@
     *backpatch_address__fast_alloc_failed = (char)offset;
     
     ss = gen_setup_j2n_frame(ss);
-#ifdef PLATFORM_POSIX
+// openTM integration 
+//#ifdef PLATFORM_POSIX
     ss = call(ss, (char *)vm_get_gc_thread_local);
-#else // !PLATFORM_POSIX
+/*#else // !PLATFORM_POSIX
     *ss++ = (char)0x64;
     *ss++ = (char)0xa1;
     *ss++ = (char)0x14;
@@ -434,6 +432,7 @@
     *ss++ = (char)0x00;
     ss = alu(ss, add_opc,  eax_opnd,  Imm_Opnd((uint32)&((VM_thread *)0)->_gc_private_information));
 #endif // !PLATFORM_POSIX
+*/  
     ss = push(ss,  eax_opnd);
     ss = push(ss,  M_Base_Opnd(esp_reg, 8+m2n_sizeof_m2n_frame));
     ss = push(ss,  M_Base_Opnd(esp_reg, 8+m2n_sizeof_m2n_frame));
@@ -926,7 +925,7 @@
 
 static void vm_throw_java_lang_ArithmeticException()
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     throw_java_exception("java/lang/ArithmeticException");
     ABORT("The last called function should not return");
 } //vm_throw_java_lang_ArithmeticException
@@ -1125,7 +1124,7 @@
 
 static int64 __stdcall vm_lrem(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     return m % n;
 } //vm_lrem
 
@@ -1176,7 +1175,7 @@
 
 static int64 __stdcall vm_ldiv(int64 m, int64 n)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     assert(n);
     return m / n;
 } //vm_ldiv
@@ -1236,7 +1235,14 @@
 
 #endif //VM_STATS
 
+void * getaddress__vm_monitor_enter_naked();
+void * getaddress__vm_monitor_enter_static_naked();
+void * getaddress__vm_monitor_exit_naked();
 
+/**
+  * Returns fast monitor exit static function.
+  */
+void * getaddress__vm_monitor_exit_static_naked();
 void *vm_get_rt_support_addr(VM_RT_SUPPORT f)
 {
 #ifdef VM_STATS

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/compile_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/compile_ipf.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/compile_ipf.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/compile_ipf.cpp Wed Aug 23 09:48:41 2006
@@ -58,7 +58,7 @@
 #include "open/vm_util.h"
 #include "vm_synch.h"
 #include "vm_threads.h"
-#include "open/thread.h"
+
 #include "ini.h"
 
 #define METHOD_NAME_BUF_SIZE 512
@@ -363,7 +363,7 @@
 static void protect_value_type(Class_Handle c, uint64* start, GcFrame* gc)
 {
     ABORT("It is supposed that the function is never called");
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     unsigned num_fields = class_num_instance_fields_recursive(c);
     for(unsigned i=0; i<num_fields; i++) {
         Field_Handle f = class_get_instance_field_recursive(c, i);
@@ -398,7 +398,7 @@
 
 void compile_protect_arguments(Method_Handle method, GcFrame* gc)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Method_Signature_Handle msh = method_get_signature(method);
     unsigned num_args = method_args_get_number(msh);
     M2nFrame* m2nf = m2n_get_last_frame();

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp Wed Aug 23 09:48:41 2006
@@ -38,7 +38,7 @@
 #include "Class.h"
 #include "exceptions.h"
 #include "vm_threads.h"
-#include "open/thread.h"
+
 #include "vm_synch.h"
 #include "compile.h"
 #include "open/vm_util.h"
@@ -142,7 +142,7 @@
                            jvalue   *args)
 {
     Method *meth = (Method*) methodID;
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     void *entry_point = meth->get_code_addr();
     int nargs = meth->get_num_args();
     uint64 arg_words[255];

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp Wed Aug 23 09:48:41 2006
@@ -50,7 +50,7 @@
 #include "open/vm_util.h"
 #include "vm_strings.h"
 #include "vm_threads.h"
-#include "open/thread.h"
+
 #include "vm_stats.h"
 #include "merced.h"
 #include "Code_Emitter.h"
@@ -167,7 +167,7 @@
 
 extern "C" ManagedObject *vm_rt_new_resolved(Class *c)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     assert(strcmp(c->name->bytes, "java/lang/Class")); 
 #ifdef VM_STATS
     vm_stats_total.num_class_alloc_new_object++;
@@ -1250,7 +1250,7 @@
         emitter.set_target(nonnull_target);
     }
 
-    // If the cmpxchg failed, we fall through and execute the slow monitor enter path by calling vm_monitor_enter_slow.
+    // If the cmpxchg failed, we fall through and execute the slow monitor enter path by calling vm_monitor_enter.
 } //gen_vm_rt_monitorenter_fast_path
 
 
@@ -1427,9 +1427,9 @@
     if (addr) {
         return addr;
     }
-    void (*p_vm_monitor_enter_slow)(ManagedObject *p_obj);
-    p_vm_monitor_enter_slow = vm_monitor_enter_slow;
-    addr = gen_vm_rt_monitor_wrapper((void **)p_vm_monitor_enter_slow, gen_vm_rt_monitorenter_fast_path,
+    void (*p_vm_monitor_enter)(ManagedObject *p_obj);
+    p_vm_monitor_enter = vm_monitor_enter;
+    addr = gen_vm_rt_monitor_wrapper((void **)p_vm_monitor_enter, gen_vm_rt_monitorenter_fast_path,
                                       check_null, /*static_operation*/ false,
                                       "rt_monitor_enter_slowpath", "rt_monitor_enter_fastpath");
     return addr;
@@ -1460,9 +1460,9 @@
         return addr;
     }
     // 20030220 The "static" monitor enter function is only called with a struct Class pointer, which can't be NULL.
-    void (*p_vm_monitor_enter_slow)(ManagedObject *p_obj);
-    p_vm_monitor_enter_slow = vm_monitor_enter_slow;
-    addr = gen_vm_rt_monitor_wrapper((void **)p_vm_monitor_enter_slow, gen_vm_rt_monitorenter_fast_path, 
+    void (*p_vm_monitor_enter)(ManagedObject *p_obj);
+    p_vm_monitor_enter = vm_monitor_enter;
+    addr = gen_vm_rt_monitor_wrapper((void **)p_vm_monitor_enter, gen_vm_rt_monitorenter_fast_path, 
                                       /*check_null*/ false, /*static_operation*/ true,
                                       "rt_monitor_enter_static_slowpath", "rt_monitor_enter_static_fastpath");
     return addr;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/include/platform.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/include/platform.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/include/platform.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/include/platform.h Wed Aug 23 09:48:41 2006
@@ -49,12 +49,9 @@
 #define WORD unsigned short
 #define DWORD unsigned int
 #define BOOL unsigned int
-typedef pthread_t VmThreadHandle;
 #ifdef POINTER64
-#define VmEventHandle void*
 #define HANDLE void*
 #else
-#define VmEventHandle unsigned int
 #define HANDLE unsigned int
 #endif
 
@@ -109,34 +106,7 @@
 #define FMT64 "ll"
 #endif // FMT64
 
-void init_linux_thread_system();
 typedef struct VM_thread VM_thread;
-bool suspend_thread(VM_thread *);
-bool resume_thread(VM_thread *);
-
-#define CRITICAL_SECTION pthread_mutex_t
-#define LPCRITICAL_SECTION pthread_mutex_t *
-
-VOID InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
-
-VOID DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
-VOID LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
-BOOL TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
-BOOL EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
-
-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);
-
-#define CreateEvent vm_create_event
-#define SetEvent vm_set_event
-#define ResetEvent vm_reset_event
-#define WaitForSingleObject vm_wait_for_single_object
-#define WaitForMultipleObjects vm_wait_for_multiple_objects
-
-void Sleep(DWORD);
-void SleepEx(DWORD, bool);
 
 /*
  * There are two ways to implement Thread-Specific_Data(TSD or Thread Local 
@@ -227,13 +197,7 @@
 #define G_S_R_E_H NULL
 #define J_V_M_T_I_E_H NULL
 #define E_H_RECOMP NULL
-#define OS_THREAD_INIT_1()
-#define OS_SYNC_SUPPORT()
-#define OS_THREAD_INIT_2() p_TLS_vmthread = p_vm_thread; 
-#define THREAD_CLEANUP() 
-#define BEGINTHREADEX_SUSPENDSTATE 1
-#define SET_THREAD_DATA_MACRO()
-#define CHECK_HIJACK_SUPPORT_MACRO()
+
 #include "stdlib.h"
 
 #include <assert.h>
@@ -247,10 +211,6 @@
 
 void _fpreset(void);
 
-
-VmEventHandle vm_create_event(int *, unsigned int, unsigned int, char *);
-BOOL vm_destroy_event( VmEventHandle );
-
 typedef struct event_wrapper {
   pthread_mutex_t          mutex;
   pthread_cond_t           cond;
@@ -259,18 +219,6 @@
   unsigned int             n_wait;
 } event_wrapper;
 
-BOOL vm_reset_event(VmEventHandle hEvent);
-BOOL vm_set_event(VmEventHandle hEvent);
-
-void vm_yield();
-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);
-
-
-#define WAIT_TIMEOUT 0x102
-#define WAIT_OBJECT_0 0
-#define WAIT_FAILED (DWORD)0xFFFFFFFF
-
 
 typedef struct _FLOATING_SAVE_AREA {
     DWORD   ControlWord;
@@ -567,23 +515,13 @@
 #define CONTEXT_FLOATING_POINT 2
 #define CONTEXT_INTEGER 3
 #define THREAD_PRIORITY_NORMAL 4
-
+/*
 
 BOOL GetThreadContext(VmThreadHandle hthread, const CONTEXT *lpcontext);
 BOOL SetThreadContext(VmThreadHandle hh, const CONTEXT *cc);
 BOOL SetThreadPriority(VmThreadHandle hh, int pp);
 
-BOOL port_CloseHandle(VmEventHandle hh);
-pthread_t GetCurrentThreadId(void);
-VmEventHandle GetCurrentProcess(void);
-VmEventHandle GetCurrentThread(void);
-
-#define DUPLICATE_SAME_ACCESS 3
-
-BOOL DuplicateHandle(VmEventHandle aa, VmEventHandle bb, 
-                     VmEventHandle cc, VmEventHandle *dd, 
-                     DWORD ee, BOOL ff, DWORD gg);
-
+*/
 #define _MAX_PATH PATH_MAX
 
 struct _finddata_t {
@@ -607,12 +545,11 @@
 
 __uint64 GetTickCount();
 
-void vm_endthreadex(int);
 typedef void * FARPROC;
 
-inline void vm_terminate_thread(VmThreadHandle thrdaddr) {
+/*inline void vm_terminate_thread(VmThreadHandle thrdaddr) {
     pthread_cancel(thrdaddr);    
-}
+}*/
 #ifdef __cplusplus
 }
 #endif

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/os_wrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/os_wrapper.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/os_wrapper.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/os_wrapper.cpp Wed Aug 23 09:48:41 2006
@@ -49,343 +49,3 @@
 -- which uses SIGUSR1, SIGUSR2 (which conflicts with the java app debugger and vm)
 #endif
 #endif
-
-
-pthread_mutexattr_t mutex_attr;
-pthread_mutexattr_t mutex_attr_for_cond_wait;
-
-pthread_condattr_t cond_attr;
-
-pthread_attr_t pthread_attr;
-//extern pthread_key_t TLS_key_pvmthread;
-void init_linux_thread_system()
-{
-    static bool initialized = false;
-
-    if (initialized) return;
-    initialized = true;
-    pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE_NP);
-
-    int UNUSED stat = pthread_condattr_init(&cond_attr);
-    assert(stat == 0);
-
-    pthread_attr_init(&pthread_attr);
-    pthread_attr_setdetachstate(&pthread_attr, PTHREAD_CREATE_DETACHED);
-
-    //pthread_key_create(&TLS_key_pvmthread, 0);
-}
-
-VOID InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
-    init_linux_thread_system();
-    assert(lpCriticalSection);
-    int UNUSED xx = pthread_mutex_init(lpCriticalSection, &mutex_attr);
-    assert(xx == 0);
-}
-
-
-VOID DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
-    assert(lpCriticalSection);
-}
-
-
-VOID LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
-    assert(lpCriticalSection);
-    int UNUSED xx = pthread_mutex_unlock(lpCriticalSection);
-    assert(xx == 0);
-}
-
-
-BOOL TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
-    assert(lpCriticalSection);
-    int xx = pthread_mutex_trylock(lpCriticalSection);
-
-    if (xx == 0)
-        return 1;
-
-    assert(xx == EBUSY);
-    return 0;
-}
-
-
-BOOL EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
-    assert(lpCriticalSection);
-    int xx = pthread_mutex_lock(lpCriticalSection);
-
-    if (xx == 0)
-        return 1;
-
-    return 0;
-}
-
-
-VmThreadHandle vm_beginthreadex( void * UNREF security,  unsigned UNREF stacksize, unsigned(__stdcall *start_address)(void *), void *arglist, unsigned UNREF initflag, pthread_t *thrdaddr)
-{ 
-  pthread_t tid = 0;
-
-  void *(*sa)(void *) = ( void *(*)(void *) )start_address;
-  int stat = pthread_create(&tid, &pthread_attr, sa, arglist); 
-  *thrdaddr = tid;
-  if(stat !=0) {
-    return 0;
-  }
-  return (VmThreadHandle)tid;
-}
-
-VmThreadHandle vm_beginthread(void (__cdecl *start_address)(void *), unsigned UNREF stacksize, void *arglist)
-{ 
-  pthread_t tid = 0;
-
-  void *(*sa)(void *) = ( void *(*)(void *) )start_address;
-  int stat = pthread_create(&tid, &pthread_attr, sa, arglist); 
-  if(stat !=0) {
-    return 0;
-  }
-  
-  return (VmThreadHandle)tid;
-}
-
-static void init_timespec(struct timespec & ts, DWORD dwMillisec)
-{
-    ts.tv_sec  = dwMillisec/1000;
-    ts.tv_nsec = (dwMillisec%1000)*1000000;
-
-    struct timeval tv;
-    int UNUSED stat = gettimeofday(&tv, 0);
-    assert(stat == 0);
-
-    ts.tv_sec  += tv.tv_sec;
-    ts.tv_nsec += tv.tv_usec*1000;
-
-    ts.tv_sec += (ts.tv_nsec/1000000000);
-    ts.tv_nsec = (ts.tv_nsec%1000000000);
-}
-
-VmEventHandle vm_create_event(int * UNREF security, unsigned int man_reset_flag, 
-                         unsigned int initial_state_flag, char * UNREF p_name)
-{
-    event_wrapper *p_event = (event_wrapper *)STD_MALLOC( sizeof(struct event_wrapper) );
-
-    int stat = pthread_mutex_init(&p_event->mutex, &mutex_attr_for_cond_wait);
-    assert(stat == 0);
-  
-    stat = pthread_cond_init(&p_event->cond, &cond_attr);
-    assert(stat == 0);
-
-    p_event->man_reset_flag = man_reset_flag;
-    p_event->state = initial_state_flag;
-    p_event->n_wait = 0;
-
-    return (VmEventHandle)p_event;
-}
-
-BOOL vm_destroy_event(VmEventHandle hEvent)
-{
-    struct timespec ts;
-    event_wrapper *p_event = (event_wrapper *)hEvent;
-
-    int xx = pthread_mutex_lock(&p_event->mutex);
-    assert(xx == 0);
-    // no threads in the wait set
-    if (p_event->n_wait == 0) goto success;
-
-    // no chance to release waited threads
-    if (p_event->state == 0) goto fail;
-
-    if (p_event->man_reset_flag == 0) {
-        // event is in automatic state so not more than one thread can be released
-        if (p_event->n_wait > 1) goto fail;
-        p_event->man_reset_flag = 1;
-    }
-
-    init_timespec(ts, 1000);
-
-    do {
-        int stat = pthread_cond_timedwait(&p_event->cond, &p_event->mutex, &ts);
-        assert(stat != EINVAL);
-        // ensure that the stat is still signaling
-        if (stat == ETIMEDOUT && p_event->state == 0 && p_event->n_wait != 0)
-            goto fail;
-    } while (p_event->n_wait != 0);
-
-success:
-    xx = pthread_mutex_unlock(&p_event->mutex);
-    assert(xx == 0);
-    STD_FREE(p_event);
-    return 1;
-
-fail:
-    xx = pthread_mutex_unlock(&p_event->mutex);
-    assert(xx == 0);
-    return 0;
-}
-
-BOOL vm_reset_event(VmEventHandle hEvent)
-{
-  event_wrapper *p_event = (event_wrapper *)hEvent;
-
-  assert(p_event);
-  int xx = pthread_mutex_lock(&p_event->mutex);
-  assert(xx == 0);
-  p_event->state = 0;
-  xx = pthread_mutex_unlock(&p_event->mutex);
-  assert(xx == 0);
-  return 1;
-}
-
-
-BOOL vm_set_event(VmEventHandle hEvent)
-{
-  event_wrapper *p_event = (event_wrapper *)hEvent;
-
-  assert(p_event);
-  int stat = pthread_mutex_lock(&p_event->mutex);
-  assert(stat == 0);
-
-  p_event->state = 1;
-
-  stat = pthread_cond_broadcast(&p_event->cond);
-  assert(stat == 0);
-
-  stat = pthread_mutex_unlock(&p_event->mutex);
-  assert(stat == 0);
-  return 1;
-}
-
-void vm_yield() {
-    sched_yield();
-}
-
-DWORD vm_wait_for_single_object(VmEventHandle hHandle, DWORD dwMillisec)
-{
-  if (dwMillisec < 10)
-    return WAIT_TIMEOUT;
-
-  struct timespec ts;
-  init_timespec(ts, dwMillisec);
-
-  event_wrapper *p_event = (event_wrapper *)hHandle;
-  assert(p_event);
-
-  int stat = pthread_mutex_lock(&p_event->mutex);
-  assert(stat == 0);
-
-  int wait_status = WAIT_OBJECT_0;
-
-  while (1)
-    {
-      if (p_event->state != 0)
-          break;
-      
-      ++p_event->n_wait;
-      wait_status = pthread_cond_timedwait(&p_event->cond, 
-                                           &p_event->mutex,
-                                           &ts );
-      --p_event->n_wait;
-
-      assert(wait_status != EINVAL);
-      if (wait_status == ETIMEDOUT)
-        break;
-      if (wait_status == 0)
-        break;
-    }
-
-  if (p_event->man_reset_flag == 0)
-      p_event->state = 0;
-
-  stat = pthread_mutex_unlock(&p_event->mutex);
-  assert(stat == 0);
-
-  if (wait_status == ETIMEDOUT)
-    return WAIT_TIMEOUT;
-
-  if (wait_status == 0)
-      return WAIT_OBJECT_0;
-
-  return WAIT_TIMEOUT;  
-}
-
-DWORD vm_wait_for_multiple_objects(DWORD numobj, const VmEventHandle *hHandle, BOOL waitAll, DWORD dwMillisec)
-{
-    DWORD ret = 0;
-    assert(waitAll);
-    assert(dwMillisec == INFINITE);
-    
-    for(unsigned int i = 0; i < numobj; i++) {
-        ret = vm_wait_for_single_object((VmEventHandle)hHandle[i], dwMillisec);
-        if (ret != WAIT_OBJECT_0)
-            return ret;
-    }
-    return ret;
-}
-
-void Sleep(DWORD msec)
-{
-  if (msec < 1000){
-    sched_yield();
-    return;
-  }
-
-  unsigned int zz = msec/1000;
-
-  sleep(zz);
-
-}
-
-
-void SleepEx(DWORD time, bool UNREF bb)
-{
-  Sleep(time);
-}
-
-void vm_endthreadex(int UNREF zz)
-{
-    // on linux, this is a nop,
-    // call_the_run_method() simply returns into the linux kernel
-}
-
-void vm_endthread(void )
-{
-    // on linux, this is a nop,
-    // call_the_run_method() simply returns into the linux kernel
-}
-
-/****************************************
- *  Moved from stubs.h
- *  Some function need to be implemented
- ****************************************/
- 
-pthread_t GetCurrentThreadId (void)
-{
-    return pthread_self();
-}
-
-/*
- * Need to implement (?)
- */
-BOOL DuplicateHandle(VmEventHandle UNREF aa, VmEventHandle UNREF bb, 
-                     VmEventHandle UNREF cc, VmEventHandle * UNREF dd,
-                     DWORD UNREF ee, BOOL UNREF ff, DWORD UNREF gg)
-{
-  return TRUE;
-}
-
-/*
- * Need to implement (?)
- */
-VmEventHandle GetCurrentProcess(void)
-{
-  return 0;
-}
-
-/*
- * Need to implement (?)
- */
-VmEventHandle GetCurrentThread(void)
-{
-  return 0;
-}

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp Wed Aug 23 09:48:41 2006
@@ -231,8 +231,9 @@
 }
 
 /*
+ * MOVED TO PORT, DO NOT USE USR2
  * USR2 signal used to yield the thread at suspend algorithm
- */ 
+ * 
  
 void yield_other_handler(int signum, siginfo_t* info, void* context) {
 
@@ -263,7 +264,7 @@
 
     DIE("Cannot find Java thread using signal context");
 }
-
+*/
 
 /*
 See function initialize_signals() below first please.
@@ -373,12 +374,14 @@
     //behaviour, which is different from BSD. But glibc2 in Linux
     //implements BSD semantics.
     struct sigaction sa;
+/*
+ * MOVED TO PORT, DO NOT USE USR2
 
     sigemptyset(&sa.sa_mask);
     sa.sa_flags = SA_SIGINFO | SA_RESTART;
     sa.sa_sigaction = yield_other_handler;
     sigaction(SIGUSR2, &sa, NULL);
-
+*/
     sigemptyset(&sa.sa_mask);
     sa.sa_flags = SA_SIGINFO;
     sa.sa_sigaction = &null_java_reference_handler;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp Wed Aug 23 09:48:41 2006
@@ -74,9 +74,6 @@
 static int sc_nest = -1;
 static uint32 exam_point;
 
-bool SuspendThread(unsigned UNREF xx){ return 0; }
-bool ResumeThread(unsigned UNREF xx){ return 1; }
-
 static void linux_sigcontext_to_regs(Registers* regs, ucontext_t *uc)
 {
     regs->eax = uc->uc_mcontext.gregs[REG_EAX];
@@ -351,8 +348,8 @@
         return;
     } else {
         if (is_unwindable()) {
-            if (tmn_is_suspend_enabled()) {
-                tmn_suspend_disable();
+            if (hythread_is_suspend_enabled()) {
+                hythread_suspend_disable();
             }
             throw_from_sigcontext(
                 uc, env->java_lang_StackOverflowError_Class);
@@ -503,10 +500,13 @@
 }
 
 /*
+ * MOVED TO PORT, DO NOT USE USR2
  * USR2 signal used to yield the thread at suspend algorithm
- */ 
+ * 
  
 void yield_other_handler(int signum, siginfo_t* info, void* context) {
+    // FIXME: integration, should be moved to port or OpenTM
+    
     Global_Env *env = VM_Global_State::loader_env;
     if (env->shutting_down != 0) {
         // Too late for this kind of signals
@@ -535,8 +535,9 @@
     }
 
     DIE("Cannot find Java thread using signal context");
-}
 
+}
+*/
 void initialize_signals()
 {
     // First figure out how to locate the context in the
@@ -548,12 +549,14 @@
     //behaviour, which is different from BSD. But glibc2 in Linux
     //implements BSD semantics.
     struct sigaction sa;
+/*
+ * MOVED TO PORT, DO NOT USE USR2
 
     sigemptyset(&sa.sa_mask);
     sa.sa_flags = SA_SIGINFO | SA_RESTART;
     sa.sa_sigaction = yield_other_handler;
     sigaction(SIGUSR2, &sa, NULL);
-
+*/
     sigemptyset(&sa.sa_mask);
     sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
     sa.sa_sigaction = &null_java_reference_handler;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/stubs.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/stubs.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/stubs.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/stubs.cpp Wed Aug 23 09:48:41 2006
@@ -28,14 +28,6 @@
 #include "method_lookup.h"
 #include "open/gc.h"
 
-// void vm_thread_enumerate_from_native(VM_thread *thread); // unused anywhere
-
-BOOL port_CloseHandle(VmEventHandle UNREF hh)
-{
-    ABORT("Not implemented");
-    return 0;
-}
-
 //wgs: I wonder if we could give it a errno
 #if defined (__INTEL_COMPILER) 
 #pragma warning( push )
@@ -65,23 +57,7 @@
     ABORT("Not implemented");
 }
 
-BOOL GetThreadContext(VmThreadHandle UNREF hthread, const CONTEXT * UNREF lpcontext)
-{
-  ABORT("Not implemented");
-  return 0;
-}
 
-BOOL SetThreadContext(VmThreadHandle UNREF hh, const CONTEXT * UNREF cc)
-{
-  ABORT("Not implemented");
-  return 0;
-}
-
-int VM_thread::setPriority(int UNREF priority)
-{
-    ABORT("Not implemented");
-    return 0;
-}
 
 #include <sys/time.h>
 __uint64 GetTickCount(void)
@@ -101,33 +77,8 @@
     }
 }
 
-CriticalSection::CriticalSection()
-{
-    m_cs = (void *) new CRITICAL_SECTION;
-    InitializeCriticalSection((CRITICAL_SECTION *)m_cs);
-}
-
-CriticalSection::~CriticalSection()
-{
-    DeleteCriticalSection((CRITICAL_SECTION *)m_cs);
-    delete (CRITICAL_SECTION *)m_cs;
-}
-
-void CriticalSection::lock()
-{
-    EnterCriticalSection((CRITICAL_SECTION *)m_cs);
-}
-
-void CriticalSection::unlock()
-{
-    LeaveCriticalSection((CRITICAL_SECTION *)m_cs);
-}
-
-bool CriticalSection::tryLock()
-{
-    return TryEnterCriticalSection((CRITICAL_SECTION *)m_cs) ? true : false;
-}
-
+/* TODO reimplement this code while implementing IPF support.
+ 
 VmRegisterContext::VmRegisterContext()
 {
     CONTEXT *ctx = new CONTEXT;
@@ -161,6 +112,7 @@
     ((CONTEXT *)_pcontext)->ContextFlags = old;
 }
 
+
 void VmRegisterContext::getContext(VM_thread *thread)
 {
     CONTEXT *ctx = (CONTEXT *) _pcontext;
@@ -250,3 +202,4 @@
     ABORT("Not supported"); // shouldn't be called under IA-32
 #endif // !_IPF_
 }
+*/

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/natives_support.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/natives_support.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/natives_support.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/natives_support.cpp Wed Aug 23 09:48:41 2006
@@ -33,7 +33,7 @@
 #include "lock_manager.h"
 #include "jni_direct.h" // FIXME ???? Can we use it here ????
 #include "open/vm_util.h"
-#include "open/thread.h"
+
 #include "jni_types.h"
 
 #define LOG_DOMAIN "natives"
@@ -113,7 +113,7 @@
 
         JavaVM* vm = jni_native_intf->vm; // FIXME ???? Can we use it here ????
 
-        assert(tmn_is_suspend_enabled());
+        assert(hythread_is_suspend_enabled());
         jint res = onload_func(vm, NULL);
 
         return res;
@@ -150,7 +150,7 @@
 
         JavaVM* vm = jni_native_intf->vm; // FIXME ???? Can we use it here ????
 
-        assert(tmn_is_suspend_enabled());
+        assert(hythread_is_suspend_enabled());
         onunload_func(vm, NULL);
         return;
     }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_strings.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_strings.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_strings.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_strings.cpp Wed Aug 23 09:48:41 2006
@@ -232,7 +232,7 @@
 // Return: str gets the string object, buf points to buffer
 static void string_create(unsigned unicode_length, bool eight_bit, ManagedObject** str, StringBuffer* buf)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     Global_Env *global_env = VM_Global_State::loader_env;
     Class *clss;
@@ -256,7 +256,7 @@
 
     VTable *jls_vtable = VM_Global_State::loader_env->JavaLangString_VTable;
 
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     GcFrame gc(2);
     gc.add_object((ManagedObject**)&array);
 
@@ -330,7 +330,7 @@
 
 ObjectHandle string_create_from_utf8_h(const char* buf, unsigned length)
 {
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     tmn_suspend_disable();
     ObjectHandle res = oh_allocate_local_handle();
     res->object = string_create_from_utf8(buf, length);
@@ -340,7 +340,7 @@
 
 ObjectHandle string_create_from_unicode_h(const uint16* buf, unsigned length)
 {
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     tmn_suspend_disable();
     ObjectHandle res = oh_allocate_local_handle();
     res->object = string_create_from_unicode(buf, length);
@@ -355,7 +355,7 @@
 // returns length in characters
 unsigned string_get_length(ManagedObject* str)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     assert(str);
 
     if (f_count_offset == 0) init_fields();
@@ -366,7 +366,7 @@
 // returns length in characters
 unsigned string_get_length_h(ObjectHandle str)
 {
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     tmn_suspend_disable();
     assert(str && str->object);
     unsigned len = string_get_length(str->object);
@@ -390,7 +390,7 @@
 // returns the length of the UTF8 encoding of the string
 unsigned string_get_utf8_length_h(ObjectHandle str)
 {
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     tmn_suspend_disable();
     assert(str && str->object);
     unsigned utf8_len = string_get_utf8_length(str->object);
@@ -473,7 +473,7 @@
 // Caller should free the result
 const char* string_get_utf8_chars_h(ObjectHandle string)
 {
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     tmn_suspend_disable();
     assert(string && string->object);
     const char* res = string_get_utf8_chars(string->object);
@@ -497,7 +497,7 @@
 // Copy the characters offset..offset+count-1 into buf
 void string_get_unicode_region_h(ObjectHandle str, unsigned offset, unsigned count, uint16* buf)
 {
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     tmn_suspend_disable();
     assert(str && str->object && offset+count<=string_get_length(str->object));
     string_get_unicode_region(str->object, offset, count, buf);
@@ -519,7 +519,7 @@
 // Encode characters offset..offset+count-1 into UTF8 and place in buf
 void string_get_utf8_region_h(ObjectHandle str, unsigned offset, unsigned count, char* buf)
 {
-    assert(tmn_is_suspend_enabled());
+    assert(hythread_is_suspend_enabled());
     tmn_suspend_disable();
     assert(str && str->object && offset+count<=string_get_length(str->object));
     string_get_utf8_region(str->object, offset, count, buf);
@@ -534,7 +534,7 @@
 VMEXPORT // temporary solution for interpreter unplug
 Java_java_lang_String *vm_instantiate_cp_string_resolved(String *str)
 {
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     Global_Env *env = VM_Global_State::loader_env;
     if (env->compress_references) {
         if (str->intern.compressed_ref != 0) {
@@ -550,7 +550,7 @@
     if (!lang_string) { // if OutOfMemory
         return NULL;
     }
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     // Atomically update the string structure since some other thread might be trying to make the same update.
     // The GC won't be able to enumerate here since GC is disabled, so there are no race conditions with GC.

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp Wed Aug 23 09:48:41 2006
@@ -36,7 +36,7 @@
 #include "exception_filter.h"
 
 #include "thread_generic.h"
-#include "open/thread.h"
+
 
 
 // Afremov Pavel 20050117
@@ -63,7 +63,7 @@
     }
 
     // since we are now sure NPE occured in java code, gc should also have been disabled
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
 
     
     volatile ManagedObject *exc = 0;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp Wed Aug 23 09:48:41 2006
@@ -18,11 +18,8 @@
  * @version $Revision: 1.1.2.1.4.4 $
  */  
 
-
 #include "cxxlog.h"
 #include "method_lookup.h"
-#include "m2n.h"
-#include "open/thread.h"
 #include "Environment.h"
 #include "exceptions.h"
 
@@ -320,8 +317,8 @@
             run_default_handler = false;
         } else if (code == STATUS_STACK_OVERFLOW) {
             if (is_unwindable()) {
-                if (tmn_is_suspend_enabled()) {
-                    tmn_suspend_disable();
+                if (hythread_is_suspend_enabled()) {
+                    hythread_suspend_disable();
                 }
                 run_default_handler = false;
             } else {
@@ -388,7 +385,7 @@
     }
 
     // since we are now sure HWE occured in java code, gc should also have been disabled
-    assert(!tmn_is_suspend_enabled());
+    assert(!hythread_is_suspend_enabled());
     
     Global_Env *env = VM_Global_State::loader_env;
     Class *exc_clss = 0;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/java_lang_thread_nt.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/java_lang_thread_nt.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/java_lang_thread_nt.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/java_lang_thread_nt.h Wed Aug 23 09:48:41 2006
@@ -28,23 +28,3 @@
 #define J_V_M_T_I_E_H NULL
 #define E_H_RECOMP NULL
 
-#define OS_THREAD_INIT_1()
-
-#define OS_SYNC_SUPPORT()
-
-
-#define OS_THREAD_INIT_2() \
-    p_TLS_vmthread = p_vm_thread; 
-
-
-#define THREAD_CLEANUP() 
-
-#define BEGINTHREADEX_SUSPENDSTATE 1
-
-#define SET_THREAD_DATA_MACRO()
-
-    
-#define THREAD_ACTIVE_IN_OS_MACRO()
-
-#define CHECK_HIJACK_SUPPORT_MACRO()
-

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/platform.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/platform.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/platform.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/platform.h Wed Aug 23 09:48:41 2006
@@ -26,8 +26,6 @@
 
 typedef unsigned long DWORD;
 typedef int BOOL;
-typedef void *VmEventHandle;
-typedef VmEventHandle VmThreadHandle;
 
 #ifndef FMT64
 #define FMT64 "I64"

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/platform_lowlevel.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/platform_lowlevel.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/platform_lowlevel.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/platform_lowlevel.h Wed Aug 23 09:48:41 2006
@@ -40,37 +40,6 @@
 
 #include "platform.h"
 
-// moved from util_log.h, there should be better place for this definition.
-
-typedef unsigned pthread_t; // see documentation on _beginthread
-typedef CRITICAL_SECTION pthread_mutex_t;
-typedef struct pthread_mutexattr_t pthread_mutexattr_t;
-typedef void *sem_t;
-
-inline pthread_t pthread_self() {
-    return GetCurrentThreadId();
-}
-
-inline int pthread_mutex_init (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) { 
-    InitializeCriticalSection(mutex);
-    return 0; 
-}
-
-inline int pthread_mutex_destroy (pthread_mutex_t *mutex) {
-    DeleteCriticalSection(mutex);
-    return 0;
-}
-
-inline int pthread_mutex_lock (pthread_mutex_t *mutex) {
-    EnterCriticalSection(mutex);
-    return 0;
-}
-
-inline int pthread_mutex_unlock (pthread_mutex_t *mutex) {
-    LeaveCriticalSection(mutex);
-    return 0;
-}
-
 inline void disable_assert_dialogs() {
     _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
     _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);
@@ -94,28 +63,5 @@
     long tv_sec;
     long tv_nsec;
 };
-
-inline int sem_init(sem_t *semaphore, int pshared, unsigned int value) {
-    *semaphore = CreateSemaphore(NULL, value, INFINITE, NULL);
-    return 0;
-}
-
-inline int sem_destroy(sem_t *sem) {
-    return CloseHandle(*sem);
-}
-
-inline int sem_post(sem_t *semaphore) {
-    return ReleaseSemaphore(*semaphore, 1, NULL);
-}
-
-inline int sem_wait(sem_t *semaphore) {
-    return WaitForSingleObject(*semaphore, INFINITE);
-}
-
-inline int sem_timedwait(sem_t *semaphore,
-               const struct timespec *abs_timeout) {
-    return WaitForSingleObject(*semaphore, abs_timeout->tv_sec*1000);
-}
-
 
 #endif // _platform_lowlevel_H_

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/vm_process.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/vm_process.h?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/vm_process.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/vm_process.h Wed Aug 23 09:48:41 2006
@@ -35,68 +35,8 @@
 #include <windows.h>
 #include <assert.h>
 
-inline VmEventHandle vm_beginthreadex( void * security, unsigned stack_size, unsigned(__stdcall *start_address)(void *), void *arglist, unsigned initflag, pthread_t *thrdaddr)
-{
-    return (VmEventHandle) _beginthreadex(security, stack_size, start_address, arglist, initflag, thrdaddr);
-}
 
-inline void vm_endthreadex(int value)
-{
-    _endthreadex(value);
-}
-
-inline VmEventHandle vm_beginthread(void(__cdecl *start_address)(void *), unsigned stack_size, void *arglist)
-{
-    uintptr_t result = _beginthread(start_address, stack_size, arglist);
-    // on windows error code is -1 !!!
-    if (result == -1L)
-        return NULL;
-
-    return (VmEventHandle) result;
-}
-
-inline void vm_endthread(void)
-{
-    _endthread();
-}
-
-inline VmEventHandle vm_create_event(int *lpEventAttributes, unsigned int bManualReset, unsigned int bInitialState, char *lpName)
-{
-    assert(lpEventAttributes == NULL);
-    return CreateEvent(NULL, bManualReset, bInitialState, lpName);
-}
-
-inline BOOL vm_destroy_event( VmEventHandle handle )
-{
-    assert( handle != INVALID_HANDLE_VALUE );
-    return CloseHandle( handle ) == FALSE ? 0 : 1;
-}
-
-inline BOOL vm_reset_event(VmEventHandle hEvent)
-{
-    return ResetEvent(hEvent);
-}
-
-inline BOOL vm_set_event(VmEventHandle hEvent)
-{
-    return SetEvent(hEvent);
-}
-
-inline void vm_yield() {
-    Sleep(0);
-}
-
-inline DWORD vm_wait_for_single_object(VmEventHandle hHandle, DWORD dwMilliseconds)
-{
-    return WaitForSingleObject(hHandle, dwMilliseconds);
-}
-
-inline DWORD vm_wait_for_multiple_objects(DWORD num, const VmEventHandle * handle, BOOL flag, DWORD dwMilliseconds)
-{
-    return WaitForMultipleObjects(num, handle, flag, dwMilliseconds);
-}
-
-inline void vm_terminate_thread(VmThreadHandle thrdaddr) {
+/*inline void vm_terminate_thread(VmThreadHandle thrdaddr) {
     TerminateThread(thrdaddr,0);    
-}
+}*/
 #endif

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ipf/nt_exception_filter.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ipf/nt_exception_filter.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ipf/nt_exception_filter.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ipf/nt_exception_filter.cpp Wed Aug 23 09:48:41 2006
@@ -17,10 +17,6 @@
  * @author Intel, Evgueni Brevnov
  * @version $Revision: 1.1.2.1.4.3 $
  */  
-
-#define LOG_DOMAIN "vm.exn_filter"
-#include "cxxlog.h"
-
 #include "platform_lowlevel.h"
 
 #include "Class.h"
@@ -33,7 +29,7 @@
 #include "open/vm_util.h"
 #include "compile.h"
 #include "../../../arch/ipf/include/vm_ipf.h"
-#include "open/thread.h"
+
 
 #include "exception_filter.h"
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/nt_platform_utils.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/nt_platform_utils.cpp?rev=434076&r1=434075&r2=434076&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/nt_platform_utils.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/nt_platform_utils.cpp Wed Aug 23 09:48:41 2006
@@ -199,33 +199,6 @@
 }
 
 
-CriticalSection::CriticalSection()
-{
-    m_cs = (void *) new CRITICAL_SECTION;
-    InitializeCriticalSection((CRITICAL_SECTION *)m_cs);
-}
-
-CriticalSection::~CriticalSection()
-{
-    DeleteCriticalSection((CRITICAL_SECTION *)m_cs);
-    delete (CRITICAL_SECTION *)m_cs;
-}
-
-void CriticalSection::lock()
-{
-    EnterCriticalSection((CRITICAL_SECTION *)m_cs);
-}
-
-void CriticalSection::unlock()
-{
-    LeaveCriticalSection((CRITICAL_SECTION *)m_cs);
-}
-
-bool CriticalSection::tryLock()
-{
-    return TryEnterCriticalSection((CRITICAL_SECTION *)m_cs) ? true : false;
-}
-
 VmRegisterContext::VmRegisterContext()
 {
     CONTEXT *ctx = new CONTEXT;
@@ -259,6 +232,7 @@
     ((CONTEXT *)_pcontext)->ContextFlags = old;
 }
 
+/*  FIXME integration uncomment and fix
 void VmRegisterContext::getContext(VM_thread *thread)
 {
     CONTEXT *ctx = (CONTEXT *) _pcontext;
@@ -354,4 +328,4 @@
 {
     return SetThreadPriority(thread_handle, priority);
 }
-
+*/