Re: [PATCH 02/26] jit: make trace output thread safe.

2009-08-02 Thread Pekka Enberg
On Mon, 2009-08-03 at 00:09 +0200, Tomek Grabiec wrote: > @@ -719,18 +720,18 @@ const char *stack_trace_elem_type_name(enum > stack_trace_elem_type type) > > static void show_mixed_stack_trace(struct stack_trace_elem *elem) > { > - printf("Native and JAVA stack trace:\n"); > + trace_pri

Re: [PATCH 09/26] regression: introduce JNI regression tests

2009-08-02 Thread Pekka Enberg
Hi Tomek, I skipped this patch because it's causing too many problems. The regression test didn't compile: make -C regression/jni make[1]: Entering directory `/home/penberg/src/jato/regression/jni' JAVAHjvm_JNITest.h CXX libjnitest.so In file included from jvm_JNITest.cpp:1: jvm_JNIT

Re: [PATCH 01/26] vm: introduce vm_thread_get_name()

2009-08-02 Thread Pekka Enberg
The series has been applied, thanks! -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core app

Re: [PATCH 25/26] x86: fix 'this' pointer passing to fixup_vtable() for JNI methods.

2009-08-02 Thread Pekka Enberg
Tomek Grabiec wrote: > Signed-off-by: Tomek Grabiec > --- > arch/x86/emit-code.c | 17 +++-- > 1 files changed, 15 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c > index 57de052..521c150 100644 > --- a/arch/x86/emit-code.c > +++ b/arch/x8

Re: [PATCH 15/26] vm: set user.dir, user.home, user.name properties

2009-08-02 Thread Pekka Enberg
Tomek Grabiec wrote: > Signed-off-by: Tomek Grabiec > --- > vm/jato.c |7 +++ > 1 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/vm/jato.c b/vm/jato.c > index 4a82048..ea176ca 100644 > --- a/vm/jato.c > +++ b/vm/jato.c > @@ -206,6 +206,13 @@ static void init_system_prope

Re: [PATCH 13/26] vm: initial support for JNI invocation API

2009-08-02 Thread Pekka Enberg
Tomek Grabiec wrote: > @@ -52,6 +52,53 @@ > if (!vm_object_is_instance_of((x), vm_java_lang_Class)) \ > return NULL; > > +static void vm_jni_destroy_java_vm(void) { > + NOT_IMPLEMENTED; > +} > + > +static void vm_jni_attach_current_thread(void) { > + NOT_IMPLEM

[PATCH 26/26] vm: bump up maximum size of mimic stack

2009-08-02 Thread Tomek Grabiec
java/net/URLClassLoader.addURLImpl(Ljava/net/URL;)V needs more than 255 elements. Signed-off-by: Tomek Grabiec --- include/vm/stack.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/vm/stack.h b/include/vm/stack.h index 5d19c15..12120ee 100644 --- a/include/vm/s

[PATCH 25/26] x86: fix 'this' pointer passing to fixup_vtable() for JNI methods.

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c | 17 +++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 57de052..521c150 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -1489,7 +1489,13 @@ vo

[PATCH 24/26] jit: introduce EXPR_ARG_THIS for holding invocation 'this' pointer

2009-08-02 Thread Tomek Grabiec
The 'this' pointer is not always the first call argument. For JNI function invocations it is the second argument. EXPR_ARG_THIS is introduced to mark the argument holding object reference so that the register which is assigned to it can be easily propagated up during instruction selection. Before

[PATCH 22/26] vm: implement JNI functions MonitorEnter and MonitorExit

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 28 ++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index be79965..50c1c62 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -473,6 +473,30 @@ sta

[PATCH 23/26] vm: implement JNI function NewObject

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/call.h |3 +++ vm/call.c | 37 + vm/jni-interface.c | 25 - 3 files changed, 64 insertions(+), 1 deletions(-) diff --git a/include/vm/call.h b/include/vm/call.h index 557fb86

[PATCH 20/26] vm: add stub for JNI function DeleteLocalRef

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 05f8265..40a5469 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -448,6 +448,13 @@ vm_jni_is_assignable_fr

[PATCH 21/26] vm: implement JNI function GetIntField

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 20 +++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 40a5469..be79965 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -455,6 +455,24 @@ static void

[PATCH 19/26] vm: implement JNI function IsAssignableFrom

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 20 +++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index b8882bf..05f8265 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -430,6 +430,24 @@ static jobj

[PATCH 18/26] vm: implement JNI function GetObjectClass

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 1bcedf4..b8882bf 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -423,6 +423,13 @@ static jint vm_jni_get_

[PATCH 17/26] vm: initial support for reflection.

2009-08-02 Thread Tomek Grabiec
Implements VM natives for java/lang/reflect/Constructor. Most of the natives support only ()V constructors (there are appropriate assertions) which is enough for GtkToolkit to run. Signed-off-by: Tomek Grabiec --- Makefile|1 + include/vm/preload.h|7 ++- include/vm/r

[PATCH 15/26] vm: set user.dir, user.home, user.name properties

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index 4a82048..ea176ca 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -206,6 +206,13 @@ static void init_system_properties(void) s = "/usr/lib

[PATCH 16/26] vm: implement JNI function NewStringUTF

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 59391e9..1bcedf4 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -206,6 +206,13 @@ vm_jni_get_static_metho

[PATCH 14/26] jit: do not connect athrow with exception handlers

2009-08-02 Thread Tomek Grabiec
There is no need to create CFG edges after athrow to exception handlers because VM stack is empty at exception handler entry. Exceptional flow is special because it "resets" the mimic stack and we do not need to resolve anything across this boundary yet. We do not create any edges for every PEI (eg

[PATCH 13/26] vm: initial support for JNI invocation API

2009-08-02 Thread Tomek Grabiec
The JNI invocation API is specified here: http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/invocation.html#wp9502 See also JNI 1.2 enhancements: http://java.sun.com/j2se/1.4.2/docs/guide/jni/jni-12.html#invo Signed-off-by: Tomek Grabiec --- include/vm/jni.h | 22 vm/j

[PATCH 10/26] vm: add NewGlobalRef() and DeleteGlobalRef() JNI functions stubs

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 20 ++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 67e8656..1bd3fb0 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -345,6 +345,22 @@ static void

[PATCH 11/26] vm: fix in classloader_load()

2009-08-02 Thread Tomek Grabiec
When a class was loaded with name in a dot form and if another time classloader would be asked about the same class but in a slash form then classloader will try to load the class again. We should convert class names to slash names at classloader_load() entry to avoid loading the same class twice.

[PATCH 08/26] vm: implement CallStaticShortMethodV() JNI function

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 28fac8a..67e8656 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -320,6 +320,15 @@ vm_jni_call_static_b

[PATCH 12/26] vm: use vm_get_method_recursive() to get methodID in JNI functions

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 1bd3fb0..81b95ab 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -93,7 +93,7 @@ vm_jni_get_method_id(struct vm_

[PATCH 05/26] vm: make class initialization thread safe.

2009-08-02 Thread Tomek Grabiec
As described in the JVM spec in "2.17.5 Detailed Initialization Procedure": http://java.sun.com/docs/books/jvms/second_edition/html/Concepts.doc.html#24237 Signed-off-by: Tomek Grabiec --- include/vm/class.h | 13 ++--- vm/class.c | 40 +---

[PATCH 07/26] vm: implement VMObject.notify()

2009-08-02 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 96f80ae..e8f62fa 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -557,6 +557,14 @@ static void native_vmthread_start(struct vm_object *vmthread, jlong

[PATCH 09/26] regression: introduce JNI regression tests

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- .gitignore |2 + Makefile |8 +- regression/jni/Makefile| 17 + regression/jni/jvm_JNITest.cpp | 14 ++ regression/jvm/JNITest.java| 53

[PATCH 04/26] jit: move fixup_static() call for static method invocations after compilation unit is unlocked

2009-08-02 Thread Tomek Grabiec
fixup_static() locks on appropriate compilation units so we must not call it with cu mutex lock. Signed-off-by: Tomek Grabiec --- jit/trampoline.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/jit/trampoline.c b/jit/trampoline.c index 880a899..122b58a 100644

[PATCH 01/26] vm: introduce vm_thread_get_name()

2009-08-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/thread.h |1 + vm/thread.c | 11 +++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/include/vm/thread.h b/include/vm/thread.h index 407934e..39084a1 100644 --- a/include/vm/thread.h +++ b/include/vm/thread.h @@ -49

[PATCH 06/26] jit: fix race condition bug in fixup_direct_calls()

2009-08-02 Thread Tomek Grabiec
It is possible that we're fixing calls to method X() and another thread is compiling method Y() which calls X(). Call sites from Y might be added to X's trampoline but Y's ->objcode might not be set yet. We should skip fixing call sites coming from not yet compiled methods. This causes the folowin

[PATCH 03/26] vm: make static field fixup thread safe

2009-08-02 Thread Tomek Grabiec
Note: static field access fixup as well as trampoline backpatching is steel not MP safe after this patch. This is something yet to be done. Apart from that there was a race condition on access to fixup site lists causing the following segfault to occurre: [thread: main] SIGSEGV at EIP 080550bd wh

[PATCH 02/26] jit: make trace output thread safe.

2009-08-02 Thread Tomek Grabiec
Each thread has its own trace buffer to which strings are printed with trace_pritnf(). When trace_flush() is called the buffer's content is printed to stderr. trace_flush() is synchronized with other threads. if -Xtrace:threads is passed to jato, every line of trace will be printed with trailing c