[PATCH 10/15] vm: implement VMObject.wait()

2009-07-28 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index abec6ae..bc81864 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -567,6 +567,17 @@ static jlong native_vmsystem_nano_time(void

[PATCH 07/15] vm: implement monitor operations

2009-07-28 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |2 +- include/vm/object.h | 36 +- scripts/build/test.mk |2 +- vm/object.c | 196 +++-- 4 files changed, 225 insertions(+), 11 deletions(-) diff --git a/Makefile

[PATCH 08/15] vm: implement VMObject.notifyAll()

2009-07-28 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index e2d7c66..a437082 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -546,6 +546,14 @@ static void native_vmthread_start(struct vm_object *vmthread

[PATCH 01/15] vm: implement VMClass.forName()

2009-07-28 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/preload.h |1 + vm/jato.c| 37 + vm/preload.c |2 ++ 3 files changed, 40 insertions(+), 0 deletions(-) diff --git a/include/vm/preload.h b/include/vm/preload.h index 867f9fc..d7f5a52

[PATCH 05/15] vm: remove bottom_stack_frame variable

2009-07-28 Thread Tomek Grabiec
We don't need to remember the bottom stack frame because the frame chain always ends with a NULL frame. Signed-off-by: Tomek Grabiec --- include/vm/stack-trace.h |7 --- vm/jato.c|4 vm/stack-trace.c |8 +++- 3 files changed, 3 insertions(+

[PATCH 04/15] vm: print backtrace on JNI function trap

2009-07-28 Thread Tomek Grabiec
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 0d67fcc..28fac8a 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -692,6 +692,6 @@ bool vm_jni_check_trap(void

[PATCH 06/15] vm: initial support for java threads

2009-07-28 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |1 + include/vm/preload.h | 20 include/vm/thread.h| 43 +++- test/arch-x86/Makefile |1 + test/vm/preload-stub.c | 20 test/vm/signal-stub.c |3 + vm/jato.c | 21 vm/preload.c

[PATCH 03/15] vm: implement SetObjectField JNI function

2009-07-28 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 18 +- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 07cfaa4..0d67fcc 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -320,6 +320,22

[PATCH 02/15] vm: implement VMRuntime.runFinalizationForExit()

2009-07-28 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index ff94fba..453376d 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -217,6 +217,10 @@ static void native_vmruntime_exit(int status) exit(status

[RFC][PATCH] jit: set argument index correctly for JNI invocations

2009-07-28 Thread Tomek Grabiec
igned-off-by: Tomek Grabiec --- jit/args.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jit/args.c b/jit/args.c index 5c6ddaa..a6cc721 100644 --- a/jit/args.c +++ b/jit/args.c @@ -84,6 +84,7 @@ struct expression *convert_args(struct stack *mimic_

[PATCH 7/7] jit: fix signal_new_exception_with_cause()

2009-07-26 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/exception.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/jit/exception.c b/jit/exception.c index b1deb30..c5a7160 100644 --- a/jit/exception.c +++ b/jit/exception.c @@ -122,8 +122,7 @@ int signal_new_exception_with_cause(struct

[PATCH 5/7] jit: do not duplicate dup_*() arguments before pushing when they are pure.

2009-07-26 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/ostack-bc.c| 18 test/arch-x86/Makefile |2 + test/jit/bytecode-to-ir-stub.c | 10 test/jit/ostack-bc-test.c | 100 +++- 4 files changed, 48 insertions(+), 82 deletions

[PATCH 6/7] regression: introduce jvm/DupTest.j

2009-07-26 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |1 + regression/jvm/DupTest.j | 294 ++ regression/run-suite.sh |1 + 3 files changed, 296 insertions(+), 0 deletions(-) create mode 100644 regression/jvm/DupTest.j diff --git a

[PATCH 4/7] jit: make get_pure_expr() global

2009-07-26 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/jit/expression.h |1 + jit/expression.c | 14 ++ jit/object-bc.c | 14 -- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/jit/expression.h b/include/jit/expression.h index be53649

[PATCH 3/7] vm: make print_trace() use plain backtrace() when compiled with unit tests

2009-07-26 Thread Tomek Grabiec
igned-off-by: Tomek Grabiec --- arch/x86/backtrace.c | 59 ++- include/vm/backtrace.h |4 +++ include/vm/stack-trace.h |2 + test/vm/stack-trace-stub.c | 33 vm/stack-trace.c |

[PATCH 1/7] x86: print mixed native and java backtrace.

2009-07-26 Thread Tomek Grabiec
rojects/jato/jato/vm/jato.c:737) Compared with the old backtrace for the same situation: Native stack trace: [<08069cd0>] [] [<0846a900>] [<08998e10>] [<0896d658>] [<08069803>] vm_object_alloc+19 (/home/tomek/projects/jato/jato/vm/object.c:43) [] [<

[PATCH 2/7] vm: do not print line number in backtrace when undefined

2009-07-26 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/stack-trace.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/vm/stack-trace.c b/vm/stack-trace.c index 1fe185d..11fc9a7 100644 --- a/vm/stack-trace.c +++ b/vm/stack-trace.c @@ -455,6 +455,9 @@ void print_java_stack_trace_elem

[PATCH 2/2] vm: use Throwable.stackTraceString() for exception printing.

2009-07-26 Thread Tomek Grabiec
As java/lang/String.substring() is now working so is java/lang/Throwable.stackTraceString(). It allows us to get the full exception descripton with just one method call. Signed-off-by: Tomek Grabiec --- include/vm/preload.h |8 +-- test/vm/preload-stub.c |8 +-- vm/preload.c

[PATCH 1/2] jit: fix signal_new_exception_with_cause()

2009-07-26 Thread Tomek Grabiec
Some exception classes have dedicated constructors for setting exception's cause. For such classes we shouldn't set the cause with initCause() bacuuse the cause might be stored somewhere else than Throwable.cause. See for example java/lang/ExceptionInInitializerError class. Signed-off

Re: [PATCH 4/4] vm: use Throwable.stackTraceString() for exception printing.

2009-07-26 Thread Tomek Grabiec
2009/7/26 Tomek Grabiec : > As java/lang/String.substring() is now working so is > java/lang/Throwable.stackTraceString(). It allows us to get the full > exception descripton with just one method call. > > Signed-off-by: Tomek Grabiec > --- >  include/vm/preload.h   |    8 +

[PATCH 4/4] vm: use Throwable.stackTraceString() for exception printing.

2009-07-26 Thread Tomek Grabiec
As java/lang/String.substring() is now working so is java/lang/Throwable.stackTraceString(). It allows us to get the full exception descripton with just one method call. Signed-off-by: Tomek Grabiec --- include/vm/preload.h |8 +-- test/vm/preload-stub.c |8 +-- vm/preload.c

[PATCH 3/4] vm: do not convert special characters to <%d> in string_to_cstr()

2009-07-26 Thread Tomek Grabiec
This leads to a buglet that new line character '\n' is converted to <10> string, so when converting multiple lined strings to C strings we loose line breaks. Same applies for other control characters. Signed-off-by: Tomek Grabiec --- vm/object.c |2 +- 1 files changed, 1

[PATCH 2/4] vm: add support for -Dproperty=value options

2009-07-26 Thread Tomek Grabiec
This can be used to set/override system properties. Signed-off-by: Tomek Grabiec --- vm/jato.c | 141 1 files changed, 122 insertions(+), 19 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index b7f7e3d..f75ca00 100644 --- a/vm

[PATCH 1/4] vm: do not print error when dlopen() fails in vm_jni_load_object()

2009-07-26 Thread Tomek Grabiec
Before library is loaded classpath tries to load it from multiple paths. We shouldn't print eny errors if some of them fail. Signed-off-by: Tomek Grabiec --- vm/jni.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/vm/jni.c b/vm/jni.c index 8c80afe..9af45cb 1

[PATCH 18/22] vm: pass correct call site address to vm_enter_jni()

2009-07-25 Thread Tomek Grabiec
This is needed for native stack trace printing Signed-off-by: Tomek Grabiec --- vm/call.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/vm/call.c b/vm/call.c index 6041494..11c9dca 100644 --- a/vm/call.c +++ b/vm/call.c @@ -64,9 +64,10 @@ vm_call_method_a(struct

[PATCH 14/22] vm: make frame pointed by bottom_stack_frame be included in stack trace

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/stack-trace.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vm/stack-trace.c b/vm/stack-trace.c index 30c0595..4e9638b 100644 --- a/vm/stack-trace.c +++ b/vm/stack-trace.c @@ -162,6 +162,9 @@ static int

[PATCH 15/22] vm: let bottom_stack_frame be NULL outside main() java method.

2009-07-25 Thread Tomek Grabiec
If bottom_stack_frame is not NULL and stack walker is called from outside main() function then it could loop forever. Stack walker can be called in the future outside main() to print the stack trace. Signed-off-by: Tomek Grabiec --- vm/jato.c |2 ++ 1 files changed, 2 insertions(+), 0

[PATCH 07/22] jit: rename throw_exception_from() to throw_from_jit()

2009-07-25 Thread Tomek Grabiec
also rename throw_exception_from_trampoline() to throw_from_trampoline() and throw_exception_from_signal() to throw_from_signal(). Signed-off-by: Tomek Grabiec --- arch/x86/exception.c|8 arch/x86/unwind_32.S|2 +- arch/x86/unwind_64.S|2 +- include/jit

[PATCH 16/22] vm: cleanups in vm/stack-trace.c

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/stack-trace.h | 20 + vm/jato.c|4 ++- vm/stack-trace.c | 69 ++--- 3 files changed, 57 insertions(+), 36 deletions(-) diff --git a/include/vm/stack-trace.h b/include

[PATCH 08/22] vm: save and clear exception before printing.

2009-07-25 Thread Tomek Grabiec
When vm_print_exception() is called from JNI then exception that is printed is signalled. Therefore we have to clear exceptions before printing to be able to detect when exception is thrown from printing code. Signed-off-by: Tomek Grabiec --- vm/stack-trace.c |7 +++ 1 files changed, 7

[PATCH 11/22] x86: advance JNI and VM native call stack offsets before setting entry values.

2009-07-25 Thread Tomek Grabiec
It is more natural behavior to reserve the space before writing to it. Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg | 36 1 files changed, 20 insertions(+), 16 deletions(-) diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn

[PATCH 01/22] vm: define vm_call_method_*() functions for various return types.

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/call.h | 31 ++- vm/call.c | 12 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/include/vm/call.h b/include/vm/call.h index c1ed6bd..557fb86 100644 --- a/include/vm/call.h +++ b

[PATCH 17/22] vm: set ->addr field of stack_trace_elem for JNI methods

2009-07-25 Thread Tomek Grabiec
The ->addr can be set from the return address of ->vm_frame. This makes ->addr field set for all types of stack trace elements. Signed-off-by: Tomek Grabiec --- vm/stack-trace.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/vm/stack-trace.c b/vm/stack-trac

[PATCH 19/22] jit: add compilation unit mapping for trampoline code

2009-07-25 Thread Tomek Grabiec
This is needed to print trampoline's method signature in stack trace. Signed-off-by: Tomek Grabiec --- jit/trampoline.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jit/trampoline.c b/jit/trampoline.c index ba1a495..880a899 100644 --- a/jit/trampoline.c

[PATCH 13/22] vm: make throw_from_signal_bh() a macro

2009-07-25 Thread Tomek Grabiec
Making it a macro rules out the risk of using __builtin_frame_address(). When __builtin_frame_address() is used in a function it is possible that a call to it will be optimized so that new frame is not created. Signed-off-by: Tomek Grabiec --- include/vm/signal.h | 16 test

[PATCH 20/22] vm: zero line_number_table_attribute for native methods

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/method.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/vm/method.c b/vm/method.c index eb618f2..37bd54d 100644 --- a/vm/method.c +++ b/vm/method.c @@ -95,6 +95,9 @@ int vm_method_init(struct vm_method *vmm, /* Hm

[RFC][PATCH 22/22] x86: print mixed native and java backtrace.

2009-07-25 Thread Tomek Grabiec
rojects/jato/jato/vm/jato.c:737) Compared with the old backtrace for the same situation: Native stack trace: [<08069cd0>] [] [<0846a900>] [<08998e10>] [<0896d658>] [<08069803>] vm_object_alloc+19 (/home/tomek/projects/jato/jato/vm/object.c:43) [] [<

[PATCH 21/22] vm: stack_trace_elem_get_cu() should return NULL for non-java elements.

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/stack-trace.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/vm/stack-trace.c b/vm/stack-trace.c index 3d8b723..81ca7aa 100644 --- a/vm/stack-trace.c +++ b/vm/stack-trace.c @@ -306,6 +306,9 @@ void init_stack_trace_elem_current

[PATCH 05/22] vm: remove unnecessary clear_exception() before exception printing

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c |7 +-- 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index 636f6a9..6aa3854 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -736,12 +736,7 @@ main(int argc, char *argv[]) out_check_exception: if

[PATCH 04/22] vm: remove redundant clear_exception()

2009-07-25 Thread Tomek Grabiec
It is unnecessary to clear exception prior to signaling since signaling overrides any pending exception. Signed-off-by: Tomek Grabiec --- vm/class.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/vm/class.c b/vm/class.c index 915e5e0..a96f1b6 100644 --- a/vm/class.c

[PATCH 10/22] jit: remove throw_from_signal()

2009-07-25 Thread Tomek Grabiec
This function can be replaced by signal bottom half with throw_from_signal_bh() call. Less code increases maintainability. Signed-off-by: Tomek Grabiec --- arch/x86/exception.c| 21 - include/jit/exception.h |1 - vm/signal.c |7 ++- 3 files

[PATCH 12/22] x86: fix bug in show_exe_function()

2009-07-25 Thread Tomek Grabiec
function_name might be NULL even if bfd_find_nearest_line() returned value != 0. Signed-off-by: Tomek Grabiec --- arch/x86/backtrace.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/x86/backtrace.c b/arch/x86/backtrace.c index 6b2dde4..9fd28b4 100644 --- a/arch

[PATCH 09/22] jit: remove unused declaration

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/jit/emit-code.h |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/include/jit/emit-code.h b/include/jit/emit-code.h index c9cf8ee..f08bee6 100644 --- a/include/jit/emit-code.h +++ b/include/jit/emit-code.h @@ -40,7 +40,5 @@ extern

[PATCH 02/22] vm: call java methods from VM with vm_call_method()

2009-07-25 Thread Tomek Grabiec
address and calling it can steel be used where performance is important and we are sure that no exception can be signalled in this place. Signed-off-by: Tomek Grabiec --- arch/mmix/include/arch/call.h| 10 +++ arch/mmix/include/arch/stack-frame.h |5 ++ include/vm/preload.h

[PATCH 06/22] vm: fix comment in vm_call_method_a()

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/call.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/call.c b/vm/call.c index 718917e..6041494 100644 --- a/vm/call.c +++ b/vm/call.c @@ -48,9 +48,9 @@ vm_call_method_a(struct vm_method *method, unsigned long *args

[PATCH 03/22] vm: remove junk declaration

2009-07-25 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 6a5488c..07cfaa4 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -262,8 +262,6

[PATCH 2/2] vm: println(null) should print "null\n" instead of throwing NullPointerException

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index b37ace4..636f6a9 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -214,8 +214,7 @@ native_vmruntime_native_load(struct vm_object *name, static void

[PATCH 1/2] vm: add jato/internal/VM.throwNullPointerException()

2009-07-23 Thread Tomek Grabiec
It's needed for testing stack trace creation from VM native methods. Signed-off-by: Tomek Grabiec --- regression/jato/internal/VM.java |1 + regression/jvm/StackTraceTest.java |4 ++-- vm/jato.c |8 3 files changed, 11 insertions(+), 2 dele

[PATCH] regression: fix formatting in jvm/StackTraceTest.java

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- regression/jvm/StackTraceTest.java | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/regression/jvm/StackTraceTest.java b/regression/jvm/StackTraceTest.java index 6900d6c..a2aa3fd 100644 --- a/regression/jvm

[PATCH 13/13] regression: add test for UnsatisfiedLinkError stack trace.

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- regression/jvm/StackTraceTest.java | 25 + 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/regression/jvm/StackTraceTest.java b/regression/jvm/StackTraceTest.java index dd364ca..6900d6c 100644 --- a/regression/jvm

[PATCH 12/13] jit: fix bug in throw_from_native()

2009-07-23 Thread Tomek Grabiec
We should compare vm_native_stack_get_frame() with _current_ frame not the caller's frame. Signed-off-by: Tomek Grabiec --- include/jit/exception.h |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/include/jit/exception.h b/include/jit/exception.h index 68a1da1..31

[PATCH 11/13] jit: rename jit_native_trampoline() to jit_jni_trampoline()

2009-07-23 Thread Tomek Grabiec
VM natives no longer have trampolines because they are linked when their method object is initialized. Signed-off-by: Tomek Grabiec --- jit/trampoline.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jit/trampoline.c b/jit/trampoline.c index 369da6d..ba1a495

[PATCH 10/13] regression: introduce jvm/StackTraceTest.java

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |1 + regression/jvm/ExceptionsTest.java | 25 -- regression/jvm/StackTraceTest.java | 90 regression/jvm/TestCase.java | 18 +++ regression/run-suite.sh

[PATCH 09/13] vm: test for null pointer in native_vmruntime_println()

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index ef4b2e2..02f060d 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -213,6 +213,12 @@ native_vmruntime_native_load(struct vm_object *name, static void

[PATCH 08/13] vm: put body of enter_vm_from_jni macro in do { } while(0)

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/stack-trace.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/vm/stack-trace.h b/include/vm/stack-trace.h index f6db886..f326c41 100644 --- a/include/vm/stack-trace.h +++ b/include/vm/stack-trace.h @@ -82,10 +82,10

[PATCH 07/13] vm: fix comment for alloc_offset_guard()

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/guard-page.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/guard-page.c b/vm/guard-page.c index 420230a..f47c936 100644 --- a/vm/guard-page.c +++ b/vm/guard-page.c @@ -37,8 +37,8 @@ * alloc_offset_guard - allocates a memory

[PATCH 06/13] vm: fix call stack traversal when called from JNI trampoline

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/stack-trace.h |3 +++ jit/trampoline.c |6 ++ vm/stack-trace.c | 21 +++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/include/vm/stack-trace.h b/include/vm/stack-trace.h index 4bde292..

[PATCH 05/13] vm: clear exceptions before calling method from VM.

2009-07-23 Thread Tomek Grabiec
Any pending exceptions must be cleared before calling method from VM and restored upon return. Otherwise exception will be caught by the first encountered exception test which is not a correct behavior. Signed-off-by: Tomek Grabiec --- vm/call.c | 23 --- 1 files changed

[PATCH 04/13] jit: signal_exception() should override already signalled exception

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/exception.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/jit/exception.c b/jit/exception.c index 251bd17..d8eeed5 100644 --- a/jit/exception.c +++ b/jit/exception.c @@ -84,9 +84,6 @@ void thread_init_exceptions(void) */ void

[PATCH 03/13] vm: rename vm_enter_jni_interface() to enter_vm_from_jni()

2009-07-23 Thread Tomek Grabiec
This also renames ->jni_interface_frame field of struct jni_stack_entry to ->vm_frame VM can be entered from JNI not only through JNI interface function but also through JNI trampoline (jit_native_trampoline). Signed-off-by: Tomek Grabiec --- include/vm/stack-trace.h

[PATCH 02/13] vm: optimize vm_call_method_a() a bit.

2009-07-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/call.c | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/vm/call.c b/vm/call.c index 09ac7d1..073e043 100644 --- a/vm/call.c +++ b/vm/call.c @@ -43,23 +43,24 @@ vm_call_method_a(struct vm_method *method, unsigned long

[PATCH 01/13] vm: lock on compilation unit's mutex before accessing its fields.

2009-07-23 Thread Tomek Grabiec
s set 'true' while ->native_ptr is not set yet. Using mutexes to protect the data ensures that memory barriers are executed on lock acquisition/release. Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg | 25 - include/vm/method.h| 22 +

[PATCH 14/14] vm: remove __vm_native macro and linker scripts

2009-07-22 Thread Tomek Grabiec
These are no longer used. Signed-off-by: Tomek Grabiec --- Makefile |3 +- arch/x86/jato_32.ld | 199 arch/x86/jato_64.ld | 220 - include/vm/fault-inject.h |6 +- include

[PATCH 13/14] vm: correct stack walker with presence of VM and JNI natives.

2009-07-22 Thread Tomek Grabiec
d guard memory region. For overflow offsets memory pages are hidden and SIGSEGV handler throws StackOverflowError when such access happens. This makes stack overflow check require only a single test instruction. Signed-off-by: Tomek Grabiec --- arch/x86/include/arch/cal

[PATCH 12/14] vm: cleanups is stack-trace.c

2009-07-22 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/stack-trace.h |4 +- vm/stack-trace.c | 97 - 2 files changed, 61 insertions(+), 40 deletions(-) diff --git a/include/vm/stack-trace.h b/include/vm/stack-trace.h index 3ecdb74..e3daf1d 100644

[PATCH 11/14] vm: introduce ->native_ptr field in struct compilation_unit

2009-07-22 Thread Tomek Grabiec
already compiled instead calling trampoline first. Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg | 27 +-- include/jit/compilation-unit.h |9 + include/vm/method.h| 26 +++--- jit/compiler.c

[PATCH 07/14] vm: check for null in native_vmfile_is_directory()

2009-07-22 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index 6086290..e3163bd 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -371,6 +371,12 @@ native_vmfile_is_directory(struct vm_object *dirpath) char

[PATCH 09/14] x86: emit exception test after each JNI call

2009-07-22 Thread Tomek Grabiec
JNI methods can signal exceptions but those exceptions are not technically thrown until JNI method returns to JIT code. We must therefore test for exceptions signalled by JNI methods upon return. This test is cheap for non-exceptional flow but is expensive in the other case. Signed-off-by: Tomek

[PATCH 10/14] vm: fix vm_stack_trace_element_to_string()

2009-07-22 Thread Tomek Grabiec
We should not call vm_string_cstr() on null string objects. Signed-off-by: Tomek Grabiec --- vm/stack-trace.c | 15 --- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/vm/stack-trace.c b/vm/stack-trace.c index 24eb29f..cabbfae 100644 --- a/vm/stack-trace.c +++ b/vm

[PATCH 06/14] vm: introduce alloc_offset_guard()

2009-07-22 Thread Tomek Grabiec
fail very rarely and need to be as fast as possible. Signed-off-by: Tomek Grabiec --- include/vm/guard-page.h |1 + vm/guard-page.c | 35 +++ 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/include/vm/guard-page.h b/include/vm/guard

[PATCH 05/14] vm: replace alloc_page(void) with alloc_pages(int)

2009-07-22 Thread Tomek Grabiec
We will need that to allocate complex guards with multiple pages. Signed-off-by: Tomek Grabiec --- include/vm/alloc.h |2 +- jit/text.c |4 ++-- vm/guard-page.c|2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/vm/alloc.h b/include/vm/alloc.h

[PATCH 02/14] vm: cleanup in call.c

2009-07-22 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/call.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vm/call.c b/vm/call.c index 83c0bb4..cbd5177 100644 --- a/vm/call.c +++ b/vm/call.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Tomasz Grabiec + * Copyright (c) 2009 Tomasz

[PATCH 08/14] x86: fix bug in native_call()

2009-07-22 Thread Tomek Grabiec
The stack pointer was not restored after call because %ecx is always 0 after arguments are copied because it's decremented by 'rep movsb'. This also optimizes argument copying by using movsd instead of movsb. Signed-off-by: Tomek Grabiec --- arch/x86/include/arc

[PATCH 04/14] x86: fix bad use-def declaration for INSN_MOV_REG_MEMDISP

2009-07-22 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/use-def.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/use-def.c b/arch/x86/use-def.c index 652314d..ecd8bda 100644 --- a/arch/x86/use-def.c +++ b/arch/x86/use-def.c @@ -80,7 +80,7 @@ static struct insn_info

[PATCH 03/14] x86: introduce INSN_MOV_IP_THREAD_LOCAL_MEMBASE

2009-07-22 Thread Tomek Grabiec
This instruction saves the address of itself to a memory location with GS segment override prefix. It will be needed for storing the approximate call site address into JNI call stack entry. Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c| 35

[PATCH 01/14] x86: add various thread local move instructions

2009-07-22 Thread Tomek Grabiec
This adds: INSN_MOV_IMM_THREAD_LOCAL_MEMBASE, INSN_MOV_REG_THREAD_LOCAL_MEMBASE, INSN_MOV_REG_THREAD_LOCAL_MEMDISP Those will be needed for selecting code for storing information into JNI and VM native call stack entries. Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c

Re: [PATCH 2/2] rfc: x86: show jit functions in native backtrace

2009-07-20 Thread Tomek Grabiec
2009/7/20 Vegard Nossum : > Cc: Tomek Grabiec > Signed-off-by: Vegard Nossum > --- >  arch/x86/backtrace.c |   35 +++ >  1 files changed, 35 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/backtrace.c b/arch/x86/backtrace.c > index

[PATCH] jit: add explicit null checks for arraylength, putfield and getfield

2009-07-20 Thread Tomek Grabiec
this should be merged before: [PATCH] vm: only throw NullPointerException on exactly-NULL pointers Signed-off-by: Tomek Grabiec --- jit/object-bc.c |6 +++--- test/jit/object-bc-test.c |3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jit/object-bc.c b/jit

Re: [PATCH] vm: only throw NullPointerException on exactly-NULL pointers

2009-07-20 Thread Tomek Grabiec
; -       if ((unsigned long)si->si_addr < (unsigned long)getpagesize()) { > +       if (!si->si_addr) { >                /* We must be extra caucious here because IP might be >                   invalid */ >                if (get_signal_source_cu(ctx) == NULL) > -- > 1.6.0.6 &g

Re: [RFC PATCH 7/9] x86-64: fix stack frame operations

2009-07-15 Thread Tomek Grabiec
t; > ??#define ARGS_START_OFFSET (sizeof(unsigned long) * 5) >> > +#else >> > +#define ARGS_START_OFFSET (sizeof(unsigned long) * 7) >> > +#endif >> >> It would be nice to know what exactly the 7 is. Can we have a pretty >> diagram lik

Re: [PATCH 2/7] jit: fix verify_correct_nesting() and add verify_no_recursion()

2009-07-15 Thread Tomek Grabiec
2009/7/15 Pekka Enberg : > On Tue, 2009-07-14 at 21:12 +0200, Tomek Grabiec wrote: >> verify_no_recursion() checks whether all call sites of given subroutine >> all outside its body. It's a requirement for inlining to be possible. > > Does this mean we won't be abl

[PATCH 3/3] vm: implement JNI CallStaticVoidMethod, CallStaticByteMethod and CallStaticObjectMethod

2009-07-15 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 70 +++ 1 files changed, 64 insertions(+), 6 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 2b6dc28..7614200 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c

[PATCH 2/3] vm: introduce functions for calling java methods

2009-07-15 Thread Tomek Grabiec
These functions are necessary to implement JNI interface functions for calling java methods. Signed-off-by: Tomek Grabiec --- Makefile |3 +- arch/x86/include/arch/call.h | 31 ++ include/vm/call.h| 13 ++ vm/call.c

[PATCH 1/3] vm: fix argument passing for JNI methods

2009-07-15 Thread Tomek Grabiec
her methods. Signed-off-by: Tomek Grabiec --- include/vm/method.h |2 +- jit/args.c | 37 ++ jit/invoke-bc.c | 55 ++ jit/trace-jit.c |2 +- vm/method.c |

[PATCH] jit: trace source file and line numbers in -Xtrace:exceptions and -Xtrace:invoke-verbose

2009-07-15 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/jit/compiler.h |2 +- jit/exception.c|2 +- jit/trace-jit.c| 43 +-- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/include/jit/compiler.h b/include/jit/compiler.h index

[PATCH 4/7 v2] jit: add support for WIDE instruction prefix

2009-07-15 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |3 +- include/jit/bytecode-to-ir.h |1 + include/jit/compiler.h |2 + jit/arithmetic-bc.c | 14 --- jit/bytecode-to-ir.c | 39 --- jit/load-store-bc.c

[PATCH] regression: add tests for subroutine inlining

2009-07-15 Thread Tomek Grabiec
Test multiple levels of nesting and exception handler range splitting. Signed-off-by: Tomek Grabiec --- regression/jvm/SubroutineTest.j | 92 +++ 1 files changed, 92 insertions(+), 0 deletions(-) diff --git a/regression/jvm/SubroutineTest.j b/regression

[PATCH 6/7] regression: add tests for wide instructions

2009-07-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |3 +- regression/jvm/WideTest.j | 47 + regression/run-suite.sh |1 + 3 files changed, 50 insertions(+), 1 deletions(-) create mode 100644 regression/jvm/WideTest.j diff --git a

[PATCH 7/7] regression: add tests for subroutine inlining

2009-07-14 Thread Tomek Grabiec
Test multiple levels of nesting and exception handler range splitting. Signed-off-by: Tomek Grabiec --- regression/jvm/SubroutineTest.j | 92 +++ 1 files changed, 92 insertions(+), 0 deletions(-) diff --git a/regression/jvm/SubroutineTest.j b/regression

[PATCH 4/7] jit: add support for WIDE instruction prefix

2009-07-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |3 +- include/jit/bytecode-to-ir.h |1 + include/jit/compiler.h |2 + jit/arithmetic-bc.c | 14 --- jit/bytecode-to-ir.c | 39 --- jit/load-store-bc.c

[PATCH 2/7] jit: fix verify_correct_nesting() and add verify_no_recursion()

2009-07-14 Thread Tomek Grabiec
verify_no_recursion() checks whether all call sites of given subroutine all outside its body. It's a requirement for inlining to be possible. Signed-off-by: Tomek Grabiec --- jit/subroutine.c | 34 ++ 1 files changed, 30 insertions(+), 4 deletions(-)

[PATCH 3/7] vm: fix disassembly of wide instructions

2009-07-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/bytecodes.c | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/vm/bytecodes.c b/vm/bytecodes.c index 8c6a5fa..4d78d38 100644 --- a/vm/bytecodes.c +++ b/vm/bytecodes.c @@ -207,20 +207,25 @@ void bytecode_disassemble(const

[PATCH 1/7] jit: fix subroutine scanning

2009-07-14 Thread Tomek Grabiec
We should stop scanning on every RET instruction Signed-off-by: Tomek Grabiec --- jit/subroutine.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/jit/subroutine.c b/jit/subroutine.c index bbfad16..e831d17 100644 --- a/jit/subroutine.c +++ b/jit/subroutine.c

[PATCH 3/3] regression: add test for subroutine with wide instructions inlining

2009-07-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- regression/jvm/SubroutineTest.j | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/regression/jvm/SubroutineTest.j b/regression/jvm/SubroutineTest.j index 2e7bd37..a44576f 100644 --- a/regression/jvm/SubroutineTest.j +++ b

[PATCH 2/3] jit: properly handle wide instructions in subroutine inlining

2009-07-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/bytecodes.h |7 +++-- jit/subroutine.c | 49 ++- vm/bytecodes.c | 29 ++- 3 files changed, 54 insertions(+), 31 deletions(-) diff --git a/include/vm/bytecodes.h

[PATCH 1/3] vm: properly handle WIDE instruction size

2009-07-14 Thread Tomek Grabiec
Wide instruction changes the size of arguments of the following instruction from 8-bits to 16-bits. Signed-off-by: Tomek Grabiec --- include/vm/bytecode-def.h |2 +- test/vm/bytecodes-test.c | 24 vm/bytecodes.c| 62

[PATCH] regression: introduce regression tests written in java bytecode

2009-07-13 Thread Tomek Grabiec
Tests are compiled with jasmin: http://jasmin.sourceforge.net/ The command `jasmin' must be reachable from $PATH directories. Tests written in jasmin are put in regression/jvm/jasmin/ Signed-off-by: Tomek Grabiec --- Makefile| 10 +- regression/jvm/j

[JATO] invokeinterface bug report

2009-07-13 Thread Tomek Grabiec
`Test', error: -22 Native stack trace: [<08051d88>] __show_stack_trace+18 (/home/tomek/projects/jato/jato/arch/x86/backtrace.c:131) [<>] [<0805b385>] [<080601c8>] [] [<080654a1>]

[PATCH] jit: fix method_real_argument_count()

2009-07-13 Thread Tomek Grabiec
Signatures with 'J' after 'Lclass;' were incorrectly parsed Signed-off-by: Tomek Grabiec --- jit/invoke-bc.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/jit/invoke-bc.c b/jit/invoke-bc.c index 3a4b2da..628ebf3 100644 --- a/jit/invoke-bc.c +

[PATCH] regression: fix jvm/ClassExceptionsTest

2009-07-13 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- regression/jvm/ClassExceptionsTest.java |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/regression/jvm/ClassExceptionsTest.java b/regression/jvm/ClassExceptionsTest.java index e18287b..38007b0 100644 --- a/regression/jvm

<    1   2   3   4   5   6   7   8   9   >