[penberg/jato] 6ede8b: vm: fix vm_jni_get_static_double_field()
Branch: refs/heads/master Home: http://github.com/penberg/jato Commit: 6ede8bbf01a4ace9b875f14c206c06db90df2c85 http://github.com/penberg/jato/commit/6ede8bbf01a4ace9b875f14c206c06db90df2c85 Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M vm/jni-interface.c Log Message: --- vm: fix vm_jni_get_static_double_field() The function incorrectly used non-static field getter which was tracked down with help of valgrind: ==6229== Invalid read of size 4 ==6229==at 0x8075E8C: vm_jni_get_static_double_field (object.h:154) ==6229==by 0x639A3B6: Java_java_lang_VMDouble_initIDs (in /usr/lib/classpath/libjavalang.so.0.0.0) ==6229==by 0x89DCC34: ??? ==6229==by 0x218BB927: ??? ==6229==by 0x806B6B6: jit_magic_trampoline (class.h:99) ==6229==by 0x89DCA3C: ??? ==6229==by 0x89DCB2D: ??? ==6229==by 0x1EEF47A7: ??? ==6229==by 0x1EEF47A7: ??? ==6229==by 0x1EEF47A7: ??? ==6229==by 0x1EEF47A7: ??? ==6229==by 0x1EEF47A7: ??? ==6229== Address 0x1f0d51f8 is not stack'd, malloc'd or (recently) free'd Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg Commit: 9330aa7df63011f2e6df6cbcfb3a909211347c2a http://github.com/penberg/jato/commit/9330aa7df63011f2e6df6cbcfb3a909211347c2a Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M vm/jni-interface.c Log Message: --- vm: fix vm_jni_set_static_*() Those functions were using non-static field setters on a class object, which is incorrect. Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg Commit: 5fbb06fd52065a765ed2d237c8dcc5c793c23808 http://github.com/penberg/jato/commit/5fbb06fd52065a765ed2d237c8dcc5c793c23808 Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M vm/jni-interface.c Log Message: --- vm: implement all GetStatic*Field() JNI functions Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg Commit: 72ce67536256679575a9b93f3d92215b4d98bbee http://github.com/penberg/jato/commit/72ce67536256679575a9b93f3d92215b4d98bbee Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M vm/jni-interface.c Log Message: --- vm: fix vm_jni_new_object_a() We should call the constructor virtually not statically. Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg Commit: 25dc156f8982712c09d10fab8ef33ab8d738824e http://github.com/penberg/jato/commit/25dc156f8982712c09d10fab8ef33ab8d738824e Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M vm/jni-interface.c Log Message: --- vm: fix pack_args() The condition should be negated. Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 3/5] vm: implement all GetStatic*Field() JNI functions
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 52 ++-- 1 files changed, 26 insertions(+), 26 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index b3b205e..ac8188f 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -727,24 +727,24 @@ vm_jni_get_static_field_id(struct vm_jni_env *env, jclass clazz, return fb; } -static jdouble -vm_jni_get_static_double_field(struct vm_jni_env *env, jobject object, - jfieldID field) -{ - enter_vm_from_jni(); - - if (!object) { - signal_new_exception(vm_java_lang_NullPointerException, NULL); - return 0; - } - - if (vm_field_type(field) != J_DOUBLE || !vm_field_is_static(field)) { - NOT_IMPLEMENTED; - return 0; - } +#define DEFINE_GET_STATIC_FIELD(func, type, get) \ + static type \ + func(struct vm_jni_env *env, jobject object, jfieldID field)\ + { \ + enter_vm_from_jni();\ + \ + return get(field); \ + } \ - return static_field_get_double(field); -} +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_object_field, jobject, static_field_get_object); +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_boolean_field, jboolean, static_field_get_boolean); +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_byte_field, jbyte, static_field_get_byte); +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_char_field, jchar, static_field_get_char); +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_short_field, jshort, static_field_get_short); +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_int_field, jint, static_field_get_int); +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_long_field, jlong, static_field_get_long); +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_float_field, jfloat, static_field_get_float); +DEFINE_GET_STATIC_FIELD(vm_jni_get_static_double_field, jdouble, static_field_get_double); #define DEFINE_SET_STATIC_FIELD(func, type, set) \ static void \ @@ -1224,19 +1224,19 @@ void *vm_jni_native_interface[] = { vm_jni_call_static_void_method, vm_jni_call_static_void_method_v, NULL, /* CallStaticVoidMethodA */ - vm_jni_get_static_field_id, /* GetStaticFieldID */ + vm_jni_get_static_field_id, /* 145 */ - NULL, /* GetStaticObjectField */ - NULL, /* GetStaticBooleanField */ - NULL, /* GetStaticByteField */ - NULL, /* GetStaticCharField */ - NULL, /* GetStaticShortField */ + vm_jni_get_static_object_field, + vm_jni_get_static_boolean_field, + vm_jni_get_static_byte_field, + vm_jni_get_static_char_field, + vm_jni_get_static_short_field, /* 150 */ - NULL, /* GetStaticIntField */ - NULL, /* GetStaticLongField */ - NULL, /* GetStaticFloatField */ + vm_jni_get_static_int_field, + vm_jni_get_static_long_field, + vm_jni_get_static_float_field, vm_jni_get_static_double_field, vm_jni_set_static_object_field, -- 1.6.0.4 -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 5/5] vm: fix pack_args()
The condition should be negated. Signed-off-by: Tomek Grabiec --- vm/jni-interface.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index cc1e7ca..dca174a 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -912,12 +912,12 @@ static inline void pack_args(struct vm_method *vmm, unsigned long *packed_args, idx = 0; list_for_each_entry(arg, &vmm->args, list_node) { - if (arg->type_info.vm_type != J_LONG && - arg->type_info.vm_type != J_DOUBLE) { + if (arg->type_info.vm_type == J_LONG || + arg->type_info.vm_type == J_DOUBLE) { packed_args[packed_idx++] = low_64(args[idx]); packed_args[packed_idx++] = high_64(args[idx++]); } else { - packed_args[packed_idx++] = args[idx++] & ~0ul; + packed_args[packed_idx++] = low_64(args[idx++]); } } #else -- 1.6.0.4 -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 2/5] vm: fix vm_jni_set_static_*()
Those functions were using non-static field setters on a class object, which is incorrect. Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 20 ++-- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 7e502b7..b3b205e 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -753,18 +753,18 @@ vm_jni_get_static_double_field(struct vm_jni_env *env, jobject object, { \ enter_vm_from_jni();\ \ - set(object, field, value); \ + set(field, value); \ } \ -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_object_field, jobject, field_set_object); -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_boolean_field, jboolean, field_set_boolean); -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_byte_field, jbyte, field_set_byte); -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_char_field, jchar, field_set_char); -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_short_field, jshort, field_set_short); -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_int_field, jint, field_set_int); -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_long_field, jlong, field_set_long); -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_float_field, jfloat, field_set_float); -DEFINE_SET_STATIC_FIELD(vm_jni_set_static_double_field, jdouble, field_set_double); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_object_field, jobject, static_field_set_object); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_boolean_field, jboolean, static_field_set_boolean); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_byte_field, jbyte, static_field_set_byte); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_char_field, jchar, static_field_set_char); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_short_field, jshort, static_field_set_short); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_int_field, jint, static_field_set_int); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_long_field, jlong, static_field_set_long); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_float_field, jfloat, static_field_set_float); +DEFINE_SET_STATIC_FIELD(vm_jni_set_static_double_field, jdouble, static_field_set_double); static jboolean vm_jni_call_static_boolean_method(struct vm_jni_env *env, jclass clazz, -- 1.6.0.4 -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 4/5] vm: fix vm_jni_new_object_a()
We should call the constructor virtually not statically. Signed-off-by: Tomek Grabiec --- vm/jni-interface.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index ac8188f..cc1e7ca 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -945,7 +945,7 @@ vm_jni_new_object_a(struct vm_jni_env *env, jclass clazz, jmethodID method, packed_args[0] = (unsigned long) result; pack_args(method, packed_args + 1, args); - vm_call_method_a(method, packed_args); + vm_call_method_this_a(method, result, packed_args); return result; } -- 1.6.0.4 -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 1/5] vm: fix vm_jni_get_static_double_field()
The function incorrectly used non-static field getter which was tracked down with help of valgrind: ==6229== Invalid read of size 4 ==6229==at 0x8075E8C: vm_jni_get_static_double_field (object.h:154) ==6229==by 0x639A3B6: Java_java_lang_VMDouble_initIDs (in /usr/lib/classpath/libjavalang.so.0.0.0) ==6229==by 0x89DCC34: ??? ==6229==by 0x218BB927: ??? ==6229==by 0x806B6B6: jit_magic_trampoline (class.h:99) ==6229==by 0x89DCA3C: ??? ==6229==by 0x89DCB2D: ??? ==6229==by 0x1EEF47A7: ??? ==6229==by 0x1EEF47A7: ??? ==6229==by 0x1EEF47A7: ??? ==6229==by 0x1EEF47A7: ??? ==6229==by 0x1EEF47A7: ??? ==6229== Address 0x1f0d51f8 is not stack'd, malloc'd or (recently) free'd Signed-off-by: Tomek Grabiec --- vm/jni-interface.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 73cfba2..7e502b7 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -743,7 +743,7 @@ vm_jni_get_static_double_field(struct vm_jni_env *env, jobject object, return 0; } - return field_get_double(object, field); + return static_field_get_double(field); } #define DEFINE_SET_STATIC_FIELD(func, type, set) \ -- 1.6.0.4 -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[penberg/jato] bf7c0e: vm: fix parse_method_type()
Branch: refs/heads/master Home: http://github.com/penberg/jato Commit: bf7c0e9bbcd4710172ec8e1f8702cee82be050ab http://github.com/penberg/jato/commit/bf7c0e9bbcd4710172ec8e1f8702cee82be050ab Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M vm/types.c Log Message: --- vm: fix parse_method_type() Call arguments were incorrectly inserted to args list causing the list to represent the reverse order of arguments. Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg Commit: 336449668625e94afe46c64c4e210b6ecac69a90 http://github.com/penberg/jato/commit/336449668625e94afe46c64c4e210b6ecac69a90 Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M Makefile M include/vm/object.h M test/arch-x86/Makefile M vm/jato.c A vm/monitor.c M vm/object.c Log Message: --- vm: move monitor operations to vm/monitor.c Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg Commit: ad59fe2214fd47f4f4b7ea3e80c055b3c413ba4f http://github.com/penberg/jato/commit/ad59fe2214fd47f4f4b7ea3e80c055b3c413ba4f Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M vm/monitor.c Log Message: --- vm: unify code in vm_monitor_wait() and vm_monitor_timedwait() Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg Commit: 3069613a2b92218830deea6bc2d1c3c68a182a4e http://github.com/penberg/jato/commit/3069613a2b92218830deea6bc2d1c3c68a182a4e Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M Makefile M include/vm/preload.h M include/vm/thread.h A regression/jvm/MonitorTest.java M test/vm/preload-stub.c M vm/jato.c M vm/monitor.c M vm/preload.c M vm/thread.c Log Message: --- vm: implement thread interruption operations. The following natives are implemented: java/lang/VMThread.isInterrupted() java/lang/VMThread.interrupted() java/lang/VMThread.interrupt() Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg Commit: 14b43a09c93ab5f409c13d40c1efa86a10bbeb63 http://github.com/penberg/jato/commit/14b43a09c93ab5f409c13d40c1efa86a10bbeb63 Author: Tomek Grabiec Date: 2009-10-08 (Thu, 08 Oct 2009) Changed paths: M arch/x86/insn-selector.brg M arch/x86/unwind_32.S M include/jit/exception.h M jit/exception.c Log Message: --- x86: introduce valgrind workaround for exception guards. Installing signal bottom half doesn't work well in valgrind environment (it causes an error and application is killed). This introduces a workaround for this situation when caused by exception guards. Exception guards are used to catch signalled exceptions via SIGSEGV handler and transfer control to the exception handler or unwind. The workaround is to inline exception check and don't use signal handlers when run on valgrind. Signed-off-by: Tomek Grabiec Signed-off-by: Pekka Enberg -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel