You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2008/03/18 12:31:10 UTC

svn commit: r638327 [3/5] - in /harmony/enhanced/drlvm/trunk: make/vm/ vm/em/src/ vm/gc_gen/src/common/ vm/include/open/ vm/interpreter/src/ vm/port/include/ vm/port/src/crash_handler/ vm/port/src/crash_handler/em64t/ vm/port/src/crash_handler/ia32/ vm...

Added: harmony/enhanced/drlvm/trunk/vm/port/src/signals/port_signals.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/signals/port_signals.cpp?rev=638327&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/signals/port_signals.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/signals/port_signals.cpp Tue Mar 18 04:31:02 2008
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ */
+
+
+#include "port_crash_handler.h"
+#include "port_memaccess.h"
+#include "signals_internal.h"
+
+
+int port_set_breakpoint(void* addr, unsigned char* prev)
+{
+    if (!addr || !prev)
+        return -1;
+
+    unsigned char instr = INSTRUMENTATION_BYTE;
+
+    if (port_read_memory(addr, 1, prev) != 0)
+        return -1;
+
+    return port_write_memory(addr, 1, &instr);
+}
+
+int port_clear_breakpoint(void* addr, unsigned char prev)
+{
+    if (!addr)
+        return -1;
+
+    return port_write_memory(addr, 1, &prev);
+}
+
+Boolean port_is_breakpoint_set(void* addr)
+{
+    unsigned char byte;
+
+    if (port_read_memory(addr, 1, &byte) != 0)
+        return FALSE;
+
+    return (byte == INSTRUMENTATION_BYTE);
+}
+

Propchange: harmony/enhanced/drlvm/trunk/vm/port/src/signals/port_signals.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_common.cpp?rev=638327&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_common.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_common.cpp Tue Mar 18 04:31:02 2008
@@ -0,0 +1,265 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ */
+
+
+#include <crtdbg.h>
+#include "open/platform_types.h"
+#include "open/hythread_ext.h"
+#include "port_malloc.h"
+
+#include "port_crash_handler.h"
+#include "stack_dump.h"
+#include "signals_internal.h"
+
+
+#if INSTRUMENTATION_BYTE == INSTRUMENTATION_BYTE_INT3
+#define JVMTI_EXCEPTION_STATUS STATUS_BREAKPOINT
+#elif INSTRUMENTATION_BYTE == INSTRUMENTATION_BYTE_HLT || INSTRUMENTATION_BYTE == INSTRUMENTATION_BYTE_CLI
+#define JVMTI_EXCEPTION_STATUS STATUS_PRIVILEGED_INSTRUCTION
+#else
+#error Unknown value of INSTRUMENTATION_BYTE
+#endif
+
+
+port_tls_key_t port_tls_key = TLS_OUT_OF_INDEXES;
+
+int init_private_tls_data()
+{
+    DWORD key = TlsAlloc();
+
+    if (key == TLS_OUT_OF_INDEXES)
+        return -1;
+
+    port_tls_key = key;
+    return 0;
+}
+
+int free_private_tls_data()
+{
+    return TlsFree(port_tls_key) ? 0 : -1;
+}
+
+
+static void c_handler(Registers* pregs,
+                        void* fault_addr, size_t code, size_t flags)
+{ // this exception handler is executed *after* VEH handler returned
+    int result;
+    Registers regs = *pregs;
+    Boolean iscrash = (DWORD)flags == EXCEPTION_NONCONTINUABLE;
+
+    switch ((DWORD)code)
+    {
+    case STATUS_STACK_OVERFLOW:
+        result = port_process_signal(PORT_SIGNAL_STACK_OVERFLOW, pregs, fault_addr, iscrash);
+        break;
+    case STATUS_ACCESS_VIOLATION:
+        result = port_process_signal(PORT_SIGNAL_GPF, pregs, fault_addr, iscrash);
+        break;
+    case STATUS_INTEGER_DIVIDE_BY_ZERO:
+        result = port_process_signal(PORT_SIGNAL_ARITHMETIC, pregs, fault_addr, iscrash);
+        break;
+    case JVMTI_EXCEPTION_STATUS:
+        result = port_process_signal(PORT_SIGNAL_BREAKPOINT, pregs, fault_addr, iscrash);
+        break;
+    default:
+        result = port_process_signal(PORT_SIGNAL_UNKNOWN, pregs, fault_addr, TRUE);
+    }
+
+    if (result == 0)
+        return;
+
+    if (result > 0 || // Assert dialog
+        (port_crash_handler_get_flags() & PORT_CRASH_DUMP_PROCESS_CORE) != 0)
+    {
+        // Prepare second catch of this exception to produce minidump (because
+        // we've lost LPEXCEPTION_POINTERS structure) and/or show assert dialog
+        // FIXME: This will not work for stack overflow, because guard page
+        // is disabled automatically - need to restore it somehow
+        port_tls_data* tlsdata = get_private_tls_data();
+        if (!tlsdata)
+        {   // STD_MALLOC can be harmful here
+            tlsdata = (port_tls_data*)STD_MALLOC(sizeof(port_tls_data));
+            memset(tlsdata, 0, sizeof(port_tls_data));
+            set_private_tls_data(tlsdata);
+        }
+
+        if ((port_crash_handler_get_flags() & PORT_CRASH_DUMP_PROCESS_CORE) != 0)
+            tlsdata->produce_core = TRUE;
+        if (result > 0)
+            tlsdata->assert_dialog = TRUE;
+
+        return; // To produce exception again
+    }
+
+    ExitProcess((UINT)-1);
+}
+
+void prepare_assert_dialog(Registers* regs)
+{
+    shutdown_signals();
+}
+
+LONG NTAPI vectored_exception_handler_internal(LPEXCEPTION_POINTERS nt_exception)
+{
+    Registers regs;
+    // Convert NT context to Registers
+    port_thread_context_to_regs(&regs, nt_exception->ContextRecord);
+
+    // Check if TLS structure is set - probably we should produce minidump
+    port_tls_data* tlsdata = get_private_tls_data();
+
+    if (tlsdata)
+    {
+        if (tlsdata->produce_core)
+        {
+            tlsdata->produce_core = FALSE;
+            create_minidump(nt_exception);
+            if (!tlsdata->assert_dialog)
+                ExitProcess((UINT)-1);
+        }
+
+        if (tlsdata->assert_dialog)
+        {
+            // Go to handler to restore CRT/VEH settings and crash once again
+            port_set_longjump_regs(&prepare_assert_dialog, &regs, 1, &regs);
+            port_thread_regs_to_context(nt_exception->ContextRecord, &regs);
+            return EXCEPTION_CONTINUE_EXECUTION;
+        }
+    }
+
+    switch (nt_exception->ExceptionRecord->ExceptionCode)
+    {
+    case STATUS_STACK_OVERFLOW:
+    case STATUS_ACCESS_VIOLATION:
+    case STATUS_INTEGER_DIVIDE_BY_ZERO:
+    case JVMTI_EXCEPTION_STATUS:
+    case EXCEPTION_DATATYPE_MISALIGNMENT:
+    case EXCEPTION_ILLEGAL_INSTRUCTION:
+    case EXCEPTION_PRIV_INSTRUCTION:
+    case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+    case EXCEPTION_FLT_OVERFLOW:
+    case EXCEPTION_FLT_UNDERFLOW:
+    case EXCEPTION_INT_OVERFLOW:
+        break;
+    default:
+        return EXCEPTION_CONTINUE_SEARCH;
+    }
+
+    // Prepare to transfering control out of VEH handler
+    port_set_longjump_regs(&c_handler, &regs, 4, &regs,
+        nt_exception->ExceptionRecord->ExceptionAddress,
+        (void*)(size_t)nt_exception->ExceptionRecord->ExceptionCode,
+        (void*)(size_t)nt_exception->ExceptionRecord->ExceptionFlags);
+    // Convert prepared Registers back to NT context
+    port_thread_regs_to_context(nt_exception->ContextRecord, &regs);
+    // Return from VEH - presumably continue execution
+    return EXCEPTION_CONTINUE_EXECUTION;
+}
+
+BOOL ctrl_handler(DWORD ctrlType)
+{
+    int result = 0;
+
+    switch (ctrlType)
+    {
+    case CTRL_BREAK_EVENT:
+        result = port_process_signal(PORT_SIGNAL_CTRL_BREAK, NULL, NULL, FALSE);
+        if (result == 0)
+            return TRUE;
+        else
+            return FALSE;
+
+    case CTRL_C_EVENT:
+    case CTRL_CLOSE_EVENT:
+    case CTRL_LOGOFF_EVENT:
+    case CTRL_SHUTDOWN_EVENT:
+        result = port_process_signal(PORT_SIGNAL_CTRL_C, NULL, NULL, FALSE);
+        if (result == 0)
+            return TRUE;
+        else
+            return FALSE;
+    }
+
+    return FALSE;
+}
+
+static int report_modes[4];
+static _HFILE report_files[3];
+
+static void disable_assert_dialogs()
+{
+#ifdef _DEBUG
+    report_modes[0] = _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
+    report_files[0] = _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+    report_modes[1] = _CrtSetReportMode(_CRT_ERROR,  _CRTDBG_MODE_FILE);
+    report_files[1] = _CrtSetReportFile(_CRT_ERROR,  _CRTDBG_FILE_STDERR);
+    report_modes[2] = _CrtSetReportMode(_CRT_WARN,   _CRTDBG_MODE_FILE);
+    report_files[2] = _CrtSetReportFile(_CRT_WARN,   _CRTDBG_FILE_STDERR);
+    report_modes[3] = _set_error_mode(_OUT_TO_STDERR);
+#endif // _DEBUG
+}
+
+static void restore_assert_dialogs()
+{
+#ifdef _DEBUG
+    _CrtSetReportMode(_CRT_ASSERT, report_modes[0]);
+    _CrtSetReportFile(_CRT_ASSERT, report_files[0]);
+    _CrtSetReportMode(_CRT_ERROR,  report_modes[1]);
+    _CrtSetReportFile(_CRT_ERROR,  report_files[1]);
+    _CrtSetReportMode(_CRT_WARN,   report_modes[2]);
+    _CrtSetReportFile(_CRT_WARN,   report_files[2]);
+    _set_error_mode(report_modes[3]);
+#endif // _DEBUG
+}
+
+static PVOID veh = NULL;
+
+int initialize_signals()
+{
+    BOOL ok = SetConsoleCtrlHandler((PHANDLER_ROUTINE)ctrl_handler, TRUE);
+
+    if (!ok)
+        return -1;
+
+    // Adding vectored exception handler
+    veh = AddVectoredExceptionHandler(0, vectored_exception_handler);
+
+    if (!veh)
+        return -1;
+
+    disable_assert_dialogs();
+
+    return 0;
+}
+
+int shutdown_signals()
+{
+    ULONG res;
+    res = RemoveVectoredExceptionHandler(veh);
+
+    if (!res)
+        return -1;
+
+    BOOL ok = SetConsoleCtrlHandler((PHANDLER_ROUTINE)ctrl_handler, FALSE);
+
+    if (!ok)
+        return -1;
+
+    restore_assert_dialogs();
+
+    return 0;
+} //shutdown_signals

Propchange: harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_common.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_ia32.cpp (from r637971, harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp)
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_ia32.cpp?p2=harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_ia32.cpp&p1=harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp&r1=637971&r2=638327&rev=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/signals/win/signals_ia32.cpp Tue Mar 18 04:31:02 2008
@@ -15,9 +15,7 @@
  *  limitations under the License.
  */
 
-#include "platform_lowlevel.h"
-#include "exceptions_jit.h"
-#include "exception_filter.h"
+#include "signals_internal.h"
 
 
 LONG __declspec(naked) NTAPI vectored_exception_handler(LPEXCEPTION_POINTERS nt_exception)

Modified: harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_native_fat_monitor.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_native_fat_monitor.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_native_fat_monitor.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_native_fat_monitor.c Tue Mar 18 04:31:02 2008
@@ -23,7 +23,7 @@
 #define NMB 5
 
 hythread_monitor_t monitor;
-hymutex_t *mutex;
+osmutex_t *mutex;
 hycond_t  *condvar;
 int waiting_count;
 

Modified: harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_stress_suspend.h Tue Mar 18 04:31:02 2008
@@ -20,6 +20,7 @@
 #include <open/hythread_ext.h>
 #include <apr_atomic.h>
 #include <open/types.h>
+#include "port_mutex.h"
 #include "thread_manager.h"
 #include "testframe.h"
 #include "thread_unit_test_utils.h"
@@ -48,8 +49,8 @@
 
 static hylatch_t wait_threads;
 static hylatch_t start;
-static hymutex_t gc_lock;
-static hymutex_t suspend_lock;
+static osmutex_t gc_lock;
+static osmutex_t suspend_lock;
 static char stop = 0;
 static char failed = 0;
 static uint64 cycle_count = 0;
@@ -80,7 +81,7 @@
     tf_exp_assert(status == TM_ERROR_NONE);
     status = hylatch_create(&start, 1);
     tf_exp_assert(status == TM_ERROR_NONE);
-    status = hymutex_create(&gc_lock, TM_MUTEX_NESTED);
+    status = port_mutex_create(&gc_lock, APR_THREAD_MUTEX_NESTED);
     tf_exp_assert(status == TM_ERROR_NONE);
 
     // start tested thread
@@ -333,13 +334,13 @@
 
         count = cycle_count;
 
-        status = hymutex_lock(&gc_lock);
+        status = port_mutex_lock(&gc_lock);
         tf_exp_assert(status == TM_ERROR_NONE);
 
         test_requestor_heap_access();
         tf_exp_assert(status == TM_ERROR_NONE);
 
-        status = hymutex_unlock(&gc_lock);
+        status = port_mutex_unlock(&gc_lock);
         tf_exp_assert(status == TM_ERROR_NONE);
 
         xx += test_waste_time(RAND());

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def Tue Mar 18 04:31:02 2008
@@ -122,11 +122,6 @@
 hysem_wait_interruptable
 hysem_getvalue
 hysem_set
-hymutex_create
-hymutex_lock
-hymutex_trylock
-hymutex_unlock
-hymutex_destroy
 
 hythread_is_alive
 hythread_is_terminated

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp Tue Mar 18 04:31:02 2008
@@ -135,11 +135,6 @@
 hysem_wait_interruptable;
 hysem_getvalue;
 hysem_set;
-hymutex_create;
-hymutex_lock;
-hymutex_trylock;
-hymutex_unlock;
-hymutex_destroy;
 hythread_exit;
 
 hythread_is_alive;

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_condvar.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_condvar.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_condvar.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_condvar.c Tue Mar 18 04:31:02 2008
@@ -34,7 +34,7 @@
  * This function does not implement interruptability and thread state
  * functionality, thus the caller of this function have to handle it.
  */
-int os_cond_timedwait(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano)
+int os_cond_timedwait(hycond_t *cond, osmutex_t *mutex, I_64 ms, IDATA nano)
 {
     int r = 0;
 

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_init.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_init.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_init.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_init.c Tue Mar 18 04:31:02 2008
@@ -24,6 +24,7 @@
 #define LOG_DOMAIN "tm.init"
 
 #include <open/hythread_ext.h>
+#include "port_mutex.h"
 #include "thread_private.h"
 
 //global constants:
@@ -38,7 +39,7 @@
 apr_threadkey_t *TM_THREAD_KEY;
 
 //Thread manager global lock
-hymutex_t TM_START_LOCK;
+osmutex_t TM_START_LOCK;
 static int hythread_library_state = TM_LIBRARY_STATUS_NOT_INITIALIZED;
 #define GLOBAL_MONITOR_NAME "global_monitor"
 hythread_monitor_t p_global_monitor;
@@ -145,9 +146,9 @@
     apr_status = apr_threadkey_private_create(&TM_THREAD_KEY, NULL, TM_POOL);
     assert(apr_status == APR_SUCCESS);
     
-    status = hymutex_create(&lib->TM_LOCK, TM_MUTEX_NESTED);
+    status = port_mutex_create(&lib->TM_LOCK, APR_THREAD_MUTEX_NESTED);
     assert(status == TM_ERROR_NONE);
-    status = hymutex_create(&TM_START_LOCK, TM_MUTEX_NESTED);
+    status = port_mutex_create(&TM_START_LOCK, APR_THREAD_MUTEX_NESTED);
     assert(status == TM_ERROR_NONE);
      
     status = init_group_list();
@@ -210,7 +211,7 @@
     IDATA status;
     
     assert(self == hythread_self());
-    status = hymutex_lock(&self->library->TM_LOCK);
+    status = port_mutex_lock(&self->library->TM_LOCK);
     assert(status == TM_ERROR_NONE);
 }
 
@@ -223,7 +224,7 @@
     IDATA status;
 
     assert(self == hythread_self());
-    status = hymutex_unlock(&self->library->TM_LOCK);
+    status = port_mutex_unlock(&self->library->TM_LOCK);
     assert(status == TM_ERROR_NONE);
 }
 
@@ -239,7 +240,7 @@
     // we need not care about suspension if the thread
     // is not even attached to hythread
     if (self == NULL) {
-        return hymutex_lock(&TM_LIBRARY->TM_LOCK);
+        return port_mutex_lock(&TM_LIBRARY->TM_LOCK);
     }
 
     // disable_count must be 0 on potentially
@@ -247,7 +248,7 @@
     // meaning that the thread is safe for suspension
     assert(hythread_is_suspend_enabled());
 
-    status = hymutex_lock(&TM_LIBRARY->TM_LOCK);
+    status = port_mutex_lock(&TM_LIBRARY->TM_LOCK);
     assert(status == TM_ERROR_NONE);
 
     // make sure we do not get a global thread lock
@@ -255,10 +256,10 @@
     while (self->suspend_count) {
         // give up global thread lock before safepoint,
         // because this thread can be suspended at a safepoint
-        status = hymutex_unlock(&TM_LIBRARY->TM_LOCK);
+        status = port_mutex_unlock(&TM_LIBRARY->TM_LOCK);
         assert(status == TM_ERROR_NONE);
         hythread_safe_point();
-        status = hymutex_lock(&TM_LIBRARY->TM_LOCK);
+        status = port_mutex_lock(&TM_LIBRARY->TM_LOCK);
         assert(status == TM_ERROR_NONE);
     }
     return TM_ERROR_NONE;
@@ -271,7 +272,7 @@
 IDATA VMCALL hythread_global_unlock() {
     IDATA status;
     assert(!hythread_self() || hythread_is_suspend_enabled());
-    status = hymutex_unlock(&TM_LIBRARY->TM_LOCK);
+    status = port_mutex_unlock(&TM_LIBRARY->TM_LOCK);
     assert(status == TM_ERROR_NONE);
     return TM_ERROR_NONE;
 }
@@ -309,7 +310,7 @@
     assert (lock_table->tables[0]);
     assert (lock_table->live_objs);
     
-    if (hymutex_create(&lock_table->mutex, APR_THREAD_MUTEX_NESTED)) {
+    if (port_mutex_create(&lock_table->mutex, APR_THREAD_MUTEX_NESTED)) {
         return TM_ERROR_OUT_OF_MEMORY;
     }
 
@@ -357,7 +358,7 @@
         free(lock_table->tables[i]);
     }
 
-    hymutex_destroy(&lock_table->mutex);
+    port_mutex_destroy(&lock_table->mutex);
     hycond_destroy(&lock_table->write);
     hycond_destroy(&lock_table->read);
     
@@ -370,11 +371,11 @@
 }
 
 IDATA acquire_start_lock() {
-    return hymutex_lock(&TM_START_LOCK);
+    return port_mutex_lock(&TM_START_LOCK);
 }
 
 IDATA release_start_lock() {
-    return hymutex_unlock(&TM_START_LOCK);
+    return port_mutex_unlock(&TM_START_LOCK);
 }
 
 /*

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c Tue Mar 18 04:31:02 2008
@@ -36,6 +36,7 @@
 #include <apr_atomic.h>
 #include <open/hythread_ext.h>
 #include "port_thread.h"
+#include "port_mutex.h"
 #include "thread_private.h"
 
 extern hythread_group_t TM_DEFAULT_GROUP;
@@ -383,11 +384,11 @@
     mon->wait_count++;
 
     // Set thread state
-    status = hymutex_lock(&self->mutex);
+    status = port_mutex_lock(&self->mutex);
     assert(status == TM_ERROR_NONE);
     self->waited_monitor = mon;
     self->state |= TM_THREAD_STATE_SLEEPING;
-    status = hymutex_unlock(&self->mutex);
+    status = port_mutex_unlock(&self->mutex);
     assert(status == TM_ERROR_NONE);
 
     do {
@@ -420,11 +421,11 @@
     } while(1);
 
     // Restore thread state
-    status = hymutex_lock(&self->mutex);
+    status = port_mutex_lock(&self->mutex);
     assert(status == TM_ERROR_NONE);
     self->state &= ~TM_THREAD_STATE_SLEEPING;
     self->waited_monitor = NULL;
-    status = hymutex_unlock(&self->mutex);
+    status = port_mutex_unlock(&self->mutex);
     assert(status == TM_ERROR_NONE);
 
     // Release thread monitor
@@ -606,9 +607,9 @@
     thread->prev = prev;
     prev->next = cur->prev = thread;
 
-    hymutex_lock(&thread->mutex);
+    port_mutex_lock(&thread->mutex);
     thread->state |= TM_THREAD_STATE_ALIVE | TM_THREAD_STATE_RUNNABLE;
-    hymutex_unlock(&thread->mutex);
+    port_mutex_unlock(&thread->mutex);
 
     status = hythread_global_unlock();
     assert(status == TM_ERROR_NONE);
@@ -664,7 +665,7 @@
         memset(new_thread, 0, sizeof(HyThread));
         status = hysem_create(&new_thread->resume_event, 0, 1);
         assert(status == TM_ERROR_NONE);
-        status = hymutex_create(&new_thread->mutex, TM_MUTEX_NESTED);
+        status = port_mutex_create(&new_thread->mutex, APR_THREAD_MUTEX_NESTED);
         assert(status == TM_ERROR_NONE);
         status = hythread_monitor_init(&new_thread->monitor, 0);
         assert(status == TM_ERROR_NONE);
@@ -672,7 +673,7 @@
         // old thread, reset structure
         int result;
         hysem_t resume;
-        hymutex_t mutex;
+        osmutex_t mutex;
         hythread_monitor_t monitor;
 
         // release thread OS handle
@@ -696,9 +697,9 @@
     new_thread->priority   = HYTHREAD_PRIORITY_NORMAL;
     new_thread->stacksize = os_get_foreign_thread_stack_size();
 
-    hymutex_lock(&new_thread->mutex);
+    port_mutex_lock(&new_thread->mutex);
     new_thread->state = TM_THREAD_STATE_NEW;
-    hymutex_unlock(&new_thread->mutex);
+    port_mutex_unlock(&new_thread->mutex);
 
     status = hysem_set(new_thread->resume_event, 0);
     assert(status == TM_ERROR_NONE);
@@ -718,7 +719,7 @@
     // Release thread primitives
     status = hysem_destroy(thread->resume_event);
     assert(status == TM_ERROR_NONE);
-    status = hymutex_destroy(&thread->mutex);
+    status = port_mutex_destroy(&thread->mutex);
     assert(status == TM_ERROR_NONE);
     status = hythread_monitor_destroy(thread->monitor);
     assert(status == TM_ERROR_NONE);
@@ -756,9 +757,9 @@
     // check hythread library state
     if (hythread_lib_state() != TM_LIBRARY_STATUS_INITIALIZED) {
         // set TERMINATED state
-        hymutex_lock(&thread->mutex);
+        port_mutex_lock(&thread->mutex);
         thread->state = TM_THREAD_STATE_TERMINATED;
-        hymutex_unlock(&thread->mutex);
+        port_mutex_unlock(&thread->mutex);
 
         // set hythread_self()
         hythread_set_self(thread);
@@ -807,9 +808,9 @@
     assert(status == TM_ERROR_NONE);
 
     // set TERMINATED state
-    hymutex_lock(&thread->mutex);
+    port_mutex_lock(&thread->mutex);
     thread->state = TM_THREAD_STATE_TERMINATED;
-    hymutex_unlock(&thread->mutex);
+    port_mutex_unlock(&thread->mutex);
 
     // detach and free thread
     hythread_detach(thread);
@@ -854,28 +855,28 @@
 
 IDATA VMCALL hythread_thread_lock(hythread_t thread) {
     assert(thread);
-    return hymutex_lock(&thread->mutex);
+    return port_mutex_lock(&thread->mutex);
 } // hythread_thread_lock
 
 IDATA VMCALL hythread_thread_unlock(hythread_t thread) {
     assert(thread);
-    return hymutex_unlock(&thread->mutex);
+    return port_mutex_unlock(&thread->mutex);
 } // hythread_thread_unlock
 
 IDATA VMCALL hythread_get_state(hythread_t thread) {
     IDATA state;
     assert(thread);
-    hymutex_lock(&thread->mutex);
+    port_mutex_lock(&thread->mutex);
     state = thread->state;
-    hymutex_unlock(&thread->mutex);
+    port_mutex_unlock(&thread->mutex);
     return state;
 } // hythread_get_state
 
 IDATA VMCALL hythread_set_state(hythread_t thread, IDATA state) {
     assert(thread);
-    hymutex_lock(&thread->mutex);
+    port_mutex_lock(&thread->mutex);
     thread->state = state;
-    hymutex_unlock(&thread->mutex);
+    port_mutex_unlock(&thread->mutex);
     return TM_ERROR_NONE;
 } // hythread_set_state
 
@@ -934,7 +935,7 @@
     assert(thread);
     lib = thread->library;
 
-    status = hymutex_lock(&lib->TM_LOCK);
+    status = port_mutex_lock(&lib->TM_LOCK);
     if (status != TM_ERROR_NONE) {
         return status;
     }
@@ -948,37 +949,37 @@
                lib->nondaemon_thread_count));
 
         if (status != TM_ERROR_NONE) {
-            hymutex_unlock(&lib->TM_LOCK);
+            port_mutex_unlock(&lib->TM_LOCK);
             return status;
         }
     }
 
-    status = hymutex_unlock(&lib->TM_LOCK);
+    status = port_mutex_unlock(&lib->TM_LOCK);
     return status;
 } // hythread_wait_for_nondaemon_threads
 
 IDATA VMCALL hythread_increase_nondaemon_threads_count(hythread_t thread)
 {
     hythread_library_t lib = thread->library;
-    IDATA status = hymutex_lock(&lib->TM_LOCK);
+    IDATA status = port_mutex_lock(&lib->TM_LOCK);
     if (status != TM_ERROR_NONE) {
         return status;
     }
     lib->nondaemon_thread_count++;
-    status = hymutex_unlock(&lib->TM_LOCK);
+    status = port_mutex_unlock(&lib->TM_LOCK);
     return status;
 } // hythread_increase_nondaemon_threads_count_in_library
 
 IDATA VMCALL hythread_decrease_nondaemon_threads_count(hythread_t thread, IDATA threads_to_keep)
 {
     hythread_library_t lib = thread->library;
-    IDATA status = hymutex_lock(&lib->TM_LOCK);
+    IDATA status = port_mutex_lock(&lib->TM_LOCK);
     if (status != TM_ERROR_NONE) {
         return status;
     }
 
     if (lib->nondaemon_thread_count <= 0) {
-        status = hymutex_unlock(&lib->TM_LOCK);
+        status = port_mutex_unlock(&lib->TM_LOCK);
         if (status != TM_ERROR_NONE) {
             return status;
         }
@@ -994,12 +995,12 @@
         TRACE(("TM: nondaemons all dead, thread: %p count: %d\n", thread,
                lib->nondaemon_thread_count));
         if (status != TM_ERROR_NONE) {
-            hymutex_unlock(&lib->TM_LOCK);
+            port_mutex_unlock(&lib->TM_LOCK);
             return status;
         }
     }
 
-    status = hymutex_unlock(&lib->TM_LOCK);
+    status = port_mutex_unlock(&lib->TM_LOCK);
     return status;
 } // hythread_countdown_nondaemon_threads
 

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c Tue Mar 18 04:31:02 2008
@@ -31,7 +31,7 @@
 /**
  * Waits on a conditional, handling interruptions and thread state.
  */
-IDATA condvar_wait_impl(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano, IDATA interruptable) {
+IDATA condvar_wait_impl(hycond_t *cond, osmutex_t *mutex, I_64 ms, IDATA nano, IDATA interruptable) {
     int r;
     int disable_count;
     hythread_t self;
@@ -77,7 +77,7 @@
  * @return  
  *      TM_NO_ERROR on success 
  */
-IDATA VMCALL hycond_wait(hycond_t *cond, hymutex_t *mutex) {
+IDATA VMCALL hycond_wait(hycond_t *cond, osmutex_t *mutex) {
     return condvar_wait_impl(cond, mutex, 0, 0, WAIT_NONINTERRUPTABLE);
 }
 
@@ -93,7 +93,7 @@
  * @return  
  *      TM_NO_ERROR on success 
  */
-IDATA VMCALL hycond_wait_timed(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano) {
+IDATA VMCALL hycond_wait_timed(hycond_t *cond, osmutex_t *mutex, I_64 ms, IDATA nano) {
     return condvar_wait_impl(cond, mutex, ms, nano, WAIT_NONINTERRUPTABLE);
 }
 
@@ -102,7 +102,7 @@
  * Directly using OS interfaces.
  * This function does not implement interruptability and thread state functionality.
  */
-IDATA VMCALL hycond_wait_timed_raw(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano) {
+IDATA VMCALL hycond_wait_timed_raw(hycond_t *cond, osmutex_t *mutex, I_64 ms, IDATA nano) {
     return os_cond_timedwait(cond, mutex, ms, nano);
 }
 
@@ -119,7 +119,7 @@
  *      TM_NO_ERROR on success 
  *      TM_THREAD_INTERRUPTED in case thread was interrupted during wait.
  */
-IDATA VMCALL hycond_wait_interruptable(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano) {
+IDATA VMCALL hycond_wait_interruptable(hycond_t *cond, osmutex_t *mutex, I_64 ms, IDATA nano) {
     return condvar_wait_impl(cond, mutex, ms, nano, WAIT_INTERRUPTABLE);
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_fat_monitor.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_fat_monitor.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_fat_monitor.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_fat_monitor.c Tue Mar 18 04:31:02 2008
@@ -27,6 +27,7 @@
 #undef LOG_DOMAIN
 #define LOG_DOMAIN "tm.locks"
 #include <open/hythread_ext.h>
+#include "port_mutex.h"
 #include "thread_private.h"
 
 /**
@@ -50,7 +51,7 @@
     if (mon == NULL) {
         return TM_ERROR_OUT_OF_MEMORY;
     }
-    r = hymutex_create(&mon->mutex, TM_MUTEX_NESTED);
+    r = port_mutex_create(&mon->mutex, APR_THREAD_MUTEX_NESTED);
     if (r) {
         goto cleanup;
     }
@@ -87,7 +88,7 @@
     IDATA status;
     hythread_t  self = tm_self_tls;
     if (mon_ptr->owner != self) {
-        status = hymutex_lock(&mon_ptr->mutex);
+        status = port_mutex_lock(&mon_ptr->mutex);
         mon_ptr->owner = self;
         assert(status == TM_ERROR_NONE);
     } else {
@@ -115,7 +116,7 @@
     IDATA status;
     hythread_t self = tm_self_tls;
     if (mon_ptr->owner != self) {
-        status = hymutex_trylock(&mon_ptr->mutex);
+        status = port_mutex_trylock(&mon_ptr->mutex);
         if (status == TM_ERROR_NONE) {
             mon_ptr->owner = tm_self_tls;
         }
@@ -149,7 +150,7 @@
     }
     if (mon_ptr->recursion_count == 0) {
         mon_ptr->owner = NULL;
-        status = hymutex_unlock(&mon_ptr->mutex);
+        status = port_mutex_unlock(&mon_ptr->mutex);
     } else {
         mon_ptr->recursion_count--;
     }
@@ -174,10 +175,10 @@
     mon_ptr->owner = NULL;
     mon_ptr->recursion_count =0;
     mon_ptr->wait_count++;
-    hymutex_lock(&self->mutex);
+    port_mutex_lock(&self->mutex);
     self->state |= TM_THREAD_STATE_IN_MONITOR_WAIT;
     self->waited_monitor = mon_ptr;
-    hymutex_unlock(&self->mutex);
+    port_mutex_unlock(&self->mutex);
 
     do {
         apr_time_t start;
@@ -215,21 +216,21 @@
         mon_ptr->notify_count--;
     }
 
-    hymutex_lock(&self->mutex);
+    port_mutex_lock(&self->mutex);
     self->state &= ~TM_THREAD_STATE_IN_MONITOR_WAIT;
     self->waited_monitor = NULL;
-    hymutex_unlock(&self->mutex);
+    port_mutex_unlock(&self->mutex);
 
     mon_ptr->wait_count--;
     assert(mon_ptr->notify_count <= mon_ptr->wait_count);
 
     if (self->request) {
         int save_count;
-        hymutex_unlock(&mon_ptr->mutex);
+        port_mutex_unlock(&mon_ptr->mutex);
         hythread_safe_point();
         hythread_exception_safe_point();
         save_count = hythread_reset_suspend_disable();
-        hymutex_lock(&mon_ptr->mutex);
+        port_mutex_lock(&mon_ptr->mutex);
         hythread_set_suspend_disable(save_count);
     }
 
@@ -378,7 +379,7 @@
         return TM_ERROR_ILLEGAL_STATE;
     }
 
-    hymutex_destroy(&monitor->mutex);
+    port_mutex_destroy(&monitor->mutex);
     hycond_destroy(&monitor->condition);
     free(monitor);
     return TM_ERROR_NONE;

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_latch.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_latch.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_latch.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_latch.c Tue Mar 18 04:31:02 2008
@@ -21,6 +21,7 @@
  */
 
 #include <open/hythread_ext.h>
+#include "port_mutex.h"
 #include "thread_private.h"
 
 
@@ -48,7 +49,7 @@
     if (latch == NULL) {
         return TM_ERROR_OUT_OF_MEMORY;
     }
-    res = hymutex_create(&latch->mutex, TM_MUTEX_DEFAULT);
+    res = port_mutex_create(&latch->mutex, APR_THREAD_MUTEX_DEFAULT);
     if (res) {
         goto cleanup;
     }
@@ -61,7 +62,7 @@
     return TM_ERROR_NONE;
 
 cleanup_mutex:
-    hymutex_destroy(&latch->mutex);
+    port_mutex_destroy(&latch->mutex);
 
 cleanup:
     free(latch);
@@ -73,7 +74,7 @@
 static IDATA latch_wait_impl(hylatch_t latch, I_64 ms, IDATA nano, IDATA interruptable) {
     IDATA status;
         
-    status = hymutex_lock(&latch->mutex);
+    status = port_mutex_lock(&latch->mutex);
     if (status != TM_ERROR_NONE) {
         return status;
     }
@@ -81,13 +82,13 @@
         status = condvar_wait_impl(&latch->condition, &latch->mutex, ms, nano, interruptable);
         //check interruption and other problems
         if (status != TM_ERROR_NONE) {
-            hymutex_unlock(&latch->mutex);
+            port_mutex_unlock(&latch->mutex);
             return status;
         }
 
         if (ms || nano) break;
     }
-    status = hymutex_unlock(&latch->mutex);
+    status = port_mutex_unlock(&latch->mutex);
 
     return status;
 }
@@ -143,10 +144,10 @@
 IDATA VMCALL hylatch_set(hylatch_t latch, IDATA count) {
     IDATA status;
     
-    status = hymutex_lock(&latch->mutex);
+    status = port_mutex_lock(&latch->mutex);
     if (status != TM_ERROR_NONE) return status;
     latch->count = count;
-    status = hymutex_unlock(&latch->mutex);
+    status = port_mutex_unlock(&latch->mutex);
     if (status != TM_ERROR_NONE) return status;
 
     return TM_ERROR_NONE;       
@@ -162,10 +163,10 @@
 IDATA VMCALL hylatch_count_down(hylatch_t latch) {
     IDATA status;
     
-    status = hymutex_lock(&latch->mutex);
+    status = port_mutex_lock(&latch->mutex);
     if (status != TM_ERROR_NONE) return status;
     if (latch->count <= 0) {
-        status = hymutex_unlock(&latch->mutex);
+        status = port_mutex_unlock(&latch->mutex);
         if (status != TM_ERROR_NONE) return status;
         return TM_ERROR_ILLEGAL_STATE;
     }
@@ -173,12 +174,12 @@
     if (latch->count == 0) {
         status = hycond_notify_all(&latch->condition); 
         if (status != TM_ERROR_NONE) {
-            hymutex_unlock(&latch->mutex);
+            port_mutex_unlock(&latch->mutex);
             return status;
         }
     }
             
-    status = hymutex_unlock(&latch->mutex);
+    status = port_mutex_unlock(&latch->mutex);
     if (status != TM_ERROR_NONE) return status;
         
     return TM_ERROR_NONE;       
@@ -195,10 +196,10 @@
 IDATA VMCALL hylatch_get_count(IDATA *count, hylatch_t latch) {
     IDATA status;
     
-    status = hymutex_lock(&latch->mutex);
+    status = port_mutex_lock(&latch->mutex);
     if (status != TM_ERROR_NONE) return status;
     *count = latch->count;
-    status = hymutex_unlock(&latch->mutex);
+    status = port_mutex_unlock(&latch->mutex);
     if (status != TM_ERROR_NONE) return status;
 
     return TM_ERROR_NONE;       
@@ -210,7 +211,7 @@
  * @param[in] latch the latch 
  */
 IDATA VMCALL hylatch_destroy(hylatch_t latch) {
-    IDATA status = hymutex_destroy(&latch->mutex);
+    IDATA status = port_mutex_destroy(&latch->mutex);
     status |= hycond_destroy(&latch->condition);
     free(latch);
     return status;

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_park.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_park.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_park.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_park.c Tue Mar 18 04:31:02 2008
@@ -22,6 +22,7 @@
 
 #include <apr_atomic.h>
 #include <open/hythread_ext.h>
+#include "port_mutex.h"
 #include "thread_private.h"
 
 /**
@@ -56,25 +57,25 @@
     mon->wait_count++;
 
     // Set thread state
-    status = hymutex_lock(&self->mutex);
+    status = port_mutex_lock(&self->mutex);
     assert(status == TM_ERROR_NONE);
     self->waited_monitor = mon;
     if (!(self->state & TM_THREAD_STATE_UNPARKED)) {
         // if thread is not unparked stop the current thread from executing
         self->state |= TM_THREAD_STATE_PARKED;
-        status = hymutex_unlock(&self->mutex);
+        status = port_mutex_unlock(&self->mutex);
         assert(status == TM_ERROR_NONE);
 
         result = condvar_wait_impl(&mon->condition, &mon->mutex,
                 millis, nanos, WAIT_INTERRUPTABLE);
 
         // Restore thread state
-        status = hymutex_lock(&self->mutex);
+        status = port_mutex_lock(&self->mutex);
         assert(status == TM_ERROR_NONE);
     }
     self->state &= ~(TM_THREAD_STATE_PARKED|TM_THREAD_STATE_UNPARKED);
     self->waited_monitor = NULL;
-    status = hymutex_unlock(&self->mutex);
+    status = port_mutex_unlock(&self->mutex);
     assert(status == TM_ERROR_NONE);
 
     // Release thread monitor
@@ -116,26 +117,26 @@
         return;
     }
 
-    status = hymutex_lock(&thread->mutex);
+    status = port_mutex_lock(&thread->mutex);
     assert(status == TM_ERROR_NONE);
 
     if (thread->state & TM_THREAD_STATE_PARKED) {
         thread->state &= ~TM_THREAD_STATE_PARKED;
         mon = thread->waited_monitor;
         assert(mon);
-        status = hymutex_unlock(&thread->mutex);
+        status = port_mutex_unlock(&thread->mutex);
         assert(status == TM_ERROR_NONE);
 
         // Notify parked thread
-        status = hymutex_lock(&mon->mutex);
+        status = port_mutex_lock(&mon->mutex);
         assert(status == TM_ERROR_NONE);
         status = hycond_notify_all(&mon->condition);
         assert(status == TM_ERROR_NONE);
-        status = hymutex_unlock(&mon->mutex);
+        status = port_mutex_unlock(&mon->mutex);
         assert(status == TM_ERROR_NONE);
     } else {
         thread->state |= TM_THREAD_STATE_UNPARKED;
-        status = hymutex_unlock(&thread->mutex);
+        status = port_mutex_unlock(&thread->mutex);
         assert(status == TM_ERROR_NONE);
     }
 }

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_semaphore.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_semaphore.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_semaphore.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_semaphore.c Tue Mar 18 04:31:02 2008
@@ -26,6 +26,7 @@
  */
 
 #include <open/hythread_ext.h>
+#include "port_mutex.h"
 #include "thread_private.h"
 
 /**
@@ -43,7 +44,7 @@
     if (l == NULL) {
         return TM_ERROR_OUT_OF_MEMORY;
     }
-    r = hymutex_create(&l->mutex, TM_MUTEX_DEFAULT);
+    r = port_mutex_create(&l->mutex, APR_THREAD_MUTEX_DEFAULT);
     if (r) goto cleanup;
     r = hycond_create(&l->condition);
     if (r) goto cleanup;
@@ -62,7 +63,7 @@
 IDATA sem_wait_impl(hysem_t sem, I_64 ms, IDATA nano, IDATA interruptable) {
     IDATA status;
         
-    status = hymutex_lock(&sem->mutex);
+    status = port_mutex_lock(&sem->mutex);
     if (status != TM_ERROR_NONE) return status;
     //printf("wait %x %d\n", sem, sem->count);
     //fflush(NULL);
@@ -70,7 +71,7 @@
         status = condvar_wait_impl(&sem->condition, &sem->mutex, ms, nano, interruptable);
         //check interruption and timeout
         if (status != TM_ERROR_NONE) {
-            hymutex_unlock(&sem->mutex);
+            port_mutex_unlock(&sem->mutex);
             return status;
         }
 
@@ -79,14 +80,14 @@
     //should we check here if timeout is not supposed to happen
     if (sem->count == 0 /*&& (ms || nano)*/) {
         if (ms || nano) {
-            hymutex_unlock(&sem->mutex);
+            port_mutex_unlock(&sem->mutex);
             return TM_ERROR_TIMEOUT;
         } else {
             assert(0);
         }
     }
     sem->count--;
-    status = hymutex_unlock(&sem->mutex);
+    status = port_mutex_unlock(&sem->mutex);
     if (status != TM_ERROR_NONE) return status;
 
     return TM_ERROR_NONE;
@@ -150,10 +151,10 @@
     IDATA status;
     //printf("post %x %d\n", sem, sem->count);
     //fflush(NULL);
-    status = hymutex_lock(&sem->mutex);
+    status = port_mutex_lock(&sem->mutex);
     if (status != TM_ERROR_NONE) return status;
     if (sem->count >= sem->max_count) {
-        hymutex_unlock(&sem->mutex);
+        port_mutex_unlock(&sem->mutex);
         //printf("illegal state %d : %d \n", sem->count, sem->max_count);
         //fflush(NULL);
         return TM_ERROR_ILLEGAL_STATE;
@@ -163,7 +164,7 @@
         hycond_notify(&sem->condition);
     }
             
-    status = hymutex_unlock(&sem->mutex);
+    status = port_mutex_unlock(&sem->mutex);
     if (status != TM_ERROR_NONE) return status;
     return TM_ERROR_NONE;
 }
@@ -177,10 +178,10 @@
 IDATA VMCALL hysem_set(hysem_t sem, IDATA count) {
     IDATA status;
     
-    status = hymutex_lock(&sem->mutex);
+    status = port_mutex_lock(&sem->mutex);
     if (status != TM_ERROR_NONE) return status;
     if (count > sem->max_count) {
-        hymutex_unlock(&sem->mutex);
+        port_mutex_unlock(&sem->mutex);
         if (status != TM_ERROR_NONE) return status;
         return TM_ERROR_ILLEGAL_STATE;
     }
@@ -188,11 +189,11 @@
     if (count > 0) {
         status = hycond_notify_all(&sem->condition); 
         if (status != TM_ERROR_NONE) {
-            hymutex_unlock(&sem->mutex);
+            port_mutex_unlock(&sem->mutex);
             return status;
         }
     }
-    status = hymutex_unlock(&sem->mutex);
+    status = port_mutex_unlock(&sem->mutex);
     if (status != TM_ERROR_NONE) return status;
 
     return TM_ERROR_NONE;       
@@ -207,10 +208,10 @@
 IDATA VMCALL hysem_getvalue(IDATA *count, hysem_t sem) {
     IDATA status;
     
-    status = hymutex_lock(&sem->mutex);
+    status = port_mutex_lock(&sem->mutex);
     if (status != TM_ERROR_NONE) return status;
     *count = sem->count;
-    status = hymutex_unlock(&sem->mutex);
+    status = port_mutex_unlock(&sem->mutex);
     if (status != TM_ERROR_NONE) return status;
 
     return TM_ERROR_NONE;      
@@ -229,7 +230,7 @@
  * @see hysem_init, hysem_wait, hysem_post
  */
 IDATA VMCALL hysem_destroy(hysem_t sem) {
-    IDATA status = hymutex_destroy(&sem->mutex);
+    IDATA status = port_mutex_destroy(&sem->mutex);
     status |= hycond_destroy(&sem->condition);
     free(sem);
     return status;

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_suspend.c Tue Mar 18 04:31:02 2008
@@ -24,9 +24,10 @@
 #define LOG_DOMAIN "tm.suspend"
 
 #include <open/hythread_ext.h>
-#include "thread_private.h"
 #include <apr_atomic.h>
 #include "port_barriers.h"
+#include "port_mutex.h"
+#include "thread_private.h"
 
 static void thread_safe_point_impl(hythread_t thread);
 
@@ -190,9 +191,9 @@
     TRACE(("suspend wait exit safe region thread: "
            "%p, suspend_count: %d, request: %d",
            thread, thread->suspend_count, thread->request));
-    hymutex_lock(&thread->mutex);
+    port_mutex_lock(&thread->mutex);
     thread->state |= TM_THREAD_STATE_SUSPENDED;
-    hymutex_unlock(&thread->mutex);
+    port_mutex_unlock(&thread->mutex);
     return TM_ERROR_NONE;
 }
 
@@ -209,9 +210,9 @@
 
     hythread_send_suspend_request(self);
 
-    hymutex_lock(&self->mutex);
+    port_mutex_lock(&self->mutex);
     self->state |= TM_THREAD_STATE_SUSPENDED;
-    hymutex_unlock(&self->mutex);
+    port_mutex_unlock(&self->mutex);
 
     thread_safe_point_impl(self);
 }
@@ -302,9 +303,9 @@
     }
 
     // change thread state
-    hymutex_lock(&thread->mutex);
+    port_mutex_lock(&thread->mutex);
     thread->state &= ~TM_THREAD_STATE_SUSPENDED;
-    hymutex_unlock(&thread->mutex);
+    port_mutex_unlock(&thread->mutex);
 
     TRACE(("sent resume, self: %p, thread: %p, "
            "suspend_count: %d, request: %d", self, thread,

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c Tue Mar 18 04:31:02 2008
@@ -28,6 +28,7 @@
 #include <port_atomic.h>
 #include "port_barriers.h"
 #include "port_thread.h"
+#include "port_mutex.h"
 #include "thread_private.h"
 
 /** @name Thin monitors support. Implement thin-fat scheme.
@@ -133,7 +134,7 @@
 
 #ifdef LOCK_RESERVATION
 
-extern hymutex_t TM_LOCK;
+extern osmutex_t TM_LOCK;
 /*
  * Unreserves the lock already owned by this thread
  */
@@ -172,7 +173,7 @@
 
     // trylock used to prevent cyclic suspend deadlock
     // the java_monitor_enter calls safe_point between attempts.
-    /*status = hymutex_trylock(&TM_LOCK);
+    /*status = port_mutex_trylock(&TM_LOCK);
       if (status !=TM_ERROR_NONE) {
       return status;
       }*/
@@ -184,7 +185,7 @@
     owner = hythread_get_thread(lock_id);
     TRACE(("Unreserved other %d \n", ++unreserve_count/*, vm_get_object_class_name(lockword_ptr-1)*/));
     if (!IS_RESERVED(lockword) || IS_FAT_LOCK(lockword)) {
-        // hymutex_unlock(&TM_LOCK);
+        // port_mutex_unlock(&TM_LOCK);
         return TM_ERROR_NONE;
     }
     // suspend owner 
@@ -245,7 +246,7 @@
         hythread_resume(owner);
     }
 
-    /* status = hymutex_unlock(&TM_LOCK);*/
+    /* status = port_mutex_unlock(&TM_LOCK);*/
 
     // Gregory - This lock, right after it was unreserved, may be
     // inflated by another thread and therefore instead of recursion
@@ -496,7 +497,7 @@
         hythread_monitor_t monitor =
             locktable_get_fat_monitor(FAT_LOCK_ID(lockword));
         monitor->recursion_count = 0;
-        status = hymutex_unlock(&monitor->mutex);
+        status = port_mutex_unlock(&monitor->mutex);
         assert(status == TM_ERROR_NONE);
     } else {
         // this is thin monitor
@@ -730,7 +731,7 @@
  * Enter locktable read section
  */
 static void locktable_reader_enter() {
-    IDATA status = hymutex_lock(&lock_table->mutex);
+    IDATA status = port_mutex_lock(&lock_table->mutex);
     assert(status == TM_ERROR_NONE);
 
     if (lock_table->state == HYTHREAD_LOCKTABLE_IDLE
@@ -746,7 +747,7 @@
         // We are asserting here that we exited wait with the correct state
         assert(lock_table->state == HYTHREAD_LOCKTABLE_READING);
     }
-    status = hymutex_unlock(&lock_table->mutex);        
+    status = port_mutex_unlock(&lock_table->mutex);
     assert(status == TM_ERROR_NONE);
 }
 
@@ -754,7 +755,7 @@
  * Exit locktable read section
  */
 static void locktable_reader_exit() {
-    IDATA status = hymutex_lock(&lock_table->mutex);
+    IDATA status = port_mutex_lock(&lock_table->mutex);
     assert(status == TM_ERROR_NONE);
 
     lock_table->readers_reading--;
@@ -768,7 +769,7 @@
         }
     }
 
-    status = hymutex_unlock(&lock_table->mutex);
+    status = port_mutex_unlock(&lock_table->mutex);
     assert(status == TM_ERROR_NONE);
 }
 
@@ -776,7 +777,7 @@
  * Enter locktable write section
  */
 static void locktable_writer_enter() {
-    IDATA status = hymutex_lock(&lock_table->mutex);
+    IDATA status = port_mutex_lock(&lock_table->mutex);
     assert(status == TM_ERROR_NONE);
 
     if (lock_table->state != HYTHREAD_LOCKTABLE_IDLE) {
@@ -791,7 +792,7 @@
         lock_table->state = HYTHREAD_LOCKTABLE_WRITING;
     }        
 
-    status = hymutex_unlock(&lock_table->mutex);
+    status = port_mutex_unlock(&lock_table->mutex);
     assert(status == TM_ERROR_NONE);
 }
 
@@ -799,7 +800,7 @@
  * Exit locktable write section
  */
 static void locktable_writer_exit() {
-    IDATA status = hymutex_lock(&lock_table->mutex);
+    IDATA status = port_mutex_lock(&lock_table->mutex);
     assert(status == TM_ERROR_NONE);
 
     if (lock_table->readers_reading > 0) {
@@ -813,7 +814,7 @@
         lock_table->state = HYTHREAD_LOCKTABLE_IDLE;
     }
 
-    status = hymutex_unlock(&lock_table->mutex);
+    status = port_mutex_unlock(&lock_table->mutex);
     assert(status == TM_ERROR_NONE);
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h Tue Mar 18 04:31:02 2008
@@ -78,7 +78,7 @@
 
 typedef struct HyThreadLibrary {
     IDATA a;
-    hymutex_t TM_LOCK;
+    osmutex_t TM_LOCK;
     IDATA     nondaemon_thread_count;
     hycond_t  nondaemon_thread_cond;
 } HyThreadLibrary;
@@ -137,7 +137,7 @@
 typedef struct HyThreadMonitor {
     
     /// Monitor mutex.
-    hymutex_t mutex;
+    osmutex_t mutex;
 
     /// Monitor condition varibale.
     hycond_t condition;
@@ -183,7 +183,7 @@
     /**
      * Mutex associated with the latch data.
      */
-    hymutex_t mutex;  
+    osmutex_t mutex;
     
 } HyLatch;
 
@@ -211,7 +211,7 @@
     /**
      * Mutex associated with the semaphore data.
      */
-    hymutex_t mutex;         
+    osmutex_t mutex;
 } HySemaphore;
 
   
@@ -231,7 +231,7 @@
     hythread_monitor_t* tables[HY_MAX_FAT_TABLES];
     
     // mutex guarding locktable
-    hymutex_t mutex;
+    osmutex_t mutex;
     hycond_t read;
     hycond_t write;
     
@@ -297,7 +297,7 @@
 IDATA release_start_lock(void);
 
 IDATA thread_sleep_impl(I_64 millis, IDATA nanos, IDATA interruptable);
-IDATA condvar_wait_impl(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano, IDATA interruptable);
+IDATA condvar_wait_impl(hycond_t *cond, osmutex_t *mutex, I_64 ms, IDATA nano, IDATA interruptable);
 IDATA monitor_wait_impl(hythread_monitor_t mon_ptr, I_64 ms, IDATA nano, IDATA interruptable);
 IDATA thin_monitor_wait_impl(hythread_thin_monitor_t *lockword_ptr, I_64 ms, IDATA nano, IDATA interruptable);
 IDATA sem_wait_impl(hysem_t sem, I_64 ms, IDATA nano, IDATA interruptable);
@@ -314,7 +314,7 @@
 int os_thread_join(osthread_t os_thread);
 int os_get_thread_times(osthread_t os_thread, int64* pkernel, int64* puser);
 
-int os_cond_timedwait(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano);
+int os_cond_timedwait(hycond_t *cond, osmutex_t *mutex, I_64 ms, IDATA nano);
 UDATA os_get_foreign_thread_stack_size();
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_condvar.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_condvar.c?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_condvar.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_condvar.c Tue Mar 18 04:31:02 2008
@@ -23,6 +23,7 @@
  */
 
 #include <open/hythread_ext.h>
+#include "port_mutex.h"
 #include "thread_private.h"
 
 static void _enqueue (hycond_t *cond, struct waiting_node *node)
@@ -65,7 +66,7 @@
  * This function does not implement interruptability and thread state
  * functionality, thus the caller of this function have to handle it.
  */
-int os_cond_timedwait(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano)
+int os_cond_timedwait(hycond_t *cond, osmutex_t *mutex, I_64 ms, IDATA nano)
 {
     int r = 0;
     struct waiting_node node;
@@ -79,12 +80,12 @@
 
     // NULL attributes, manual reset, initially unsignalled, NULL name
     node.event = CreateEvent(NULL, TRUE, FALSE, NULL);
-    hymutex_lock(&cond->queue_mutex);
+    port_mutex_lock(&cond->queue_mutex);
     _enqueue(cond, &node);
-    hymutex_unlock(&cond->queue_mutex);
+    port_mutex_unlock(&cond->queue_mutex);
 
     // release mutex and wait for signal
-    hymutex_unlock(mutex);
+    port_mutex_unlock(mutex);
 
     res = WaitForSingleObject(node.event, timeout);
     if (res != WAIT_OBJECT_0) {
@@ -95,12 +96,12 @@
     }
 
     // re-acquire mutex associated with condition variable
-    hymutex_lock(mutex);
+    port_mutex_lock(mutex);
 
-    hymutex_lock(&cond->queue_mutex);
+    port_mutex_lock(&cond->queue_mutex);
     _remove_from_queue(cond, &node);
     CloseHandle(node.event);
-    hymutex_unlock(&cond->queue_mutex);
+    port_mutex_unlock(&cond->queue_mutex);
 
     return r;
 }
@@ -117,7 +118,7 @@
  */
 IDATA VMCALL hycond_create (hycond_t *cond) {
     cond->dummy_node.next = cond->dummy_node.prev = &cond->dummy_node;
-    hymutex_create(&cond->queue_mutex, APR_THREAD_MUTEX_NESTED);
+    port_mutex_create(&cond->queue_mutex, APR_THREAD_MUTEX_NESTED);
     return 0;
 }
 
@@ -133,7 +134,7 @@
     DWORD res;
     struct waiting_node *node;
 
-    hymutex_lock(&cond->queue_mutex);
+    port_mutex_lock(&cond->queue_mutex);
     node = _dequeue(cond);
     if (node != NULL) {
         res = SetEvent(node->event);
@@ -141,7 +142,7 @@
              r = (int)GetLastError();
         }
     }
-    hymutex_unlock(&cond->queue_mutex);
+    port_mutex_unlock(&cond->queue_mutex);
     return r;
 }
 
@@ -156,14 +157,14 @@
     DWORD res;
     struct waiting_node *node;
 
-    hymutex_lock(&cond->queue_mutex);
+    port_mutex_lock(&cond->queue_mutex);
     for (node = _dequeue(cond); node != NULL; node = _dequeue(cond)) {
         res = SetEvent(node->event);
         if (res == 0) {
             r = GetLastError();
         }
     }
-    hymutex_unlock(&cond->queue_mutex);
+    port_mutex_unlock(&cond->queue_mutex);
     return r;
 }
 
@@ -176,7 +177,7 @@
 IDATA VMCALL hycond_destroy (hycond_t *cond) {
     assert(cond->dummy_node.next == &cond->dummy_node
             && "destroying condition variable with active waiters");
-    return hymutex_destroy(&cond->queue_mutex);
+    return port_mutex_destroy(&cond->queue_mutex);
 }
 
 //@}

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/include/crash_dump.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/crash_dump.h?rev=638327&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/crash_dump.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/crash_dump.h Tue Mar 18 04:31:02 2008
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ */
+
+
+#ifndef __CRASH_DUMP_H__
+#define __CRASH_DUMP_H__
+
+#include "port_modules.h"
+
+
+/* platform-dependent functions */
+void cd_parse_module_info(native_module_t* module, void* ip);
+
+/* general functions to call from platform-dependent code */
+const char* cd_get_module_type(const char* short_name);
+
+
+#endif //!__CRASH_DUMP_H__

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/include/crash_dump.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h Tue Mar 18 04:31:02 2008
@@ -276,8 +276,6 @@
 void* get_exception_catch_stack_addr(void* curr_ip);
 VMEXPORT size_t get_available_stack_size();
 VMEXPORT bool check_available_stack_size(size_t required_size);
-VMEXPORT size_t get_default_stack_size();
-VMEXPORT size_t get_restore_stack_size();
 bool check_stack_size_enough_for_exception_catch(void* sp);
 
 #endif // _EXCEPTIONS_H_

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h Tue Mar 18 04:31:02 2008
@@ -49,11 +49,11 @@
     
     /* Using pair of cond and mutex rather than sem is because the waiting thread num is not constant */
     hycond_t end_cond;              // finalization end condition variable
-    hymutex_t end_mutex;            // finalization end mutex
+    osmutex_t end_mutex;            // finalization end mutex
     
     /* Using pair of cond and mutex rather than sem is because the waiting thread num is not constant */
     hycond_t mutator_block_cond;    // mutator block condition variable for heavy finalizable obj load
-    hymutex_t mutator_block_mutex;  // mutator block mutex for heavy finalizable obj load
+    osmutex_t mutator_block_mutex;  // mutator block mutex for heavy finalizable obj load
     
     vm_thread_t *thread_ids;
     volatile unsigned int thread_num;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h Tue Mar 18 04:31:02 2008
@@ -32,8 +32,8 @@
  */
 void exec_native_shutdown_sequence();
 jint vm_destroy(JavaVM_Internal * java_vm, jthread java_thread);
-void vm_interrupt_handler(int);
-void vm_dump_handler(int);
+void vm_interrupt_handler();
+void vm_dump_handler();
 
 void initialize_vm_cmd_state(Global_Env *p_env, JavaVMInitArgs* arguments);
 void set_log_levels_from_cmd(JavaVMInitArgs* vm_arguments);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h Tue Mar 18 04:31:02 2008
@@ -30,15 +30,6 @@
 #include "lock_manager.h"
 #include "environment.h"
 
-#define INSTRUMENTATION_BYTE_HLT 0xf4 // HLT instruction
-#define INSTRUMENTATION_BYTE_CLI 0xfa // CLI instruction
-#define INSTRUMENTATION_BYTE_INT3 0xcc // INT 3 instruction
-
-#ifdef PLATFORM_NT
-#define INSTRUMENTATION_BYTE INSTRUMENTATION_BYTE_CLI
-#else
-#define INSTRUMENTATION_BYTE INSTRUMENTATION_BYTE_INT3
-#endif
 
 // Callbacks are called for interfaces according to its priority
 typedef enum {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h Tue Mar 18 04:31:02 2008
@@ -54,7 +54,7 @@
     const ti_interface *functions;
 
     /// Lock used to protect TIEnv instance
-    hymutex_t environment_data_lock;
+    osmutex_t environment_data_lock;
 
     JavaVM_Internal *vm;
     Agent *agent;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/lock_manager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/lock_manager.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/lock_manager.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/lock_manager.h Tue Mar 18 04:31:02 2008
@@ -50,7 +50,7 @@
     bool _lock_enum_or_null (bool return_null_on_fail);
 
 private:
-    hymutex_t    lock;
+    osmutex_t    lock;
 };
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/native_stack.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/native_stack.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/native_stack.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/native_stack.h Tue Mar 18 04:31:02 2008
@@ -22,9 +22,10 @@
 #ifndef _NATIVE_STACK_H_
 #define _NATIVE_STACK_H_
 
+#include "open/platform_types.h"
+#include "port_unwind.h"
 #include "jni.h"
 #include "stack_iterator.h"
-#include "native_modules.h"
 #include "vm_threads.h"
 
 #ifdef __cplusplus
@@ -38,33 +39,16 @@
     void*   stack;
 } native_frame_t;
 
-typedef struct WalkContext {
-    native_module_t*    modules;
-    bool                clean_modules;
-    native_segment_t    stack;
-} WalkContext;
-
 
 // If frame_array is NULL, only returns real frame count
-int walk_native_stack_registers(WalkContext* context, Registers* pregs,
+int walk_native_stack_registers(UnwindContext* context, Registers* pregs,
     VM_thread* pthread, int max_depth, native_frame_t* frame_array);
 
-bool native_init_walk_context(WalkContext* context, native_module_t* modules, Registers* regs);
-void native_clean_walk_context(WalkContext* context);
-
-//////////////////////////////////////////////////////////////////////////////
-// Interchange between platform-dependent and general functions
-
-bool native_unwind_stack_frame(WalkContext* context, Registers* regs);
-void native_get_regs_from_jit_context(JitFrameContext* jfc, Registers* regs);
-bool native_get_stack_range(WalkContext* context, Registers* regs, native_segment_t* seg);
-bool native_is_frame_exists(WalkContext* context, Registers* regs);
-bool native_unwind_special(WalkContext* context, Registers* regs);
-bool native_is_in_code(WalkContext* context, void* ip);
-bool native_is_in_stack(WalkContext* context, void* sp);
 bool native_is_ip_stub(void* ip);
 char* native_get_stub_name(void* ip, char* buf, size_t buflen);
-void native_fill_frame_info(Registers* regs, native_frame_t* frame, jint jdepth);
+const char* native_get_stub_name_nocpy(void* ip);
+
+void native_get_regs_from_jit_context(JitFrameContext* jfc, Registers* regs);
 
 
 #ifdef __cplusplus

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/ncai_internal.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/ncai_internal.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/ncai_internal.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/ncai_internal.h Tue Mar 18 04:31:02 2008
@@ -42,8 +42,6 @@
 // These functions are differ for various operating systems
 bool ncai_get_generic_registers(hythread_t handle, Registers* regs);
 char* ncai_parse_module_name(char* filepath);
-ncaiError ncai_read_memory(void* addr, size_t size, void* buf);
-ncaiError ncai_write_memory(void* addr, size_t size, void* buf);
 
 
 struct VMBreakPoint;
@@ -120,13 +118,6 @@
 void ncai_report_method_exit(jmethodID method, jboolean exc_popped, jvalue ret_val);
 void ncai_step_native_method_entry(Method* m);
 void ncai_step_native_method_exit(Method* m);
-
-
-// Platform-dependant Signal functions
-size_t ncai_get_signal_count();
-bool ncai_is_signal_in_range(jint signal);
-char* ncai_get_signal_name(jint signal);
-size_t ncai_get_signal_name_size(jint signal);
 
 // Allows to get modules without providing NCAI environment
 ncaiError ncai_get_all_loaded_modules(ncaiEnv *env,

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h Tue Mar 18 04:31:02 2008
@@ -38,7 +38,7 @@
     
     /* Using pair of cond and mutex rather than sem is because the waiting thread num is not constant */
     hycond_t end_cond;      // ref enqueue end condition variable
-    hymutex_t end_mutex;    // ref enqueue end mutex
+    osmutex_t end_mutex;    // ref enqueue end mutex
     
     Boolean shutdown;
     volatile unsigned int thread_num;

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/include/signals.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/signals.h?rev=638327&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/signals.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/signals.h Tue Mar 18 04:31:02 2008
@@ -0,0 +1,77 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ */
+
+
+#ifndef __SIGNALS_H__
+#define __SIGNALS_H__
+
+#include <assert.h>
+#include "open/platform_types.h"
+#include "port_crash_handler.h"
+#include "vm_threads.h"
+#include "interpreter.h"
+#include "exceptions_jit.h"
+#include "compile.h"
+
+
+int vm_initialize_signals();
+int vm_shutdown_signals();
+
+Boolean null_reference_handler(port_sigtype signum, Registers* regs, void* fault_addr);
+Boolean stack_overflow_handler(port_sigtype signum, Registers* regs, void* fault_addr);
+Boolean abort_handler(port_sigtype signum, Registers* regs, void* fault_addr);
+Boolean ctrl_backslash_handler(port_sigtype signum, Registers* regs, void* fault_addr);
+Boolean ctrl_break_handler(port_sigtype signum, Registers* regs, void* fault_addr);
+Boolean ctrl_c_handler(port_sigtype signum, Registers* regs, void* fault_addr);
+Boolean native_breakpoint_handler(port_sigtype signum, Registers* regs, void* fault_addr);
+Boolean arithmetic_handler(port_sigtype signum, Registers* regs, void* fault_addr);
+
+
+inline bool is_in_ti_handler(vm_thread_t vmthread, void* ip)
+{
+    if (!vmthread)
+        return false;
+
+    POINTER_SIZE_INT break_buf =
+        (POINTER_SIZE_INT)(vmthread->jvmti_thread.jvmti_jit_breakpoints_handling_buffer);
+
+    return ((POINTER_SIZE_INT)ip >= break_buf &&
+            (POINTER_SIZE_INT)ip < break_buf + TM_JVMTI_MAX_BUFFER_SIZE);
+}
+
+inline bool is_in_java(Registers* regs)
+{
+    return (vm_identify_eip(regs->get_ip()) == VM_TYPE_JAVA);
+}
+
+inline void signal_throw_exception(Registers* regs, Class* exc_clss)
+{
+    vm_set_exception_registers(p_TLS_vmthread, *regs);
+    exn_athrow_regs(regs, exc_clss, is_in_java(regs), false);
+}
+
+inline void signal_throw_java_exception(Registers* regs, Class* exc_clss)
+{
+    ASSERT_NO_INTERPRETER;
+    assert(is_in_java(regs));
+
+    vm_set_exception_registers(p_TLS_vmthread, *regs);
+    exn_athrow_regs(regs, exc_clss, true, false);
+}
+
+
+#endif //!__SIGNALS_H__

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/include/signals.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Tue Mar 18 04:31:02 2008
@@ -30,6 +30,7 @@
 #include "properties.h"
 
 #include "open/hythread_ext.h"
+#include "port_mutex.h"
 #include "thread_manager.h"
 #include "cci.h"
 #include "nogc.h"
@@ -2109,11 +2110,11 @@
     return vector_class->calculate_array_size(length);
 } // vm_vector_size
 
-static hymutex_t vm_gc_lock;
+static osmutex_t vm_gc_lock;
 
 void vm_gc_lock_init()
 {
-    IDATA UNUSED status = hymutex_create(&vm_gc_lock, TM_MUTEX_NESTED);
+    IDATA UNUSED status = port_mutex_create(&vm_gc_lock, APR_THREAD_MUTEX_NESTED);
     assert(status == TM_ERROR_NONE);
 } // vm_gc_lock_init
 
@@ -2124,12 +2125,12 @@
     self->disable_count = 0;
 
     while (true) {
-        IDATA UNUSED status = hymutex_lock(&vm_gc_lock);
+        IDATA UNUSED status = port_mutex_lock(&vm_gc_lock);
         assert(status == TM_ERROR_NONE);
 
         self->disable_count = disable_count;
         if (disable_count && self->suspend_count) {
-            status = hymutex_unlock(&vm_gc_lock);
+            status = port_mutex_unlock(&vm_gc_lock);
             assert(status == TM_ERROR_NONE);
 
             self->disable_count = 0;
@@ -2142,7 +2143,7 @@
 
 void vm_gc_unlock_enum()
 {
-    IDATA UNUSED status = hymutex_unlock(&vm_gc_lock);
+    IDATA UNUSED status = port_mutex_unlock(&vm_gc_lock);
     assert(status == TM_ERROR_NONE);
 } // vm_gc_unlock_enum
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp Tue Mar 18 04:31:02 2008
@@ -57,7 +57,7 @@
     /**
      * Verify class
      */
-    if (is_enabled == TRUE && !is_interface()
+    if (is_enabled == 1 && !is_interface()
         && (is_bootstrap == FALSE || is_forced == TRUE)) {
         char *error;
         vf_Result result =

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp Tue Mar 18 04:31:02 2008
@@ -19,6 +19,7 @@
  * @author Li-Gang Wang, 2006/11/15
  */
 
+#include "port_mutex.h"
 #include "finalizer_thread.h"
 #include "ref_enqueue_thread.h"
 #include "finalize.h"
@@ -95,12 +96,12 @@
     
     status = hycond_create(&fin_thread_info->end_cond);
     assert(status == TM_ERROR_NONE);
-    status = hymutex_create(&fin_thread_info->end_mutex, TM_MUTEX_DEFAULT);
+    status = port_mutex_create(&fin_thread_info->end_mutex, APR_THREAD_MUTEX_DEFAULT);
     assert(status == TM_ERROR_NONE);
     
     status = hycond_create(&fin_thread_info->mutator_block_cond);
     assert(status == TM_ERROR_NONE);
-    status = hymutex_create(&fin_thread_info->mutator_block_mutex, TM_MUTEX_DEFAULT);
+    status = port_mutex_create(&fin_thread_info->mutator_block_mutex, APR_THREAD_MUTEX_DEFAULT);
     assert(status == TM_ERROR_NONE);
     
     fin_thread_info->thread_ids =
@@ -137,14 +138,14 @@
 
 void wait_native_fin_threads_detached(void)
 {
-    hymutex_lock(&fin_thread_info->end_mutex);
+    port_mutex_lock(&fin_thread_info->end_mutex);
     while(fin_thread_info->thread_num){
         atomic_inc32(&fin_thread_info->end_waiting_num);
         IDATA status = hycond_wait_timed(&fin_thread_info->end_cond, &fin_thread_info->end_mutex, (I_64)1000, 0);
         atomic_dec32(&fin_thread_info->end_waiting_num);
         if(status != TM_ERROR_NONE) break;
     }
-    hymutex_unlock(&fin_thread_info->end_mutex);
+    port_mutex_unlock(&fin_thread_info->end_mutex);
 }
 
 /* Restrict waiting time; Unit: msec */
@@ -157,7 +158,7 @@
 
 static void wait_finalization_end(Boolean must_wait)
 {
-    hymutex_lock(&fin_thread_info->end_mutex);
+    port_mutex_lock(&fin_thread_info->end_mutex);
     unsigned int fin_obj_num = vm_get_finalizable_objects_quantity();
     while(fin_thread_info->working_thread_num || fin_obj_num){
         unsigned int wait_time = restrict_wait_time((fin_obj_num + 100)<<1, FIN_MAX_WAIT_TIME << 7);
@@ -173,7 +174,7 @@
         }
         fin_obj_num = temp;     
     }
-    hymutex_unlock(&fin_thread_info->end_mutex);
+    port_mutex_unlock(&fin_thread_info->end_mutex);
 }
 
 void activate_finalizer_threads(Boolean wait)
@@ -268,13 +269,13 @@
     if(self_is_finalizer_thread())
         return;
     
-    hymutex_lock(&fin_thread_info->mutator_block_mutex);
+    port_mutex_lock(&fin_thread_info->mutator_block_mutex);
     unsigned int fin_obj_num = vm_get_finalizable_objects_quantity();
     fin_obj_num = fin_obj_num >> (MUTATOR_BLOCK_THRESHOLD_BITS + cpu_num_bits);
     unsigned int wait_time = restrict_wait_time(fin_obj_num, FIN_MAX_WAIT_TIME);
     if(fin_obj_num)
         IDATA status = hycond_wait_timed_raw(&fin_thread_info->mutator_block_cond, &fin_thread_info->mutator_block_mutex, wait_time, 0);
-    hymutex_unlock(&fin_thread_info->mutator_block_mutex);
+    port_mutex_unlock(&fin_thread_info->mutator_block_mutex);
 }
 
 void vm_heavy_finalizer_resume_mutator(void)

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp Tue Mar 18 04:31:02 2008
@@ -20,6 +20,7 @@
  */
 
 #include <apr_atomic.h>
+#include "port_mutex.h"
 #include "ref_enqueue_thread.h"
 #include "finalize.h"
 #include "vm_threads.h"
@@ -57,7 +58,7 @@
     
     status = hycond_create(&ref_thread_info->end_cond);
     assert(status == TM_ERROR_NONE);
-    status = hymutex_create(&ref_thread_info->end_mutex, TM_MUTEX_DEFAULT);
+    status = port_mutex_create(&ref_thread_info->end_mutex, APR_THREAD_MUTEX_DEFAULT);
     assert(status == TM_ERROR_NONE);
     
     ref_thread_info->thread_num = REF_ENQUEUE_THREAD_NUM;
@@ -89,19 +90,19 @@
 
 void wait_native_ref_thread_detached(void)
 {
-    hymutex_lock(&ref_thread_info->end_mutex);
+    port_mutex_lock(&ref_thread_info->end_mutex);
     while(ref_thread_info->thread_num){
         atomic_inc32(&ref_thread_info->end_waiting_num);
         IDATA status = hycond_wait_timed(&ref_thread_info->end_cond, &ref_thread_info->end_mutex, (I_64)1000, 0);
         atomic_dec32(&ref_thread_info->end_waiting_num);
         if(status != TM_ERROR_NONE) break;
     }
-    hymutex_unlock(&ref_thread_info->end_mutex);
+    port_mutex_unlock(&ref_thread_info->end_mutex);
 }
 
 static void wait_ref_enqueue_end(void)
 {
-    hymutex_lock(&ref_thread_info->end_mutex);
+    port_mutex_lock(&ref_thread_info->end_mutex);
     unsigned int ref_num = vm_get_references_quantity();
     do {
         unsigned int wait_time = ref_num + 100;
@@ -111,7 +112,7 @@
         if(status != TM_ERROR_NONE) break;
         ref_num = vm_get_references_quantity();
     } while(ref_num);
-    hymutex_unlock(&ref_thread_info->end_mutex);
+    port_mutex_unlock(&ref_thread_info->end_mutex);
 }
 
 void activate_ref_enqueue_thread(Boolean wait)

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Tue Mar 18 04:31:02 2008
@@ -50,6 +50,7 @@
 #include "classpath_const.h"
 #include "finalize.h"
 #include "jit_intf.h"
+#include "signals.h"
 
 #ifdef _WIN32
 // 20040427 Used to turn on heap checking on every allocation
@@ -861,11 +862,6 @@
     vm_env->pin_interned_strings = 
         (bool)get_boolean_property("vm.pin_interned_strings", FALSE, VM_PROPERTIES);
 
-    if (!get_boolean_property("vm.assert_dialog", TRUE, VM_PROPERTIES)) {
-        TRACE("disabling assertion dialogs");
-        disable_assert_dialogs();
-    }
-
     initialize_verify_stack_enumeration();
 
     /*    END: Property processing.    */
@@ -901,8 +897,8 @@
     status = natives_init();
     if (status != JNI_OK) return status;
 
-    extern void initialize_signals();
-    initialize_signals(); 
+    if (vm_initialize_signals() != 0)
+        return JNI_ERR;
 
     status = vm_attach(java_vm, &jni_env);
     if (status != JNI_OK) return status;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp Tue Mar 18 04:31:02 2008
@@ -27,7 +27,7 @@
 #include "properties.h"
 #include "vm_properties.h"
 #include "init.h"
-#include "native_modules.h"
+#include "port_modules.h"
 #if defined(FREEBSD)
 #include <dlfcn.h>
 #endif

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp Tue Mar 18 04:31:02 2008
@@ -37,6 +37,7 @@
 #include "thread_dump.h"
 #include "interpreter.h"
 #include "finalize.h"
+#include "signals.h"
 
 #define LOG_DOMAIN "vm.core.shutdown"
 #include "cxxlog.h"
@@ -286,8 +287,7 @@
         return JNI_ERR;
 
     // Shutdown signals
-    extern void shutdown_signals();
-    shutdown_signals();
+    vm_shutdown_signals();
 
     // Block thread creation.
     // TODO: investigate how to achieve that with ThreadManager
@@ -379,7 +379,7 @@
  * Current process received an interruption signal (Ctrl+C pressed).
  * Shutdown all running VMs and terminate the process.
  */
-void vm_interrupt_handler(int UNREF x) {
+void vm_interrupt_handler() {
     int nVMs;
     IDATA status = JNI_GetCreatedJavaVMs(NULL, 0, &nVMs);
     assert(nVMs <= 1);
@@ -421,10 +421,10 @@
 }
 
 /**
- * Current process received an ??? signal (Ctrl+Break pressed).
+ * Current process received an SIGQUIT signal (Linux) or Ctrl+Break (Windows).
  * Prints java stack traces for each VM running in the current process.
  */
-void vm_dump_handler(int UNREF x) {
+void vm_dump_handler() {
     int nVMs;
     jint status = JNI_GetCreatedJavaVMs(NULL, 0, &nVMs);
     assert(nVMs <= 1);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp Tue Mar 18 04:31:02 2008
@@ -39,6 +39,7 @@
 
 #include "port_filepath.h"
 #include "port_dso.h"
+#include "port_mutex.h"
 #include <apr_strings.h>
 #include <apr_atomic.h>
 
@@ -261,7 +262,7 @@
 
     memset(newenv, 0, sizeof(TIEnv));
 
-    IDATA error_code1 = hymutex_create(&newenv->environment_data_lock,
+    IDATA error_code1 = port_mutex_create(&newenv->environment_data_lock,
         APR_THREAD_MUTEX_NESTED);
     if (error_code1 != APR_SUCCESS)
     {
@@ -273,7 +274,7 @@
     error_code = newenv->allocate_extension_event_callbacks_table();
     if (error_code != JVMTI_ERROR_NONE)
     {
-        hymutex_destroy(&newenv->environment_data_lock);
+        port_mutex_destroy(&newenv->environment_data_lock);
         _deallocate((unsigned char *)newenv);
         *env = NULL;
         return error_code;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp Tue Mar 18 04:31:02 2008
@@ -38,6 +38,7 @@
 #include "jvmti_break_intf.h"
 #include "cci.h"
 #include "port_thread.h"
+#include "port_crash_handler.h"
 
 
 #if (defined _IA32_) || (defined _EM64T_)
@@ -608,7 +609,7 @@
     VMBreakPoint* bp = find_breakpoint(addr);
     if (NULL == bp) {
         // breakpoint could be deleted by another thread
-        assert(*((unsigned char *)addr) != INSTRUMENTATION_BYTE);
+        assert(!port_is_breakpoint_set(addr));
         unlock();
         // Transfer execution back to the original register
         // context. In case the target location happens to be
@@ -1299,11 +1300,7 @@
         assert(bp->disasm);
 
         // code instrumentation
-        if (ncai_read_memory(bp->addr, 1, &bp->saved_byte) != NCAI_ERROR_NONE)
-            return false;
-
-        unsigned char b = (unsigned char)INSTRUMENTATION_BYTE;
-        if (ncai_write_memory(bp->addr, 1, &b) != NCAI_ERROR_NONE)
+        if (port_set_breakpoint(bp->addr, (unsigned char*)&bp->saved_byte) != 0)
             return false;
     }
 
@@ -1331,7 +1328,7 @@
             << (bp->method ? method_get_descriptor((Method*)bp->method) : "" )
             << " :" << bp->location << " :" << bp->addr);
 
-        if (ncai_write_memory(bp->addr, 1, &bp->saved_byte) != NCAI_ERROR_NONE)
+        if (port_clear_breakpoint(bp->addr, bp->saved_byte) != 0)
             return false;
     }
 
@@ -1345,13 +1342,6 @@
 //////////////////////////////////////////////////////////////////////////////
 
 
-void __cdecl process_native_breakpoint_event(Registers* regs)
-{
-    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    ti->vm_brpt->process_native_breakpoint(regs);
-}
-
-
 bool jvmti_jit_breakpoint_handler(Registers *regs)
 {
     NativeCodePtr native_location = (NativeCodePtr)regs->get_ip();
@@ -1397,9 +1387,7 @@
     }
 #endif
 
-    NativeCodePtr callback = (NativeCodePtr)process_native_breakpoint_event;
-    port_set_longjump_regs(callback, regs, 1, regs);
-
+    ti->vm_brpt->process_native_breakpoint(regs);
     return true;
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp?rev=638327&r1=638326&r2=638327&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp Tue Mar 18 04:31:02 2008
@@ -22,6 +22,7 @@
  * JVMTI capability API
  */
 
+#include "port_mutex.h"
 #include "jvmti_direct.h"
 #include "jvmti_utils.h"
 #include "jvmti_tags.h"
@@ -446,13 +447,13 @@
     if (removed_caps.can_tag_objects) {
         // clear tags on relinquishing can_tag_objects capability
         ti_env = reinterpret_cast<TIEnv *>(env);
-        hymutex_lock(&ti_env->environment_data_lock);
+        port_mutex_lock(&ti_env->environment_data_lock);
         if (ti_env->tags) {
             ti_env->tags->clear();
             delete ti_env->tags;
             ti_env->tags = NULL;
         }
-        hymutex_unlock(&ti_env->environment_data_lock);
+        port_mutex_unlock(&ti_env->environment_data_lock);
 
         ti->reset_global_capability(DebugUtilsTI::TI_GC_ENABLE_TAG_OBJECTS);
     }