[PATCH v4] jit: add -Xtrace:invoke for tracing method invocations

2009-07-02 Thread Vegard Nossum
This patch adds a new command-line flag, -Xtrace:invoke, which will output a line whenever a method is called, saying which method of which class that was invoked. Note that the print-out happens from inside the JIT-compiled code itself, so we are certain to get the message every time the function

[PATCH 1/2] jit: add emulate_fcmpl and emulate_fcmpg functions

2009-07-02 Thread Arthur Huillet
Signed-off-by: Arthur Huillet --- include/jit/emulate.h |2 ++ jit/emulate.c | 30 ++ 2 files changed, 32 insertions(+), 0 deletions(-) diff --git a/include/jit/emulate.h b/include/jit/emulate.h index c042871..d797eb7 100644 --- a/include/jit/emulate.h +

[PATCH] x86: fix FMUL FDIV FCMPL, implement FNEG, enable FloatArithmeticTest

2009-07-02 Thread Arthur Huillet
Signed-off-by: Arthur Huillet --- The patch that makes things work. :) arch/x86/emit-code.c|8 arch/x86/include/arch/instruction.h |1 + arch/x86/insn-selector_32.brg | 22 +++--- arch/x86/lir-printer.c |7

[PATCH] vm: allocate enough memory for inherited fields, amendment #2

2009-07-02 Thread Vegard Nossum
Allocate just the right amount of memory that we need for this class's static fields, including fields inherited from the superclass. Signed-off-by: Vegard Nossum --- vm/class.c | 15 --- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/vm/class.c b/vm/class.c index

[PATCH] vm: part 1 of itables (interface method tables)

2009-07-02 Thread Vegard Nossum
This patch adds: 1. A space in the class struct where we can store the itable 2. Collecting the interface methods implemented by the class and its superclasses 3. Tracing (debug output) of the collected itable Signed-off-by: Vegard Nossum --- Makefile |1 + include/vm/c

[PATCH 2/9] vm: VMClassLoader.getPrimitiveClass() should return null when type is invalid

2009-07-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/classloader.c |3 ++- vm/jato.c|4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vm/classloader.c b/vm/classloader.c index b99701a..0ed65b1 100644 --- a/vm/classloader.c +++ b/vm/classloader.c @@ -292,7 +292,8 @@ struct vm

[PATCH 3/9] vm: do not use static variables in unsynchronized code.

2009-07-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index 60df698..2cc0135 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -200,7 +200,7 @@ native_vmclass_getname(struct vm_object *object) static struct vm_object *

[PATCH 1/9] x86: make signal bh trampoline's frame be identical to native frames

2009-07-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/signal-bh.S | 10 +++--- arch/x86/signal.c|8 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/x86/signal-bh.S b/arch/x86/signal-bh.S index 8d680f0..0eb6230 100644 --- a/arch/x86/signal-bh.S +++ b/arch/x86/signa

[PATCH 5/9] jit: introduce detailed invocation trace -Xtrace:invoke-dtls

2009-07-02 Thread Tomek Grabiec
This options enable detailed information dump on method incokation This includes: * method's return address and calling method's signature * target method entry address * 'this' pointer value and actual class name * actual invkoation arguments Example: trace invoke: java/lang/StringBuffer.ap

[PATCH 4/9] vm: use memmove() in native_vmsystem_arraycopy()

