From: Pavel Afremov Date: Mon, 25 Sep 2006 18:21:47 +0400 Subject: [PATCH] Use IDATA instead of int for pointer conversion. This fixes unit tests on Linux/x86_64. --- build/make/targets/cunit.test.xml | 5 +++++ vm/include/open/hycomp.h | 4 ++-- vm/include/open/thread_externals.h | 9 +++++---- vm/tests/unit/thread/test_native_suspend.c | 4 ++-- vm/tests/unit/thread/test_native_thin_monitor.c | 4 ++-- vm/tests/unit/thread/utils/tm2vm.c | 6 +++--- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/build/make/targets/cunit.test.xml b/build/make/targets/cunit.test.xml index 316ffbf..c118af9 100644 --- a/build/make/targets/cunit.test.xml +++ b/build/make/targets/cunit.test.xml @@ -49,6 +49,11 @@ Version: $Revision$ + diff --git a/vm/include/open/hycomp.h b/vm/include/open/hycomp.h index af7fa4d..b6d7309 100644 --- a/vm/include/open/hycomp.h +++ b/vm/include/open/hycomp.h @@ -46,7 +46,7 @@ EXE_EXTENSION_CHAR: the executable has a #define HY_PLATFORM_DOUBLE_ORDER #if defined(LINUX) /* NOTE: Linux supports different processors -- do not assume 386 */ -#if defined(LINUXPPC64) +#if defined(LINUXPPC64) || defined(POINTER64) #define DATA_TYPES_DEFINED typedef unsigned long int UDATA; /* 64bits */ typedef unsigned long int U_64; @@ -59,7 +59,7 @@ typedef signed int I_32; typedef signed short I_16; typedef signed char I_8; //typedef U_32 BOOLEAN; -#if defined(LINUXPPC64) +#if defined(LINUXPPC64) || defined(POINTER64) #define TOC_UNWRAP_ADDRESS(wrappedPointer) ((void *) (wrappedPointer)[0]) #define TOC_STORE_TOC(dest,wrappedPointer) (dest = ((UDATA*)wrappedPointer)[1]) #endif diff --git a/vm/include/open/thread_externals.h b/vm/include/open/thread_externals.h old mode 100644 new mode 100755 index 63d9791..a48e91d --- a/vm/include/open/thread_externals.h +++ b/vm/include/open/thread_externals.h @@ -22,6 +22,7 @@ #ifndef OPEN_THREAD_EXTERNALS_H #define OPEN_THREAD_EXTERNALS_H #include "open/types.h" +#include "open/hycomp.h" #include #include "jvmti_types.h" #ifdef __cplusplus @@ -72,11 +73,11 @@ VMEXPORT void *vm_jthread_get_tm_data(jt /** * registtrate thread in VM, so it could execute Java */ -VMEXPORT int vm_attach(); +VMEXPORT IDATA vm_attach(); /** * free java related resources before thread exit */ -VMEXPORT int vm_detach(); +VMEXPORT IDATA vm_detach(); /** * creates exception object using given class name and message and throws it @@ -85,13 +86,13 @@ VMEXPORT int vm_detach(); * @param[in] message char* -message * @return int. */ -VMEXPORT int jthread_throw_exception(char* name, char* message); +VMEXPORT IDATA jthread_throw_exception(char* name, char* message); /** * Throws given exception object; Desides whether current thread is unwindable * and throws it, raises exception otherwise; */ -VMEXPORT int jthread_throw_exception_object(jobject object); +VMEXPORT IDATA jthread_throw_exception_object(jobject object); // TI support interface VMEXPORT void jvmti_send_thread_start_end_event(int); diff --git a/vm/tests/unit/thread/test_native_suspend.c b/vm/tests/unit/thread/test_native_suspend.c index a1d4ff1..e95a93e 100644 --- a/vm/tests/unit/thread/test_native_suspend.c +++ b/vm/tests/unit/thread/test_native_suspend.c @@ -110,14 +110,14 @@ int test_hythread_thread_suspend_all(voi hythread_join(thread); - tf_assert_same((int)args[1], 1); + tf_assert_same((IDATA)args[1], 1); return 0; } int start_proc(void *args) { hythread_thin_monitor_t *lockword_ptr = (hythread_thin_monitor_t*)((void**)args)[0]; - int *ret = (int*)args+1; + IDATA *ret = (IDATA*)args+1; IDATA status; //wait to start diff --git a/vm/tests/unit/thread/test_native_thin_monitor.c b/vm/tests/unit/thread/test_native_thin_monitor.c index 90bef9c..a08416d 100644 --- a/vm/tests/unit/thread/test_native_thin_monitor.c +++ b/vm/tests/unit/thread/test_native_thin_monitor.c @@ -150,7 +150,7 @@ int test_hythread_thin_monitor_enter_con hythread_suspend_enable(); hythread_join(thread); - tf_assert_same((int)args[1], 1); + tf_assert_same((IDATA)args[1], 1); hythread_suspend_disable(); status = hythread_thin_monitor_enter(&lockword_ptr); tf_assert_same(status, TM_ERROR_NONE); @@ -176,7 +176,7 @@ int test_hythread_thin_monitor_enter_con int start_proc(void *args) { hythread_thin_monitor_t *lockword_ptr = (hythread_thin_monitor_t*)((void**)args)[0]; - int *ret = (int*)args+1; + IDATA *ret = (IDATA*)args+1; IDATA status; hythread_suspend_disable(); status = hythread_thin_monitor_enter(lockword_ptr); diff --git a/vm/tests/unit/thread/utils/tm2vm.c b/vm/tests/unit/thread/utils/tm2vm.c old mode 100644 new mode 100755 index 4204222..e45dbcf --- a/vm/tests/unit/thread/utils/tm2vm.c +++ b/vm/tests/unit/thread/utils/tm2vm.c @@ -60,7 +60,7 @@ void vm_jthread_set_tm_data(jthread jt, IDATA jthread_throw_exception(char* name, char* message) { return 0; } -VMEXPORT int jthread_throw_exception_object(jobject object) { +VMEXPORT IDATA jthread_throw_exception_object(jobject object) { return 0; } @@ -89,10 +89,10 @@ int ti_is_enabled(){ } //-------------------------------------------------------------------------------- -int vm_attach() { +IDATA vm_attach() { return 0; } -int vm_detach() { +IDATA vm_detach() { return 0; } void jvmti_send_thread_start_end_event(int is_start) { diff --git a/vm/vmcore/src/thread/thread_generic.cpp b/vm/vmcore/src/thread/thread_generic.cpp old mode 100644 new mode 100755 -- 1.4.1