[RFC][PATCH] gc: rewrite GC stop-the-world algorithm.

2009-12-16 Thread Tomek Grabiec
signal handlers because pthread_mutex_lock() is not reentrant. Using it from a signal handler may result in a deadlock. This approach uses semaphores to notify GC when a thread enters or leaves a safepoint. Signed-off-by: Tomek Grabiec --- arch/x86/include/arch/memory.h| 13 +++ include/vm/gc.h

[PATCH 3/3] gc: rewrite GC stop-the-world algorithm.

2009-12-15 Thread Tomek Grabiec
handlers because pthread_mutex_lock() is not reentrant. Using it from a signal handler may result in a deadlock. This approach uses semaphores to notify GC when a thread enters or leaves a safepoint. According to the manual sem_post() is the only async-signal safe pthreads method. Signed-off-by: Tomek

[PATCH 2/3] vm: support for disabling thread creation and deletion

2009-12-15 Thread Tomek Grabiec
We need this to implement GC during which threads should not be created nor deleted. Signed-off-by: Tomek Grabiec --- include/vm/thread.h |2 ++ vm/thread.c | 37 ++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/include/vm

[PATCH 1/3] x86: make all safepoint instructions do a safepoint poll before.

2009-12-15 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg | 39 ++- 1 files changed, 18 insertions(+), 21 deletions(-) diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index 630af2f..5dea125 100644 --- a/arch/x86/insn-selector.brg

[PATCH] vm: dump state of all threads on SIGUSR2

2009-12-11 Thread Tomek Grabiec
When jato receives SIGUSR2 all threads print their register content and backtrace: pkill -SIGUSR2 jato Signed-off-by: Tomek Grabiec --- arch/x86/backtrace.c | 23 +++- include/vm/backtrace.h |1 + vm/signal.c| 52

[PATCH] vm: fix init_stack_trace_elem_current()

2009-11-16 Thread Tomek Grabiec
ler's frame. We must make it a macro becasue we can't rely on __builtin_frame_address(1) because of gcc optimizations. Signed-off-by: Tomek Grabiec --- include/vm/stack-trace.h |8 +++- test/vm/stack-trace-stub.c |4 vm/stack-trace.c |7 --- 3 f

[PATCH] x86: fix is_sse_insn()

2009-10-31 Thread Tomek Grabiec
SSE instructions have two prefixes depending on operand size: 0xf3 for 32-bit XMM and 0xf2 for 64-bit XMM. Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c |2 +- regression/jvm/PutstaticPatchingTest.java | 36 - 2 files changed, 36

[PATCH 1/5] jit: fix get_reload_before_insn()

2009-10-24 Thread Tomek Grabiec
LIR position passed to radix_tree_lookup() should be always even. Signed-off-by: Tomek Grabiec --- jit/spill-reload.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jit/spill-reload.c b/jit/spill-reload.c index 3dfb0b3..eaa2790 100644 --- a/jit/spill-reload.c +++ b

[PATCH 2/5] jit: fix dead code in __insert_spill_reload_insn()

2009-10-24 Thread Tomek Grabiec
Reported-by: Pekka Enberg Signed-off-by: Tomek Grabiec --- jit/spill-reload.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/jit/spill-reload.c b/jit/spill-reload.c index eaa2790..c7b3b51 100644 --- a/jit/spill-reload.c +++ b/jit/spill-reload.c @@ -225,7 +225,7

[PATCH 4/5] jit: set bytecode offset of spill/reload instructions properly

2009-10-24 Thread Tomek Grabiec
cases a container of insn list head is returned. Therefore we can't get the bytecode offset by dereferencing the result. A valid bytecode offset value is returned by those function by setting a variable to which pointer is passed as an argument. Signed-off-by: Tomek Grabiec --- jit/spill-rel

[PATCH 5/5] jit: cleanup in spill-reload.c

2009-10-24 Thread Tomek Grabiec
This changes the API and renames get_spill_after_insn() and get_reload_before_insn() so that they do not return a pointer to struct insn, since it is not always a pointer to struct insn. Signed-off-by: Tomek Grabiec --- jit/spill-reload.c | 57

[PATCH 3/5] jit: make API to insert_reload_insn() the same as for insert_spill_insn()

2009-10-24 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/spill-reload.c | 20 +--- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/jit/spill-reload.c b/jit/spill-reload.c index c7b3b51..ba8ac27 100644 --- a/jit/spill-reload.c +++ b/jit/spill-reload.c @@ -168,20 +168,20