2009-07-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/jato.c | 15 +++ 1 files changed, 3 insertions(+), 12 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index 2cc0135..52ddf5b 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -104,8 +104,6 @@ native_vmsystem_arraycopy(struct vm_object *src, int src_sta

[PATCH 7/9] jit: rename get_cu_from_native_addr() to jit_lookup_cu()

2009-07-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c |2 +- arch/x86/exception.c |2 +- arch/x86/signal.c|2 +- arch/x86/unwind_32.S |2 +- arch/x86/unwind_64.S |2 +- include/jit/cu-mapping.h |2 +- include/jit/exception.h |2 +- jit/cu-mapp

[PATCH 6/9] x86: optimize selected code for accessing instance fields

2009-07-02 Thread Tomek Grabiec
Optimization reduces code for EXPR_INSTANCE_FIELD from: add_imm_reg $0x20, r2 mov_imm_reg $0x8, r27 mov_memindex_reg (r2, r27, 0), r28 to: mov_membase_reg $0x28(r2), r28 and for STMT_STORE(inst_field, reg) from: add_imm_reg $0x20, r16 mov_i

[PATCH 8/9] vm: add ->source_file_name field to struct vm_class

2009-07-02 Thread Tomek Grabiec
It will be needed to create stack trace elements. Signed-off-by: Tomek Grabiec --- include/vm/class.h |2 ++ vm/classloader.c |6 +- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/include/vm/class.h b/include/vm/class.h index c84efe5..a54321e 100644 --- a/include/vm

[PATCH 9/9] jit: add exception tracer enabled with -Xtrace:exception

2009-07-02 Thread Tomek Grabiec
Sample output: tarce exception: exception object 0x823fb68 (java/lang/RuntimeException) thrown from: 0xa7ce163d (java/lang/String.([III)V) action : unwind to 0xa7cdfeb0 (java/lang/Throwable.toString()Ljava/lang/String;) tarce exception: exception object 0x823fb68 (java/lang/R

[PATCH 5/9 v2] jit: introduce detailed invocation trace -Xtrace:invoke-dtls

2009-07-02 Thread Tomek Grabiec
This option enables detailed information dump on method invocation This includes: * method's return address and calling method's signature * target method entry address * 'this' pointer value and actual class name * actual invocation arguments Example: trace invoke: java/lang/StringBuffer.ap

[PATCH 9/9 v2] jit: add exception tracer enabled with -Xtrace:exception

2009-07-02 Thread Tomek Grabiec
Sample output: trace exception: exception object 0x823fb68 (java/lang/RuntimeException) thrown from: 0xa7ce163d (java/lang/String.([III)V) action : unwind to 0xa7cdfeb0 (java/lang/Throwable.toString()Ljava/lang/String;) trace exception: exception object 0x823fb68 (java/lang/R

[PATCH] monoburg: add MB_DISCARD_RULE

2009-07-02 Thread Arthur Huillet
This makes "conditional rules" easier to implement and clearer to the reader. Signed-off-by: Arthur Huillet --- arch/x86/insn-selector_32.brg |2 ++ arch/x86/insn-selector_64.brg |1 + monoburg/monoburg.c |2 +- 3 files changed, 4 insertions(+), 1 deletions(-) diff --git a

Conditional rules in Monoburg

2009-07-02 Thread Arthur HUILLET
Hi, I mentionned, several times in the past, that I would have liked to have conditional rules in Monoburg. A conditional rule is a rule whose application depends not only on the tree pattern, but also on an arbitrary condition computed on the relevant tree nodes, such as the ->vm_type field of o

Conditional rules in Monoburg

2009-07-02 Thread Arthur HUILLET
Hi, I mentionned, several times in the past, that I would have liked to have conditional rules in Monoburg. A conditional rule is a rule whose application depends not only on the tree pattern, but also on an arbitrary condition computed on the relevant tree nodes, such as the ->vm_type field of o

[PATCH 2/2] x86: add float <-> int conversions

2009-07-02 Thread Arthur Huillet
This uses "conditional rules" for EXPR_CONVERSION in order to catch the right terminals (both produced and kids) without cluttering HIR with new FLOAT_TO_INT_CONVERSION and INT_TO_FLOAT_CONVERSION. Signed-off-by: Arthur Huillet --- arch/x86/insn-selector_32.brg | 71 +++

[PATCH 1/2] x86: fix cvtsi2ss and cvtss2si code emission

2009-07-02 Thread Arthur Huillet
source and destination registers were swapped Signed-off-by: Arthur Huillet --- arch/x86/emit-code.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 577df05..e58dae6 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emi

[PATCH] vm: allocate enough memory for inherited fields, amendment #2

2009-07-02 Thread Vegard Nossum
+output("\tprintf(\"op = %%d, left = %%#x, right = %%#x, tree = %%#x, cost1 = %%d cost2 = %%d cost3 = %%d cost4 = %%d cost5 = %%d cost6 = %%d, rule_reg = %%d, rule_stmt = %%d, rule_arg = %%d\\n\", p->op, p->left, p->right, p->tree, p->cost[1], p->cost[2], p->cost[3],p->cost[4],p->cost[5

[PATCH] vm: vm_object_alloc_native_array() should take T_CHAR not J_CHAR

2009-07-02 Thread Tomek Grabiec
Signed-off-by: Tomek Grabiec --- vm/object.c |2 +- vm/utf8.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/object.c b/vm/object.c index 7ed883d..7381f6b 100644 --- a/vm/object.c +++ b/vm/object.c @@ -219,7 +219,7 @@ vm_object_alloc_string_from_c(const char *