[RFC][PATCH] jit: remove machine_reg_type

2009-08-09 Thread Vegard Nossum
Since we're now using the var_info's vm type for register allocation, we can use it for spill/reload too, which gets rid of machine_reg_type entirely. Signed-off-by: Vegard Nossum --- arch/mmix/include/arch/registers.h |2 -- arch/mmix/register.c|5 - arch/x86/includ

[PATCH 1/4] x86_64: fix typo in function call in insn-selector

2009-08-09 Thread Vegard Nossum
Signed-off-by: Vegard Nossum --- 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 a8f18b6..609a5a8 100644 --- a/arch/x86/insn-selector.brg +++ b/arch/x86/insn-selector.brg @@ -1268,7

[PATCH 2/4] x86_64: fix REG_UNASSIGNED -> MACH_REG_UNASSIGNED in insn-selector

2009-08-09 Thread Vegard Nossum
Signed-off-by: Vegard Nossum --- arch/x86/insn-selector.brg |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index 609a5a8..66744bb 100644 --- a/arch/x86/insn-selector.brg +++ b/arch/x86/insn-selector.brg @@ -1720,

[PATCH 4/4] x86_64: fix unused variables warnings in insn-selector

2009-08-09 Thread Vegard Nossum
Signed-off-by: Vegard Nossum --- 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 e5da1a9..19ab58e 100644 --- a/arch/x86/insn-selector.brg +++ b/arch/x86/insn-selector.brg @@ -96,9 +9

[PATCH 3/4] x86: use MACH_REG_xCX instead of MACH_REG_ECX in generic code

2009-08-09 Thread Vegard Nossum
Signed-off-by: Vegard Nossum --- 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 66744bb..e5da1a9 100644 --- a/arch/x86/insn-selector.brg +++ b/arch/x86/insn-selector.brg @@ -1425,7

[PATCH 02/19] vm: make native_vmclass_get_declared_constructors() respect public_only parameter

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/method.h |5 + vm/reflection.c |6 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/vm/method.h b/include/vm/method.h index f17f474..ebb1abe 100644 --- a/include/vm/method.h +++ b/include/vm/method.h @@ -52,

[PATCH 01/19] vm: implement java/lang/reflection/Field.getDeclaredFields()

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/field.h |5 +++ include/vm/preload.h|5 +++ include/vm/reflection.h |3 ++ vm/jato.c |1 + vm/preload.c| 10 ++ vm/reflection.c | 72 +++ 6 f

[PATCH 03/19] vm: implement VMClass.getInterfaces()

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/reflection.h |1 + vm/jato.c |1 + vm/reflection.c | 28 3 files changed, 30 insertions(+), 0 deletions(-) diff --git a/include/vm/reflection.h b/include/vm/reflection.h index f695651..27e98

[PATCH 05/19] vm: implement java/lang/reflect/Field.get()

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/preload.h| 17 +++ include/vm/reflection.h |1 + test/vm/preload-stub.c |6 ++ vm/jato.c |1 + vm/preload.c| 75 ++ vm/reflection.c | 117 ++

[PATCH 04/19] vm: implement VMClass.getSuperclass()

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/reflection.h |1 + vm/jato.c |1 + vm/reflection.c | 23 +++ 3 files changed, 25 insertions(+), 0 deletions(-) diff --git a/include/vm/reflection.h b/include/vm/reflection.h index 27e987b..97ba29b 10

[PATCH 08/19] vm: introduce vm_class_get_array_class()

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/class.h |1 + vm/class.c | 14 ++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/include/vm/class.h b/include/vm/class.h index 7adcd14..e8f3483 100644 --- a/include/vm/class.h +++ b/include/vm/class.h @@ -157,