[PATCH 2/2] jit: fix dead code in __insert_spill_reload_insn()

2009-10-24 Thread Tomek Grabiec
The if statement should be an assertion. Reported-by: Pekka Enberg Signed-off-by: Tomek Grabiec --- jit/spill-reload.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/jit/spill-reload.c b/jit/spill-reload.c index 7624bd6..f8fd582 100644 --- a/jit/spill-reload.c +++ b

[PATCH 1/2] jit: fix bug in get_spill_after_insn() and get_reload_after_insn()

2009-10-24 Thread Tomek Grabiec
) and get_reload_after_insn(). Signed-off-by: Tomek Grabiec --- jit/spill-reload.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jit/spill-reload.c b/jit/spill-reload.c index 3dfb0b3..7624bd6 100644 --- a/jit/spill-reload.c +++ b/jit/spill-reload.c @@ -49,11 +

[PATCH 2/2] x86: Add missing result conversion after native method invocations.

2009-10-18 Thread Tomek Grabiec
ods do not perform the conversion. Therefore it is now safe to use jbyte, jboolean, jchar and jshort as VM native implementation return type. Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg | 32 1 files changed, 32 insertions(+), 0 deletions(-) di

[PATCH 1/2] mmix: fix compilation error on make check

2009-10-18 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/mmix/call.c |6 +- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/arch/mmix/call.c b/arch/mmix/call.c index 1dc640a..9c3f244 100644 --- a/arch/mmix/call.c +++ b/arch/mmix/call.c @@ -27,10 +27,6 @@ #include "vm/method.h"

[PATCH] jit: fix conversion of dup_x2 when second value is J_LONG or J_DOUBLE

2009-10-17 Thread Tomek Grabiec
Converter for dup_x2 didn't check the stack size of second stack operand which caused that the forst value was put one level deeper when second value was J_LONG or J_DOUBLE. Signed-off-by: Tomek Grabiec --- jit/ostack-bc.c |4 regression/jvm/DupTest.j |

[PATCH 2/2] x86, vm: implement support for invoking methods with J_LONG return type in reflection.

2009-10-15 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/call.c | 50 ++ include/vm/types.h |5 +++ regression/java/lang/reflect/MethodTest.java |5 +++ runtime/reflection.c |4 ++- 4 files

[PATCH 1/2] x86: cleanup in call.c

2009-10-15 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/call.c | 180 ++--- include/vm/call.h |6 +-- vm/call.c |6 -- 3 files changed, 62 insertions(+), 130 deletions(-) diff --git a/arch/x86/call.c b/arch/x86/call.c index 0b96020..389b1a6

[PATCH 3/3] vm: implement VMClassLoader.defineClass()

2009-10-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/runtime/classloader.h |1 + include/vm/class.h|1 + include/vm/classloader.h |1 + include/vm/preload.h |1 + runtime/classloader.c | 40 +++- test/vm/preload-stub.c

[PATCH 2/3] vm: make class cache recognize different classloaders.

2009-10-14 Thread Tomek Grabiec
Two different classloaders may load a class of the same name. We must therefore make a classloader reference a part of class cache key. Signed-off-by: Tomek Grabiec --- include/lib/hash-map.h |1 + include/vm/classloader.h |2 +- lib/hash-map.c |5 +++ runtime

[PATCH 1/3] vm: fix loading of array classes.

2009-10-14 Thread Tomek Grabiec
different classloaders. The former is always loaded with bootstrap classloader (primitive array) while loading of the latter can be initiated with any classloader. Class [[I must be eventually loaded with bootstrap classloader too. Signed-off-by: Tomek Grabiec --- include/vm/types.h |6 ++ vm

[PATCH] runtime: move VMClassLoader natives to runtime/classloader.c

2009-10-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |1 + include/runtime/classloader.h | 10 runtime/classloader.c | 97 + vm/jato.c | 66 +--- 4 files changed, 109 insertions

[PATCH 2/3] jit: handle exception handlers covering subroutines in subroutine inlining.

2009-10-14 Thread Tomek Grabiec
The code didn't handle the case where exception handler range covers the whole subroutine and more. Signed-off-by: Tomek Grabiec --- jit/subroutine.c | 180 ++ 1 files changed, 127 insertions(+), 53 deletions(-) diff --git a/jit/subrout

[PATCH 3/3] vm: do not return jboolean from VM natives.

2009-10-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/runtime/class.h |6 +++--- runtime/class.c |6 +++--- vm/jato.c |6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/runtime/class.h b/include/runtime/class.h index 50d1ec0..7691ac9 100644 --- a/

[PATCH 1/3] jit: fix print_exception_table()

2009-10-14 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/exception.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/jit/exception.c b/jit/exception.c index b412e25..8274eaa 100644 --- a/jit/exception.c +++ b/jit/exception.c @@ -352,7 +352,7 @@ print_exception_table(const struct vm_method

[PATCH] vm: fix bug in native_field_get()

2009-10-11 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/reflection.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vm/reflection.c b/vm/reflection.c index d97fec9..faf27bd 100644 --- a/vm/reflection.c +++ b/vm/reflection.c @@ -621,7 +621,7 @@ struct vm_object *native_field_get(struct

[PATCH 3/4] x86: make native_call() hard crash for not implemented types.

2009-10-11 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/call.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/call.c b/arch/x86/call.c index 717d53d..0b96020 100644 --- a/arch/x86/call.c +++ b/arch/x86/call.c @@ -137,7 +137,7 @@ void native_call(struct vm_method

[PATCH 2/4] regression: fix TestCase.assertObjectEquals()

2009-10-11 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- regression/jvm/TestCase.java |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/regression/jvm/TestCase.java b/regression/jvm/TestCase.java index fd00063..2a53a8b 100644 --- a/regression/jvm/TestCase.java +++ b/regression/jvm/TestCase.java

[PATCH 1/4] vm: fix native_vmclass_get_declared_methods()

2009-10-11 Thread Tomek Grabiec
We should perform the vm_method_is_special() check also when public_only == false; Signed-off-by: Tomek Grabiec --- vm/reflection.c | 23 ++- 1 files changed, 10 insertions(+), 13 deletions(-) diff --git a/vm/reflection.c b/vm/reflection.c index 6d03a57..d97fec9 100644

[PATCH 4/4] regression: add regression test for method invokation via reflection

2009-10-11 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- regression/jvm/MethodTest.java | 20 +++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/regression/jvm/MethodTest.java b/regression/jvm/MethodTest.java index c633f8c..b805da4 100644 --- a/regression/jvm/MethodTest.java +++ b

[PATCH 3/4] vm: rename encapsulate_value() to wrap()

2009-10-11 Thread Tomek Grabiec
While at it, make it more robust by using valueOf() functions. Signed-off-by: Tomek Grabiec --- include/vm/preload.h |8 +++ vm/preload.c | 56 ++ vm/reflection.c | 153 -- 3 files changed, 124 insertions(+), 93

[PATCH 4/4] vm: fix call_static_method() and call_virtual_method()

2009-10-11 Thread Tomek Grabiec
Those functions should return values wrapped in approptiate objects, not the value itself. This caused a SIGSEGV when running clojure because an integer value was accessed like an object reference. Signed-off-by: Tomek Grabiec --- vm/reflection.c |4 ++-- 1 files changed, 2 insertions(+), 2

[PATCH 1/4] vm: change call result return method for vm_call_method_*() so that it can handle any type

2009-10-11 Thread Tomek Grabiec
saved. This way we can use vm_call_method_*() functions in a machine and type independed way. While at it, implement JNI funciton families: CallStatic*Method() CallStatic*MethodV() Call*Method() Signed-off-by: Tomek Grabiec --- arch/x86/call.c| 222

[PATCH 2/4] vm: implement unwrap() for J_LONG and J_DOUBLE

2009-10-11 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/preload.h |2 ++ vm/preload.c | 14 ++ vm/reflection.c |7 ++- 3 files changed, 22 insertions(+), 1 deletions(-) diff --git a/include/vm/preload.h b/include/vm/preload.h index c71d8f9..a99fa89 100644 --- a

[PATCH] jit: skip conversion of unreachable basic blocks

2009-10-11 Thread Tomek Grabiec
[main][ 359 ] 0xb0 areturn Signed-off-by: Tomek Grabiec --- jit/bytecode-to-ir.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/jit/bytecode-to-ir.c b/jit/bytecode-to-ir.c index a93a2ca..5f66587 100644 --- a/jit/bytecode-to-ir.c +++ b/jit/bytecode-to-ir.c @@ -434,6

[PATCH 2/3] vm: do not return and methods in native_vmclass_get_declared_methods()

2009-10-10 Thread Tomek Grabiec
The API spec says we shouldn't do so. Signed-off-by: Tomek Grabiec --- include/vm/method.h |5 + vm/reflection.c |6 +- 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/include/vm/method.h b/include/vm/method.h index ccf1db8..7c9e0d7 100644 --- a/inclu

[PATCH 1/3] vm: rename unwrap_and_set_field() to unwrap()

2009-10-10 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/reflection.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vm/reflection.c b/vm/reflection.c index c7fc9e5..d0bff58 100644 --- a/vm/reflection.c +++ b/vm/reflection.c @@ -624,7 +624,7 @@ jint

[PATCH 3/3] jit: fix bug in spill_interval()

2009-10-10 Thread Tomek Grabiec
due to register corruption, which prevented java.awt.image.Raster.createWritableRaster() from correct working. Signed-off-by: Tomek Grabiec --- jit/linear-scan.c | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/jit/linear-scan.c b/jit/linear-scan.c index

[PATCH] vm: fix unwrap_and_set_field()

2009-10-09 Thread Tomek Grabiec
'This' pointer was not passed to vm_call_method_this_a() in args which caused a SIGSEGV inside that function. Signed-off-by: Tomek Grabiec --- vm/call.c |1 + vm/reflection.c |6 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vm/call.c b/vm/ca

[PATCH] vm: fix call_virtual_method()

2009-10-09 Thread Tomek Grabiec
'This' pointer must be added to args manually. vm_call_method_this_a() expects that it is already in args to avoid unnecessary copying. Signed-off-by: Tomek Grabiec --- vm/call.c |6 +- vm/reflection.c |3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff

[PATCH] cafebabe: fix bug in cafebabe_stream_close()

2009-10-09 Thread Tomek Grabiec
The bracket was misplaced causing close() to use wrong file descriptor. This led to the following error message for tetris: .: Fatal IO error 9 (Bad file descriptor) on X server :0.0. CC: Vegard Nossum Signed-off-by: Tomek Grabiec --- cafebabe/src/cafebabe/stream.c |2 +- 1 files changed

[PATCH 3/5] vm: implement all GetStatic*Field() JNI functions

2009-10-08 Thread Tomek Grabiec
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

[PATCH 5/5] vm: fix pack_args()

2009-10-08 Thread Tomek Grabiec
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

[PATCH 2/5] vm: fix vm_jni_set_static_*()

2009-10-08 Thread Tomek Grabiec
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

[PATCH 4/5] vm: fix vm_jni_new_object_a()

2009-10-08 Thread Tomek Grabiec
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

[PATCH 1/5] vm: fix vm_jni_get_static_double_field()

2009-10-08 Thread Tomek Grabiec
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-in

[PATCH 4/5] vm: implement thread interruption operations.

2009-10-07 Thread Tomek Grabiec
The following natives are implemented: java/lang/VMThread.isInterrupted() java/lang/VMThread.interrupted() java/lang/VMThread.interrupt() Signed-off-by: Tomek Grabiec --- Makefile|1 + include/vm/preload.h|1 + include/vm/thread.h |7

[PATCH 5/5] x86: introduce valgrind workaround for exception guards.

2009-10-07 Thread Tomek Grabiec
ntrol 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 --- arch/x86/insn-selector.brg |9 +++-- arch/x86/unwind_32.S | 27 +++ include/jit/e

[PATCH 1/5] vm: fix parse_method_type()

2009-10-07 Thread Tomek Grabiec
Call arguments were incorrectly inserted to args list causing the list to represent the reverse order of arguments. Signed-off-by: Tomek Grabiec --- vm/types.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vm/types.c b/vm/types.c index e20aecf..f4fe84d 100644 --- a

[PATCH 3/5] vm: unify code in vm_monitor_wait() and vm_monitor_timedwait()

2009-10-07 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/monitor.c | 78 + 1 files changed, 34 insertions(+), 44 deletions(-) diff --git a/vm/monitor.c b/vm/monitor.c index 4a22584..5705954 100644 --- a/vm/monitor.c +++ b/vm/monitor.c @@ -141,10 +141,9

[PATCH 2/5] vm: move monitor operations to vm/monitor.c

2009-10-07 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- Makefile |1 + include/vm/object.h|1 + test/arch-x86/Makefile |1 + vm/jato.c |1 + vm/monitor.c | 242 vm/object.c| 191

[PATCH 1/2] vm: parse method and field type on initialization

2009-10-06 Thread Tomek Grabiec
sulated in struct vm_method_arg and linked in a list pointed by struct vm_method.args. This change removes plenty of calls to type string parsing which should not be done at run-time but rather on method or field initialization. Signed-off-by: Tomek Grabiec --- include/jit/expression.h

[PATCH 2/2] vm: implement java/lang/reflect/Method.getReturnType()

2009-10-06 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/reflection.h |1 + vm/jato.c |1 + vm/reflection.c | 18 ++ 3 files changed, 20 insertions(+), 0 deletions(-) diff --git a/include/vm/reflection.h b/include/vm/reflection.h index f9c709a..c1e3aa4 100644

[PATCH] README: fix package dependencies for Ubuntu

2009-10-04 Thread Tomek Grabiec
We need valgrind headers to compile jato, since valgrind workarounds were introduced. Signed-off-by: Tomek Grabiec --- README |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/README b/README index 03985d6..97a9467 100644 --- a/README +++ b/README @@ -13,7 +13,7 @@ How

[PATCH] jit: fix race condition in fixup_direct_calls()

2009-09-07 Thread Tomek Grabiec
0x88D73CC: ??? Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c | 12 +++- arch/x86/insn-selector.brg |6 +++--- include/jit/compilation-unit.h |1 + include/jit/compiler.h | 11 +-- jit/compilation-unit.c | 18 ++

Re: [PATCH 15/19] x86-64: move received parameters to non-fixed registers

2009-09-06 Thread Tomek Grabiec
CE because it could cause that integers would be interpreted as pointers. I think the proper solution would be to iterate over method's call argument types, and for argument type T we should allocate register of type mimic_stack_type(T). I also think that we only have to emit movs for registers

[PATCH] jit: fix conversion of invoke* instructions

2009-09-04 Thread Tomek Grabiec
. Invocations are now handled as statements and their result is pushed onto mimic stack. Signed-off-by: Tomek Grabiec --- Makefile |5 +- arch/x86/insn-selector.brg | 236 ++ include/jit/expression.h | 48 +- include/jit

[PATCH 4/4] jit: fix mimic stack content propagation

2009-09-04 Thread Tomek Grabiec
oblems with GC. Signed-off-by: Tomek Grabiec --- include/jit/basic-block.h |9 include/lib/stack.h | 11 +- jit/basic-block.c |1 + jit/bytecode-to-ir.c | 50 lib/stack.c | 17 +++

[PATCH 1/4] jit: make clear_mimic_stack() work on stack instead of basic block

2009-09-04 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/jit/basic-block.h |2 +- jit/basic-block.c |6 +++--- jit/exception-bc.c|2 +- jit/invoke-bc.c |4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/jit/basic-block.h b/include/jit/basic

[PATCH 2/4] jit: split tableswitch/lookupswitch bsaic block at the end.

2009-09-04 Thread Tomek Grabiec
This way, the order of basic blocks matches the values of .start and .end It also makes created basic blocks have empty bytecode range (start == end). Signed-off-by: Tomek Grabiec --- jit/basic-block.c |2 +- jit/switch-bc.c |6 +++--- test/jit/basic-block-test.c

[PATCH 3/4] jit: set .has_branch flag for created basic blocks for tableswitch/lookupswitch.

2009-09-04 Thread Tomek Grabiec
We must set that flag so that mimic stack resolution will put moves before branch instructions. Signed-off-by: Tomek Grabiec --- jit/switch-bc.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jit/switch-bc.c b/jit/switch-bc.c index b1ece1a..fb3fef2 100644 --- a

[PATCH 2/2][SQUASH TO 4/4] lib: fix compilation error

2009-09-03 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/lib/stack.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/lib/stack.h b/include/lib/stack.h index 7ec599d..aa60109 100644 --- a/include/lib/stack.h +++ b/include/lib/stack.h @@ -7,6 +7,8 @@ #include #include

[PATCH 1/2][SQUASH to 2/4] test: fix 'make check' breakage

2009-09-03 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- test/jit/basic-block-test.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/test/jit/basic-block-test.c b/test/jit/basic-block-test.c index 7195487..a22d3bf 100644 --- a/test/jit/basic-block-test.c +++ b/test/jit/basic-block-test.c

[PATCH 3/4] jit: set .has_branch flag for created basic blocks for tableswitch/lookupswitch.

2009-09-03 Thread Tomek Grabiec
We must set that flag so that mimic stack resolution will put moves before branch instructions. Signed-off-by: Tomek Grabiec --- jit/switch-bc.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jit/switch-bc.c b/jit/switch-bc.c index b1ece1a..fb3fef2 100644 --- a

[PATCH 4/4] jit: fix mimic stack content propagation

2009-09-03 Thread Tomek Grabiec
is defined. The register appears to be always live before it's use position, which is wrong, and could cause problems with GC. Signed-off-by: Tomek Grabiec --- include/jit/basic-block.h |3 ++ include/lib/stack.h | 24 +- jit/bytecode

[PATCH 2/4] jit: split tableswitch/lookupswitch bsaic block at the end.

2009-09-03 Thread Tomek Grabiec
This way, the order of basic blocks matches the values of .start and .end It also makes created basic blocks have empty bytecode range (start == end). Signed-off-by: Tomek Grabiec --- jit/basic-block.c |2 +- jit/switch-bc.c |6 +++--- 2 files changed, 4 insertions(+), 4 deletions

[PATCH 1/4] jit: make clear_mimic_stack() work on stack instead of basic block

2009-09-03 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/jit/basic-block.h |2 +- jit/basic-block.c |6 +++--- jit/exception-bc.c|2 +- jit/invoke-bc.c |4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/jit/basic-block.h b/include/jit/basic

Re: [PATCH 1/6] vm: introduce -Xnobuf

2009-09-02 Thread Tomek Grabiec
2009/9/1 Pekka Enberg : > Hi Tomek, > > On Tue, 2009-09-01 at 10:06 +0200, Tomek Grabiec wrote: >> It disables buffering of strings passed to trace_printf(). >> >> Signed-off-by: Tomek Grabiec > > Does something like this work for your scenario? > >

[PATCH 6/6] x86: fix writes below (%esp) in insn-selector.brg

2009-09-01 Thread Tomek Grabiec
It is incorrect to write or read from memory below %esp. This patch fixes valgrind complaints about access of uninitilized data. Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg | 152 +++- 1 files changed, 80 insertions(+), 72 deletions

[PATCH 3/6] x86: cleanup emit_mov_reg_memlocal()

2009-09-01 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c | 16 +--- 1 files changed, 1 insertions(+), 15 deletions(-) diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index a99296c..e1eb5ba 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -861,21 +861,7

[PATCH 4/6] x86: implement INSN_(FSTP|FLD)_{64}_MEMLOCAL

2009-09-01 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c| 24 arch/x86/include/arch/instruction.h |4 arch/x86/lir-printer.c | 28 arch/x86/use-def.c | 12 4 files

[PATCH 5/6] jit: introduce lazy-allocated scratch stack slots

2009-09-01 Thread Tomek Grabiec
They are needed to hold temporary results when register can not be used. Signed-off-by: Tomek Grabiec --- include/jit/compilation-unit.h | 20 +++- jit/compilation-unit.c | 16 2 files changed, 35 insertions(+), 1 deletions(-) diff --git a/include

[PATCH 1/6] vm: introduce -Xnobuf

2009-09-01 Thread Tomek Grabiec
It disables buffering of strings passed to trace_printf(). Signed-off-by: Tomek Grabiec --- include/vm/trace.h |2 ++ vm/jato.c |7 +++ vm/trace.c |9 - 3 files changed, 17 insertions(+), 1 deletions(-) diff --git a/include/vm/trace.h b/include/vm

[PATCH 2/6] x86: implement INSN_MOV_IMM_MEMLOCAL

2009-09-01 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c|9 - arch/x86/include/arch/instruction.h |2 ++ arch/x86/instruction.c | 12 arch/x86/lir-printer.c | 14 ++ arch/x86/use-def.c |1

[PATCH] x86: fix writes below (%esp) which can be fixed at no cost

2009-08-31 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg | 30 -- 1 files changed, 16 insertions(+), 14 deletions(-) diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index 2e7367f..85f2fa6 100644 --- a/arch/x86/insn-selector.brg +++ b/arch

[PATCH] [APPEND-TO-LAST-SERIES] jit: cleanup handling of expired ranges of intervals

2009-08-31 Thread Tomek Grabiec
liveness(). Signed-off-by: Tomek Grabiec --- include/jit/vars.h | 18 -- jit/interval.c | 41 +++-- jit/linear-scan.c | 15 +++ 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/include/jit/vars.h b/include/jit/vars

[PATCH] x86: Introduce workarounds for valgrind to work with jato.

2009-08-31 Thread Tomek Grabiec
Jato can be compiled with workarounds which make valgrind work with jato. To do so, define VALGRIND variable for make: make jato VALGRIND=y Currently workarounds eliminate class initialization from signal handler by unconditionally selecting calls to vm_class_ensure_init(). Signed-off-by: Tomek

[PATCH 13/14] jit: optimize register use and block position calculation in regalloc

2009-08-30 Thread Tomek Grabiec
those registers. For example, we do not have to check at which position XMM0 register is available if we are allocating a general purpose register. Signed-off-by: Tomek Grabiec --- jit/linear-scan.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/jit/linear-scan.c

[PATCH 12/14] jit: do not put to inactive list fixed reg intervals for ESP and EBP

2009-08-30 Thread Tomek Grabiec
Those register are not considered for allocation and their numbers are > NR_REGISTERS. Letting those fixed intervals into register allocator can cause memory corruption becuase use position arrays are of size NR_REGISTERS. Signed-off-by: Tomek Grabiec --- jit/linear-scan.c |9 ++---

[PATCH 10/14] jit: print variable types in regalloc trace

2009-08-30 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/trace-jit.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/jit/trace-jit.c b/jit/trace-jit.c index 58ecaa4..915571d 100644 --- a/jit/trace-jit.c +++ b/jit/trace-jit.c @@ -360,6 +360,7 @@ void trace_regalloc(struct compilation_unit

[PATCH 11/14] jit: fix spilling of 64-bit registers.

2009-08-30 Thread Tomek Grabiec
This cleans handling of 64-bit stack slots up and fixes the buggy spilling code. We always allocated 32-bit spill slot regardless of register type which caused memory corruption. Signed-off-by: Tomek Grabiec --- arch/mmix/include/arch/instruction.h | 15 +- arch/mmix/instruction.c

[PATCH 14/14] x86: remove unconditional saving and restoring of XMM registers

2009-08-30 Thread Tomek Grabiec
We do not longer need to do this because this bug has been solved: http://jato.lighthouseapp.com/projects/29055/tickets/5-sse-registers-are-saved-and-registered-unconditionally Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c| 83 --- arch

[PATCH 06/14] jit: implement precise live range calculation

2009-08-30 Thread Tomek Grabiec
; this can be optimized out in the future add ebx, ebx Signed-off-by: Tomek Grabiec --- arch/x86/include/arch/instruction.h |5 -- arch/x86/instruction.c |5 ++ arch/x86/use-def.c | 28 +++ include/jit/instruction.h |6 +++ i

[PATCH 09/14] jit: ensure that spill variable has the same vm_type as original variable.

2009-08-30 Thread Tomek Grabiec
This is a bug fix. The bug caused that floating point variables were spilled as if they were a general purpose registers which led to corruption of general purpose registers. Signed-off-by: Tomek Grabiec --- jit/compilation-unit.c |4 ++-- jit/interval.c |1 + jit/spill-reload.c

[PATCH 08/14] jit: force spill of intervals containing caller saved registers before calls.

2009-08-30 Thread Tomek Grabiec
This fixes the follwing bug: http://jato.lighthouseapp.com/projects/29055/tickets/7-ebcdx-are-unavailable-for-allocation-after-some-call-instructions Signed-off-by: Tomek Grabiec --- arch/mmix/include/arch/instruction.h |5 + arch/mmix/include/arch/registers.h |3 +++ arch/mmix

[PATCH 04/14] jit: introduce multiple live ranges per interval.

2009-08-30 Thread Tomek Grabiec
This is needed for precise modeling of live ranges. Signed-off-by: Tomek Grabiec --- include/jit/vars.h | 83 +--- jit/interval.c | 228 +- jit/linear-scan.c | 51 ++ jit/liveness.c

[PATCH 05/14] jit: move arch independent stuff from arch/instruction.h to jit/instruction.h

2009-08-30 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/mmix/include/arch/instruction.h |8 arch/x86/include/arch/instruction.h |8 arch/x86/instruction.c |3 +-- arch/x86/use-def.c |2 +- include/jit/instruction.h| 10

[PATCH 07/14] x86: ensure fixed-reg variables are not returned as rule results

2009-08-30 Thread Tomek Grabiec
t be used in place of regular virtual registers. Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg | 134 ++-- 1 files changed, 79 insertions(+), 55 deletions(-) diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index 8522667..

[PATCH 03/14] jit: cleanup interval spilling

2009-08-30 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/linear-scan.c | 86 +++-- 1 files changed, 37 insertions(+), 49 deletions(-) diff --git a/jit/linear-scan.c b/jit/linear-scan.c index 5538bc7..8baa914 100644 --- a/jit/linear-scan.c +++ b/jit/linear-scan.c

[PATCH 01/14] jit: add missing trace_flush() to trace_return_value()

2009-08-30 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/trace-jit.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/jit/trace-jit.c b/jit/trace-jit.c index 0246c3b..1bde5e1 100644 --- a/jit/trace-jit.c +++ b/jit/trace-jit.c @@ -811,8 +811,10 @@ void trace_return_value(struct vm_method

[PATCH 02/14] jit: assign two LIR positions for each instruction.

2009-08-30 Thread Tomek Grabiec
positions are even yet. Signed-off-by: Tomek Grabiec --- include/jit/compilation-unit.h |2 + include/jit/vars.h | 10 + jit/compilation-unit.c |4 ++- jit/liveness.c |4 +- jit/spill-reload.c | 16 +++-- jit/t

[PATCH 3/3] x86: fix wrong argument cleanup count for EXPR_ANEWARRAY

2009-08-29 Thread Tomek Grabiec
Selected code was adding 4 bytes too much to ESP, which led to a memory corruption. Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index d7f506b

[PATCH 2/3] jit: remove redundant compute_boundaries()

2009-08-29 Thread Tomek Grabiec
The values of .start_insn and .end_insn can be computed in compute_insn_positions(). Signed-off-by: Tomek Grabiec --- jit/compilation-unit.c |4 jit/liveness.c | 17 - 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/jit/compilation-unit.c b

[PATCH 1/3] jit: remove unused basic block sorting code

2009-08-29 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/jit/compilation-unit.h |1 - jit/compilation-unit.c | 15 --- 2 files changed, 0 insertions(+), 16 deletions(-) diff --git a/include/jit/compilation-unit.h b/include/jit/compilation-unit.h index 66aef32..f6fb0e9 100644 --- a

[PATCH] jit: remove trace_flush() from the middle of compile()

2009-08-23 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/compiler.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/jit/compiler.c b/jit/compiler.c index 645e9b2..1fa321a 100644 --- a/jit/compiler.c +++ b/jit/compiler.c @@ -66,7 +66,7 @@ int compile(struct compilation_unit *cu

[RFC][PATCH 3/3] jit: fix data flow resolution code in presence of empty basic blocks.

2009-08-19 Thread Tomek Grabiec
before the slot was assigned a correct value. Empty basic blocks can be a result of the following bytecode: iconst_0 iconst_1 ifeq lab pop // This and the next instruction generate no iconst_1 // LIR instructions. lab: Cc: Arthur HUILLET Signed-off-by: Tomek Grabiec --- i

[PATCH 2/3] x86: make insn_is_branch() return true for INSN_RET

2009-08-19 Thread Tomek Grabiec
INSN_RET should be considered a branch because it jumps to different basic block. It is used in LIR for athrow. Signed-off-by: Tomek Grabiec --- arch/x86/include/arch/instruction.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/arch/instruction.h b

[PATCH 1/3] jit: introduce include/jit/instruction.h for arch-independent stuff

2009-08-19 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/jit/instruction.h | 12 1 files changed, 12 insertions(+), 0 deletions(-) create mode 100644 include/jit/instruction.h diff --git a/include/jit/instruction.h b/include/jit/instruction.h new file mode 100644 index 000..376e278

Re: [PATCH 3/3] spill-reload: Use radix_tree_lookup() in insert_mov_insns()

2009-08-19 Thread Tomek Grabiec
2009/8/19 Pekka Enberg : > Hi Tomek, > > On Tue, 2009-08-18 at 21:21 +0200, Tomek Grabiec wrote: >> Like I said on IRC, this will not work for empty basic blocks, because >> spill_at_insn will belong to the preceding >> basic block. This causes that instructions

  1   2   3   4   5   6   7   8   9   >