[PATCH 09/19] vm: make vm_class_is_assignable_from() work with array classes

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/class.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/vm/class.c b/vm/class.c index f39e0c0..15084af 100644 --- a/vm/class.c +++ b/vm/class.c @@ -989,6 +989,18 @@ bool vm_class_is_assignable_from(const struct vm_class *v

[PATCH 06/19] vm: remove unnecessary NOT_IMPLEMENTED; marker

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/reflection.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/vm/reflection.c b/vm/reflection.c index c5361ef..4e17823 100644 --- a/vm/reflection.c +++ b/vm/reflection.c @@ -190,8 +190,6 @@ native_constructor_construct_native(struct vm

[PATCH 07/19] vm: implement NewObjectArray JNI function

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 32 +++- 1 files changed, 31 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 5aeed36..a90baff 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -779,6 +779,36 @

[PATCH 10/19] vm: implement VMClass.isInstance()

2009-08-09 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 ad9eae9..dc8035e 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -569,6 +569,17 @@ native_vmclassloader_getprimitiveclass(int type) return

[PATCH 13/19] jit: remove trace_flush() fallout

2009-08-09 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 26a06d8..2f94e2f 100644 --- a/jit/compiler.c +++ b/jit/compiler.c @@ -104,7 +104,7 @@ int compile(struct compilation_unit *cu)

[PATCH 12/19] vm: introduce vm_pointer_type()

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/types.h | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/include/vm/types.h b/include/vm/types.h index 9b5c2f6..e7b3c42 100644 --- a/include/vm/types.h +++ b/include/vm/types.h @@ -1,6 +1,7 @@ #ifndef __VM_TYPES_H

[PATCH 11/19] vm: add missing checks to reflection.c and clean them up a bit.

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/reflection.c | 77 +- 1 files changed, 53 insertions(+), 24 deletions(-) diff --git a/vm/reflection.c b/vm/reflection.c index 4e17823..72267ed 100644 --- a/vm/reflection.c +++ b/vm/reflection.c @@ -5,17 +5

[PATCH 14/19] x86: add INSN_PUSH_MEMBASE

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c|7 +++ arch/x86/include/arch/instruction.h |1 + arch/x86/lir-printer.c |7 +++ arch/x86/use-def.c |1 + 4 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arc

[PATCH 16/19] vm: fix IsAssignableFrom JNI function

2009-08-09 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 a90baff..c614c47 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -461,7 +461,7 @@ vm_jni_is_assignable_from(stru

[PATCH 15/19] jit: implement lookupswitch

2009-08-09 Thread Tomek Grabiec
Lookupswitch is implemented in the simmilar way tableswitch is. Lookupswitch requires two basic blocks. The first one performs binary search to find the branch target. It's ended by if statement which checks if the result is NULL (target not found). In this case default target is taken. Otherwise t

[PATCH 17/19] vm: add missing array field setters

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/object.h | 30 ++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/include/vm/object.h b/include/vm/object.h index 899e741..d4d68c9 100644 --- a/include/vm/object.h +++ b/include/vm/object.h @@ -150,30 +150,

[PATCH 18/19] vm: put JNI code for GetXXXArrayElements and ReleaseXXXArrayElements in common macros

2009-08-09 Thread Tomek Grabiec
This way we can reuse one implementation for each primitive type. This increases maintainability and reduces code duplication. Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 171 +++- 1 files changed, 75 insertions(+), 96 deletions(-) diff

[PATCH 19/19] jit: fix whitespace before tab

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/compilation-unit.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jit/compilation-unit.c b/jit/compilation-unit.c index 71eed13..64d6ee9 100644 --- a/jit/compilation-unit.c +++ b/jit/compilation-unit.c @@ -181,8 +181,8 @@ void fre

[PATCH 1/2] x86: add INSN_JMP_MEMBASE

2009-08-09 Thread Tomek Grabiec
It will be used in lookupswitch jump instead of PUSH_MEMBASE and RET. Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c|7 +++ arch/x86/include/arch/instruction.h |1 + arch/x86/lir-printer.c |7 +++ arch/x86/use-def.c |1

[PATCH 2/2] x86: use INSN_JMP_MEMBASE in lookupswitch jump

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/insn-selector.brg |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index 7462ecc..6856cc5 100644 --- a/arch/x86/insn-selector.brg +++ b/arch/x86/insn-selector.brg @@ -2435,

[PATCH 2/2] jit: allocate registers and temporaries of proper type in bytecode-to-ir.c

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/bytecode-to-ir.c | 14 ++ 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/jit/bytecode-to-ir.c b/jit/bytecode-to-ir.c index c4c3f9b..f9caa72 100644 --- a/jit/bytecode-to-ir.c +++ b/jit/bytecode-to-ir.c @@ -271,7 +271,11 @@ assign

[PATCH 1/2] jit: initalize classes on ldc

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- jit/load-store-bc.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/jit/load-store-bc.c b/jit/load-store-bc.c index 0a4ce7a..f636be5 100644 --- a/jit/load-store-bc.c +++ b/jit/load-store-bc.c @@ -11,6 +11,7 @@ #include "cafebabe/cons

[PATCH 1/3] jit: introduce alloc_exec_buffer()

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/lib/buffer.h |1 + jit/emit.c |9 ++--- lib/buffer.c | 12 +++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/lib/buffer.h b/include/lib/buffer.h index 6a59e78..60a3d23 100644 --- a/include

[PATCH 2/3] x86: introduce fixup_branch_target()

2009-08-09 Thread Tomek Grabiec
It's already used in two places and will be used in few more. Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c | 23 +++ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 8e857ab..c4887a5 100644 --- a/arc

[PATCH 3/3] jit: introduce per-method JNI trampolines.

2009-08-09 Thread Tomek Grabiec
We can't decide at compile-time whether called method is JNI. That's because methods declared as native in one class can be overriden in subclass and be non-native. Solution for this is to call potential JNI methods like any other methods. Method pointers for actual JNI methods point to a trampoli

[PATCH] regression: add double array element load/store test

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- regression/jvm/ArrayTest.java | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/regression/jvm/ArrayTest.java b/regression/jvm/ArrayTest.java index bfada1a..d688f2c 100644 --- a/regression/jvm/ArrayTest.java +++ b/regression/jv

[PATCH] jit: fix method_real_argument_count()

2009-08-09 Thread Tomek Grabiec
When method's argument was [D then 'c' value was incorrectly decremented. Use parse_method_args() to avoid code redundancy. Signed-off-by: Tomek Grabiec --- jit/invoke-bc.c | 15 ++- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/jit/invoke-bc.c b/jit/invoke-bc.c in

[PATCH] vm: implement GetArrayLength JNI function

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- include/vm/jni.h |1 + vm/jni-interface.c | 12 +++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/include/vm/jni.h b/include/vm/jni.h index 3b8acea..5512b26 100644 --- a/include/vm/jni.h +++ b/include/vm/jni.h @@ -39,6 +39,7 @@

[PATCH] vm: make native_vmclass_forname() use given class loader

2009-08-09 Thread Tomek Grabiec
If @loader is not NULL then it should be used to load the class. Signed-off-by: Tomek Grabiec --- include/vm/preload.h |2 ++ vm/jato.c| 46 ++ vm/preload.c |9 + 3 files changed, 45 insertions(+), 12 deletions(-)

[PATCH 1/4] vm: introduce classloader_find_class()

2009-08-09 Thread Tomek Grabiec
This function finds a class of given name from the set of already loaded classes. It is needed to implement some VMClassLoader natives. Signed-off-by: Tomek Grabiec --- include/vm/classloader.h |1 + vm/classloader.c | 37 + 2 files changed, 38 i

[PATCH 2/4] vm: introduce ->classloader field of struct vm_class

2009-08-09 Thread Tomek Grabiec
This field holds a reference to instance of java.lang.ClassLoader. It points to the classloader which loaded the class. Signed-off-by: Tomek Grabiec --- include/vm/class.h |4 vm/classloader.c |2 ++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/include/vm/class.h

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

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c | 25 + 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index 347843d..c6af731 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -684,6 +684,30 @@ static void native_vmobject_wait(struct vm_object

[PATCH 4/4] vm: implement VMClassLoader.loadClass()

2009-08-09 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index c6af731..1a00d3e 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -708,6 +708,26 @@ native_vmclassloader_findloadedclass(struct vm_object