[PATCH] vm: fix trace_flush()
We should not use strtok() to split string into lines because it swollows consequtive '\n' characters. We also do not flush the buffer tail not ended by new line character because we would print the thread name marker ([main]) in the middle of the line next time the buffer is flushed. Tracing buffer behaves now as if line-buffered. Signed-off-by: Tomek Grabiec --- vm/trace.c | 18 -- 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/vm/trace.c b/vm/trace.c index e907a92..45174f0 100644 --- a/vm/trace.c +++ b/vm/trace.c @@ -66,8 +66,8 @@ int trace_printf(const char *fmt, ...) void trace_flush(void) { struct vm_thread *self; char *thread_name; - char *strtok_ptr; char *line; + char *next; ensure_trace_buffer(); @@ -79,17 +79,23 @@ void trace_flush(void) { pthread_mutex_lock(&trace_mutex); - line = strtok_r(trace_buffer->value, "\n", &strtok_ptr); - while (line) { + line = trace_buffer->value; + next = index(line, '\n'); + while (next) { + *next = 0; + fprintf(stderr, "[%s] %s\n", thread_name, line); - line = strtok_r(NULL, "\n", &strtok_ptr); + line = next + 1; + next = index(line, '\n'); } + /* Leave the rest of characters, which are not ended by '\n' */ + memmove(trace_buffer->value, line, strlen(line) + 1); + trace_buffer->length = strlen(line); + pthread_mutex_unlock(&trace_mutex); if (self) free(thread_name); - - trace_buffer->length = 0; } -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 2/3] test: fix warning in vm/stack-trace-stub.c
Signed-off-by: Tomek Grabiec --- test/vm/stack-trace-stub.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/test/vm/stack-trace-stub.c b/test/vm/stack-trace-stub.c index d6414b4..7278b4d 100644 --- a/test/vm/stack-trace-stub.c +++ b/test/vm/stack-trace-stub.c @@ -3,6 +3,7 @@ #include "vm/backtrace.h" #include "vm/stack-trace.h" +#include "vm/trace.h" int vm_enter_jni(void *caller_frame, unsigned long call_site_addr, struct vm_method *method) -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 3/3] vm: remove -Xtrace:threads. Always print current thread's name.
Also remove a crappy comment in trace.c Signed-off-by: Tomek Grabiec --- include/jit/compiler.h |1 - vm/jato.c |6 -- vm/trace.c | 14 -- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/include/jit/compiler.h b/include/jit/compiler.h index 087a795..18e32a8 100644 --- a/include/jit/compiler.h +++ b/include/jit/compiler.h @@ -102,7 +102,6 @@ extern bool opt_trace_invoke_verbose; extern bool opt_trace_exceptions; extern bool opt_trace_bytecode; extern bool opt_trace_compile; -extern bool opt_trace_threads; void trace_magic_trampoline(struct compilation_unit *); void trace_method(struct compilation_unit *); diff --git a/vm/jato.c b/vm/jato.c index d130b2d..4e47a07 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -814,11 +814,6 @@ static void handle_trace_bytecode(void) opt_trace_compile = true; } -static void handle_trace_threads(void) -{ - opt_trace_threads = true; -} - static void handle_trace_trampoline(void) { opt_trace_magic_trampoline = true; @@ -896,7 +891,6 @@ const struct option options[] = { DEFINE_OPTION("Xtrace:invoke-verbose", handle_trace_invoke_verbose), DEFINE_OPTION("Xtrace:itable", handle_trace_itable), DEFINE_OPTION("Xtrace:jit", handle_trace_jit), - DEFINE_OPTION("Xtrace:threads", handle_trace_threads), DEFINE_OPTION("Xtrace:trampoline", handle_trace_trampoline), }; diff --git a/vm/trace.c b/vm/trace.c index 6e8fc02..e907a92 100644 --- a/vm/trace.c +++ b/vm/trace.c @@ -38,8 +38,6 @@ static pthread_mutex_t trace_mutex = PTHREAD_MUTEX_INITIALIZER; -/* Holds the trace output. It it initialized in trace_begin() and - printed in trace_end(). */ static __thread struct string *trace_buffer = NULL; static void ensure_trace_buffer(void) @@ -81,15 +79,11 @@ void trace_flush(void) { pthread_mutex_lock(&trace_mutex); - if (opt_trace_threads) { - line = strtok_r(trace_buffer->value, "\n", &strtok_ptr); - while (line) { - fprintf(stderr, "[%s] %s\n", thread_name, line); + line = strtok_r(trace_buffer->value, "\n", &strtok_ptr); + while (line) { + fprintf(stderr, "[%s] %s\n", thread_name, line); - line = strtok_r(NULL, "\n", &strtok_ptr); - } - } else { - fprintf(stderr, "%s", trace_buffer->value); + line = strtok_r(NULL, "\n", &strtok_ptr); } pthread_mutex_unlock(&trace_mutex); -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 1/3] vm: do not use \r character in backtrace printing.
It makes the output corrupted. We make show_exe_function() print to a buffer which is printed only when function succeeds. Signed-off-by: Tomek Grabiec --- arch/x86/backtrace.c | 21 +++-- include/vm/backtrace.h |4 +++- vm/stack-trace.c | 11 --- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/arch/x86/backtrace.c b/arch/x86/backtrace.c index 684fcaa..500b420 100644 --- a/arch/x86/backtrace.c +++ b/arch/x86/backtrace.c @@ -40,6 +40,8 @@ #include "vm/stack-trace.h" #include "vm/trace.h" +#include "lib/string.h" + /* get REG_EIP from ucontext.h */ #include @@ -59,7 +61,7 @@ static asymbol *lookup_symbol(asymbol ** symbols, int nr_symbols, return NULL; } -bool show_exe_function(void *addr) +bool show_exe_function(void *addr, struct string *str) { bool ret; const char *function_name; @@ -114,8 +116,8 @@ bool show_exe_function(void *addr) symbol_start = bfd_asymbol_value(symbol); symbol_offset = (unsigned long) addr - symbol_start; - trace_printf("%s+%llx (%s:%i)\n", - function_name, (long long) symbol_offset, filename, line); + str_append(str, "%s+%llx (%s:%i)\n", + function_name, (long long) symbol_offset, filename, line); ret = true; out: @@ -132,10 +134,17 @@ failed: void show_function(void *addr) { - if (show_exe_function(addr)) - return; + struct string *str; + + str = alloc_str(); + + if (show_exe_function(addr, str)) { + trace_printf("%s", str->value); + } else { + trace_printf("\n"); + } - trace_printf("\n"); + free_str(str); } static unsigned long get_greg(gregset_t gregs, int reg) diff --git a/include/vm/backtrace.h b/include/vm/backtrace.h index c7dd4de..6cb2406 100644 --- a/include/vm/backtrace.h +++ b/include/vm/backtrace.h @@ -4,10 +4,12 @@ #include #include +struct string; + extern void print_backtrace_and_die(int, siginfo_t *, void *); extern void print_trace(void); extern void print_trace_from(unsigned long, void*); -extern bool show_exe_function(void *addr); +extern bool show_exe_function(void *addr, struct string *str); extern void show_function(void *addr); #endif diff --git a/vm/stack-trace.c b/vm/stack-trace.c index 404aae9..31cf218 100644 --- a/vm/stack-trace.c +++ b/vm/stack-trace.c @@ -729,9 +729,14 @@ static void show_mixed_stack_trace(struct stack_trace_elem *elem) print_java_stack_trace_elem(elem); trace_printf("\n"); - trace_printf("%-27s"," "); - if (!show_exe_function((void *) elem->addr)) - trace_printf("\r"); + struct string *str; + + str = alloc_str(); + + if (show_exe_function((void *) elem->addr, str)) + trace_printf("%-27s%s", " ", str->value); + + free_str(str); continue; } -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] vm: remove -Xtrace:threads. Always print current thread's name.
Also remove a crappy comment in trace.c Signed-off-by: Tomek Grabiec --- include/jit/compiler.h |1 - vm/jato.c |6 -- vm/trace.c | 14 -- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/include/jit/compiler.h b/include/jit/compiler.h index 087a795..18e32a8 100644 --- a/include/jit/compiler.h +++ b/include/jit/compiler.h @@ -102,7 +102,6 @@ extern bool opt_trace_invoke_verbose; extern bool opt_trace_exceptions; extern bool opt_trace_bytecode; extern bool opt_trace_compile; -extern bool opt_trace_threads; void trace_magic_trampoline(struct compilation_unit *); void trace_method(struct compilation_unit *); diff --git a/vm/jato.c b/vm/jato.c index d130b2d..4e47a07 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -814,11 +814,6 @@ static void handle_trace_bytecode(void) opt_trace_compile = true; } -static void handle_trace_threads(void) -{ - opt_trace_threads = true; -} - static void handle_trace_trampoline(void) { opt_trace_magic_trampoline = true; @@ -896,7 +891,6 @@ const struct option options[] = { DEFINE_OPTION("Xtrace:invoke-verbose", handle_trace_invoke_verbose), DEFINE_OPTION("Xtrace:itable", handle_trace_itable), DEFINE_OPTION("Xtrace:jit", handle_trace_jit), - DEFINE_OPTION("Xtrace:threads", handle_trace_threads), DEFINE_OPTION("Xtrace:trampoline", handle_trace_trampoline), }; diff --git a/vm/trace.c b/vm/trace.c index 6e8fc02..e907a92 100644 --- a/vm/trace.c +++ b/vm/trace.c @@ -38,8 +38,6 @@ static pthread_mutex_t trace_mutex = PTHREAD_MUTEX_INITIALIZER; -/* Holds the trace output. It it initialized in trace_begin() and - printed in trace_end(). */ static __thread struct string *trace_buffer = NULL; static void ensure_trace_buffer(void) @@ -81,15 +79,11 @@ void trace_flush(void) { pthread_mutex_lock(&trace_mutex); - if (opt_trace_threads) { - line = strtok_r(trace_buffer->value, "\n", &strtok_ptr); - while (line) { - fprintf(stderr, "[%s] %s\n", thread_name, line); + line = strtok_r(trace_buffer->value, "\n", &strtok_ptr); + while (line) { + fprintf(stderr, "[%s] %s\n", thread_name, line); - line = strtok_r(NULL, "\n", &strtok_ptr); - } - } else { - fprintf(stderr, "%s", trace_buffer->value); + line = strtok_r(NULL, "\n", &strtok_ptr); } pthread_mutex_unlock(&trace_mutex); -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] vm: do not use \r character in backtrace printing.
It makes the output corrupted. We make show_exe_function() print to a buffer which is printed only when function succeeds. Signed-off-by: Tomek Grabiec --- arch/x86/backtrace.c | 21 +++-- include/vm/backtrace.h |4 +++- vm/signal.c|2 ++ vm/stack-trace.c | 11 --- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/arch/x86/backtrace.c b/arch/x86/backtrace.c index 684fcaa..500b420 100644 --- a/arch/x86/backtrace.c +++ b/arch/x86/backtrace.c @@ -40,6 +40,8 @@ #include "vm/stack-trace.h" #include "vm/trace.h" +#include "lib/string.h" + /* get REG_EIP from ucontext.h */ #include @@ -59,7 +61,7 @@ static asymbol *lookup_symbol(asymbol ** symbols, int nr_symbols, return NULL; } -bool show_exe_function(void *addr) +bool show_exe_function(void *addr, struct string *str) { bool ret; const char *function_name; @@ -114,8 +116,8 @@ bool show_exe_function(void *addr) symbol_start = bfd_asymbol_value(symbol); symbol_offset = (unsigned long) addr - symbol_start; - trace_printf("%s+%llx (%s:%i)\n", - function_name, (long long) symbol_offset, filename, line); + str_append(str, "%s+%llx (%s:%i)\n", + function_name, (long long) symbol_offset, filename, line); ret = true; out: @@ -132,10 +134,17 @@ failed: void show_function(void *addr) { - if (show_exe_function(addr)) - return; + struct string *str; + + str = alloc_str(); + + if (show_exe_function(addr, str)) { + trace_printf("%s", str->value); + } else { + trace_printf("\n"); + } - trace_printf("\n"); + free_str(str); } static unsigned long get_greg(gregset_t gregs, int reg) diff --git a/include/vm/backtrace.h b/include/vm/backtrace.h index c7dd4de..6cb2406 100644 --- a/include/vm/backtrace.h +++ b/include/vm/backtrace.h @@ -4,10 +4,12 @@ #include #include +struct string; + extern void print_backtrace_and_die(int, siginfo_t *, void *); extern void print_trace(void); extern void print_trace_from(unsigned long, void*); -extern bool show_exe_function(void *addr); +extern bool show_exe_function(void *addr, struct string *str); extern void show_function(void *addr); #endif diff --git a/vm/signal.c b/vm/signal.c index 3e59480..de65854 100644 --- a/vm/signal.c +++ b/vm/signal.c @@ -91,6 +91,8 @@ static void sigfpe_handler(int sig, siginfo_t *si, void *ctx) static void sigsegv_handler(int sig, siginfo_t *si, void *ctx) { + print_trace(); + if (signal_from_native(ctx)) goto exit; diff --git a/vm/stack-trace.c b/vm/stack-trace.c index 404aae9..31cf218 100644 --- a/vm/stack-trace.c +++ b/vm/stack-trace.c @@ -729,9 +729,14 @@ static void show_mixed_stack_trace(struct stack_trace_elem *elem) print_java_stack_trace_elem(elem); trace_printf("\n"); - trace_printf("%-27s"," "); - if (!show_exe_function((void *) elem->addr)) - trace_printf("\r"); + struct string *str; + + str = alloc_str(); + + if (show_exe_function((void *) elem->addr, str)) + trace_printf("%-27s%s", " ", str->value); + + free_str(str); continue; } -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] regression: add comparison operators to FloatArithmeticTest
Javac produces both fcmpg and fcmpl instructions for this, verified with javap. Signed-off-by: Vegard Nossum --- regression/jvm/FloatArithmeticTest.java | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/regression/jvm/FloatArithmeticTest.java b/regression/jvm/FloatArithmeticTest.java index 5632acb..d07e277 100644 --- a/regression/jvm/FloatArithmeticTest.java +++ b/regression/jvm/FloatArithmeticTest.java @@ -132,6 +132,26 @@ public class FloatArithmeticTest extends TestCase { assertEquals(-3000f, i2f(-3000)); } +private static float zero = 0.0f; +private static float one = 1.0f; + +public static void testFloatComparison() { +assertTrue(zero < one); +assertFalse(one < zero); +assertFalse(one < one); + +assertTrue(zero <= one); +assertTrue(one <= one); + +assertFalse(zero > one); +assertTrue(one > zero); +assertFalse(one > one); + +assertTrue(one >= zero); +assertTrue(one >= one); +} + + public static void main(String[] args) { testFloatAddition(); testFloatAdditionLocalSlot(); @@ -142,5 +162,6 @@ public class FloatArithmeticTest extends TestCase { testFloatRemainder(); testFloatNegation(); testFloatIntConversion(); +testFloatComparison(); } } -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] x86: add OP_CMPG to insn-selector
This is a copy of OP_CMPL with a call to emulate_fcmpg instead of emulate_fcmpl. Signed-off-by: Vegard Nossum --- arch/x86/insn-selector.brg | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index 6cad013..3c8385a 100644 --- a/arch/x86/insn-selector.brg +++ b/arch/x86/insn-selector.brg @@ -754,6 +754,26 @@ reg: OP_CMPL(freg, freg) 1 select_insn(s, tree, reg_reg_insn(INSN_MOV_REG_REG, eax, state->reg1)); } +reg: OP_CMPG(freg, freg) 1 +{ + struct var_info *esp, *eax; + + state->reg1 = get_var(s->b_parent, J_INT); + + esp = get_fixed_var(s->b_parent, REG_xSP); + eax = get_fixed_var(s->b_parent, REG_xAX); + + select_insn(s, tree, reg_membase_insn(INSN_MOV_XMM_MEMBASE, state->left->reg1, esp, -8)); + select_insn(s, tree, reg_membase_insn(INSN_MOV_XMM_MEMBASE, state->right->reg1, esp, -4)); + + select_insn(s, tree, imm_reg_insn(INSN_SUB_IMM_REG, 8, esp)); + + select_insn(s, tree, rel_insn(INSN_CALL_REL, (unsigned long) emulate_fcmpg)); + method_args_cleanup(s, tree, 2); + + select_insn(s, tree, reg_reg_insn(INSN_MOV_REG_REG, eax, state->reg1)); +} + reg: OP_CMP(reg, reg) 1 { emulate_op_64(state, s, tree, emulate_lcmp, J_LONG, J_INT); -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] jato: add -Xtrace:method for single-method tracing
This lets us trace the compilation of a single method without executing it. Note that the VM still needs to be initialized and some static class initializers will still be compiled (and traced) and executed. Example: jato -Xtrace:jit -Xtrace:method 'java/nio/charset/CharsetEncoder.(Ljava/nio/charset/Charset;FF[B)V' Signed-off-by: Vegard Nossum --- vm/jato.c | 148 +++-- 1 files changed, 115 insertions(+), 33 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index 37ccd66..d8ebe78 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -676,11 +676,25 @@ static void handle_classpath(const char *arg) classloader_add_to_classpath(arg); } +enum operation { + OPERATION_MAIN_CLASS, + OPERATION_JAR_FILE, + OPERATION_METHOD_TRACE, +}; + +static enum operation operation = OPERATION_MAIN_CLASS; + static char *classname; static struct vm_jar *jar_file; +static char *method_trace_class_name; +static char *method_trace_method_name; +static char *method_trace_method_type; + static void handle_jar(const char *arg) { + operation = OPERATION_JAR_FILE; + /* Can't specify more than one jar file */ if (jar_file) usage(stderr, EXIT_FAILURE); @@ -714,6 +728,30 @@ static void handle_perf(void) perf_enabled = true; } +/* @arg must be in the format package/name/Class.method(Lsignature;)V */ +static void handle_trace_method(const char *arg) +{ + char *next; + + operation = OPERATION_METHOD_TRACE; + + next = strchr(arg, '.'); + if (!next) + usage(stderr, EXIT_FAILURE); + + method_trace_class_name = strndup(arg, next - arg); + + arg = next + 1; + next = strchr(arg, '('); + if (!next) + usage(stderr, EXIT_FAILURE); + + method_trace_method_name = strndup(arg, next - arg); + + arg = next; + method_trace_method_type = strdup(arg); +} + static void handle_trace_asm(void) { opt_trace_method = true; @@ -844,6 +882,8 @@ const struct option options[] = { DEFINE_OPTION("Xperf", handle_perf), + DEFINE_OPTION_ARG("Xtrace:method", handle_trace_method), + DEFINE_OPTION("Xtrace:asm", handle_trace_asm), DEFINE_OPTION("Xtrace:bytecode",handle_trace_bytecode), DEFINE_OPTION("Xtrace:bytecode-offset", handle_trace_bytecode_offset), @@ -903,9 +943,8 @@ static void parse_options(int argc, char *argv[]) opt->handler.func_arg(argv[++optind]); } - if (optind < argc) { - /* Can't specify both a jar and a class file */ - if (jar_file) + if (operation == OPERATION_MAIN_CLASS) { + if (optind >= argc) usage(stderr, EXIT_FAILURE); classname = argv[optind++]; @@ -914,10 +953,68 @@ static void parse_options(int argc, char *argv[]) /* Should be no more options after this */ if (optind < argc) usage(stderr, EXIT_FAILURE); +} - /* Can't specify neither a jar and a class file */ - if (!classname) - usage(stderr, EXIT_FAILURE); +static int +do_main_class(void) +{ + struct vm_class *vmc = classloader_load(classname); + if (!vmc) { + fprintf(stderr, "error: %s: could not load\n", classname); + return -1; + } + + if (vm_class_ensure_init(vmc)) { + fprintf(stderr, "error: %s: couldn't initialize\n", classname); + return -1; + } + + struct vm_method *vmm = vm_class_get_method_recursive(vmc, + "main", "([Ljava/lang/String;)V"); + if (!vmm) { + fprintf(stderr, "error: %s: no main method\n", classname); + return -1; + } + + if (!vm_method_is_static(vmm)) { + fprintf(stderr, "error: %s: main method not static\n", + classname); + return -1; + } + + void (*main_method_trampoline)(void) + = vm_method_trampoline_ptr(vmm); + main_method_trampoline(); + + return 0; +} + +static int +do_jar_file(void) +{ + /* XXX: This stub should be expanded in the future; see comment in +* handle_jar(). */ + return do_main_class(); +} + +static int +do_method_trace(void) +{ + struct vm_class *vmc = classloader_load(method_trace_class_name); + if (!vmc) { + NOT_IMPLEMENTED; + return -1; + } + + struct vm_method *vmm = vm_class_get_method_recursive(vmc, + method_trace_method_name, method_trace_method_type); + if (!vmm) { + NOT_IMPLEMENTED; + return -1; + } + + compile(vmm->compilation_unit); + return 0; } int @@ -933,9 +1030,9 @@ main(int argc, char *argv[]) setvbuf(stderr, NULL, _IONBF, 0); #endif - init_system_properti
[PATCH] jit: add live-in/use/def/live-out set dumping to liveness analysis tracing
This helped me resolve a bug, so I suppose it's useful in general. Signed-off-by: Vegard Nossum --- jit/trace-jit.c | 53 +++-- 1 files changed, 47 insertions(+), 6 deletions(-) diff --git a/jit/trace-jit.c b/jit/trace-jit.c index 8a3eaa9..c9bae17 100644 --- a/jit/trace-jit.c +++ b/jit/trace-jit.c @@ -17,15 +17,15 @@ #include "jit/statement.h" #include "jit/vars.h" #include "jit/args.h" -#include "vm/preload.h" -#include "vm/object.h" -#include "vm/bytecodes.h" -#include "vm/trace.h" - #include "lib/buffer.h" +#include "lib/bitset.h" +#include "lib/string.h" +#include "vm/bytecodes.h" #include "vm/class.h" #include "vm/method.h" -#include "lib/string.h" +#include "vm/object.h" +#include "vm/preload.h" +#include "vm/trace.h" #include "vm/vm.h" #include "arch/stack-frame.h" @@ -167,6 +167,7 @@ void trace_lir(struct compilation_unit *cu) trace_printf("- --- --- \n"); for_each_basic_block(bb, &cu->bb_list) { + trace_printf("[bb %p]:\n", bb); for_each_insn(insn, &bb->insn_list) { str = alloc_str(); lir_print(insn, str); @@ -227,6 +228,42 @@ print_var_liveness(struct compilation_unit *cu, struct var_info *var) trace_printf(" (empty)\n"); } +static void print_bitset(struct bitset *bitset) +{ + for (unsigned int i = 0; i < bitset->nr_bits; ++i) { + trace_printf("%s", test_bit(bitset->bits, i) + ? "***" : "---"); + } +} + +static void print_bb_live_sets(struct basic_block *bb) +{ + trace_printf("[bb %p]\n", bb); + + trace_printf(" "); + for (unsigned int i = 0; i < bb->live_in_set->nr_bits; ++i) + trace_printf("%-3d", i); + trace_printf("\n"); + + trace_printf("live in: "); + print_bitset(bb->live_in_set); + trace_printf("\n"); + + trace_printf("uses: "); + print_bitset(bb->use_set); + trace_printf("\n"); + + trace_printf("defines: "); + print_bitset(bb->def_set); + trace_printf("\n"); + + trace_printf("live out: "); + print_bitset(bb->live_out_set); + trace_printf("\n"); + + trace_printf("\n"); +} + void trace_liveness(struct compilation_unit *cu) { struct basic_block *bb; @@ -251,6 +288,10 @@ void trace_liveness(struct compilation_unit *cu) print_var_liveness(cu, var); trace_printf("\n"); + + for_each_basic_block(bb, &cu->bb_list) + print_bb_live_sets(bb); + trace_printf("\n"); } void trace_regalloc(struct compilation_unit *cu) -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] vm: implement JNI function GetObjectField()
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 19 ++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index dfba479..eb8468e 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -524,6 +524,23 @@ static jobject vm_jni_new_object(struct vm_jni_env *env, jobject clazz, return obj; } +static jobject vm_jni_get_object_field(struct vm_jni_env *env, jobject object, + jfieldID field) +{ + enter_vm_from_jni(); + + if (!object) { + signal_new_exception(vm_java_lang_NullPointerException, NULL); + return 0; + } + + if (vm_field_type(field) != J_REFERENCE) { + NOT_IMPLEMENTED; + return 0; + } + + return field_get_object(object, field); +} /* * The JNI native interface table. @@ -664,7 +681,7 @@ void *vm_jni_native_interface[] = { vm_jni_get_field_id, /* 95 */ - NULL, /* GetObjectField */ + vm_jni_get_object_field, NULL, /* GetBooleanField */ NULL, /* GetByteField */ NULL, /* GetCharField */ -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] jit: fix liveness analysis
All registers that were defined in the basic block were subtracted from the use set. This is right if the order is "define, use", but it's wrong if the order is "use, define". Fix this by checking if the register has already been used/defined. Signed-off-by: Vegard Nossum --- jit/liveness.c | 18 +- test/jit/spill-reload-test.c | 12 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/jit/liveness.c b/jit/liveness.c index 84b413a..90f2a0c 100644 --- a/jit/liveness.c +++ b/jit/liveness.c @@ -147,18 +147,18 @@ static void __analyze_use_def(struct basic_block *bb, struct insn *insn) struct var_info *var; for_each_variable(var, bb->b_parent->var_infos) { + if (insn_uses(insn, var)) { + /* +* It's in the use set if and only if it has not +* _already_ been defined by insn basic block. +*/ + if (!test_bit(bb->def_set->bits, var->vreg)) + set_bit(bb->use_set->bits, var->vreg); + } + if (insn_defs(insn, var)) set_bit(bb->def_set->bits, var->vreg); - - if (insn_uses(insn, var)) - set_bit(bb->use_set->bits, var->vreg); } - - /* -* It's in the use set if and only if it has not been defined -* by insn basic block. -*/ - bitset_sub(bb->def_set, bb->use_set); } static void analyze_use_def(struct compilation_unit *cu) diff --git a/test/jit/spill-reload-test.c b/test/jit/spill-reload-test.c index bf0abba..2b654ee 100644 --- a/test/jit/spill-reload-test.c +++ b/test/jit/spill-reload-test.c @@ -122,16 +122,16 @@ void test_reload_insn_is_inserted_at_the_beginning_of_the_interval_if_necessary( insert_spill_reload_insns(cu); /* -* First instruction stays the same. -*/ +* A reload instruction is inserted at the beginning. +*/ insn = list_first_entry(&bb->insn_list, struct insn, insn_list_node); - assert_ptr_equals(insn_array[0], insn); + assert_ld_insn(INSN_LD_LOCAL, r2->interval->reg, r1->interval->spill_slot, insn); /* -* A reload instruction is inserted before the interval end. -*/ +* Second instruction stays the same. +*/ insn = list_next_entry(&insn->insn_list_node, struct insn, insn_list_node); - assert_ld_insn(INSN_LD_LOCAL, r2->interval->reg, r1->interval->spill_slot, insn); + assert_ptr_equals(insn_array[0], insn); /* * Last instruction stays the same. -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] vm: add some debugging info in case of itable failure
I needed this for debugging, but getting our hands on this information can be a bit subtle and tricky, so why not just leave it there for future reference. Signed-off-by: Vegard Nossum --- vm/itable.c | 20 ++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/vm/itable.c b/vm/itable.c index c962211..77409c0 100644 --- a/vm/itable.c +++ b/vm/itable.c @@ -29,8 +29,10 @@ #include #include +#include "vm/stack-trace.h" #include "vm/classloader.h" #include "vm/class.h" +#include "vm/object.h" #include "vm/itable.h" #include "vm/method.h" @@ -111,9 +113,23 @@ static int itable_add_entries(struct vm_class *vmc, struct list_head *itable) return 0; } -static void itable_resolver_stub_error(void) +/* The regparm(1) makes GCC get the first argument from %ecx and the rest + * from the stack. This is convenient, because we use %ecx for passing the + * hidden "method" parameter. Interfaces are invoked on objects, so we also + * always get the object in the first stack parameter. + * + * XXX: This is arch-specific (x86_32) code, should do something else here. */ +static void __attribute__((regparm(1))) +itable_resolver_stub_error(struct vm_method *method, struct vm_object *obj) { - printf("itable resolver stub error!\n"); + fprintf(stderr, "itable resolver stub error!\n"); + fprintf(stderr, "invokeinterface called on method %s.%s%s " + "(itable index %d)\n", + method->class->name, method->name, method->type, + method->itable_index); + fprintf(stderr, "object class %s\n", obj->class->name); + + print_trace(); abort(); } -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] jit: add live-in/use/def/live-out set dumping to liveness analysis tracing
This helped me resolve a bug, so I suppose it's useful in general. Signed-off-by: Vegard Nossum --- jit/trace-jit.c | 55 ++- 1 files changed, 50 insertions(+), 5 deletions(-) diff --git a/jit/trace-jit.c b/jit/trace-jit.c index 37fe6d4..ccd434a 100644 --- a/jit/trace-jit.c +++ b/jit/trace-jit.c @@ -17,14 +17,14 @@ #include "jit/statement.h" #include "jit/vars.h" #include "jit/args.h" -#include "vm/preload.h" -#include "vm/object.h" -#include "vm/bytecodes.h" - #include "lib/buffer.h" +#include "lib/bitset.h" +#include "lib/string.h" +#include "vm/bytecodes.h" #include "vm/class.h" #include "vm/method.h" -#include "lib/string.h" +#include "vm/object.h" +#include "vm/preload.h" #include "vm/vm.h" #include "arch/stack-frame.h" @@ -197,6 +197,7 @@ void trace_lir(struct compilation_unit *cu) printf("- --- --- \n"); for_each_basic_block(bb, &cu->bb_list) { + printf("[bb %p]:\n", bb); for_each_insn(insn, &bb->insn_list) { str = alloc_str(); lir_print(insn, str); @@ -257,6 +258,46 @@ print_var_liveness(struct compilation_unit *cu, struct var_info *var) printf(" (empty)\n"); } +static void print_bb_live_sets(struct basic_block *bb) +{ + printf("[bb %p]\n", bb); + + printf(" "); + for (unsigned int i = 0; i < bb->live_in_set->nr_bits; ++i) + printf("%-3d", i); + printf("\n"); + + printf("live in: "); + for (unsigned long i = 0; i < bb->live_in_set->nr_bits; ++i) { + printf("%s", test_bit(bb->live_in_set->bits, i) + ? "***" : "---"); + } + printf("\n"); + + printf("uses: "); + for (unsigned long i = 0; i < bb->use_set->nr_bits; ++i) { + printf("%s", test_bit(bb->use_set->bits, i) + ? "***" : "---"); + } + printf("\n"); + + printf("defines: "); + for (unsigned long i = 0; i < bb->def_set->nr_bits; ++i) { + printf("%s", test_bit(bb->def_set->bits, i) + ? "***" : "---"); + } + printf("\n"); + + printf("live out: "); + for (unsigned long i = 0; i < bb->live_out_set->nr_bits; ++i) { + printf("%s", test_bit(bb->live_out_set->bits, i) + ? "***" : "---"); + } + printf("\n"); + + printf("\n"); +} + void trace_liveness(struct compilation_unit *cu) { struct basic_block *bb; @@ -281,6 +322,10 @@ void trace_liveness(struct compilation_unit *cu) print_var_liveness(cu, var); printf("\n"); + + for_each_basic_block(bb, &cu->bb_list) + print_bb_live_sets(bb); + printf("\n"); } void trace_regalloc(struct compilation_unit *cu) -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 4/4] vm: do not try to put null values into system properties.
It is an error because Java API says that getProperty() returns null when property is not set. Reported-by: Pekka Enberg Signed-off-by: Tomek Grabiec --- vm/jato.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/vm/jato.c b/vm/jato.c index 37ccd66..1b5aa8e 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -165,6 +165,9 @@ static void add_system_property_const(const char *key, const char *value) char *key_d; char *value_d; + if (value == NULL) + value = ""; + key_d = strdup(key); value_d = strdup(value); -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 3/4] vm: use trace_printf() to print the whole backtrace.
show_function() and show_exe_function() were not using the trace buffer which led to inconsistent backtrace output. Reported-by: Pekka Enberg Signed-off-by: Tomek Grabiec --- arch/x86/backtrace.c | 28 ++-- test/vm/stack-trace-stub.c |6 -- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/x86/backtrace.c b/arch/x86/backtrace.c index 64e5ccd..684fcaa 100644 --- a/arch/x86/backtrace.c +++ b/arch/x86/backtrace.c @@ -114,7 +114,7 @@ bool show_exe_function(void *addr) symbol_start = bfd_asymbol_value(symbol); symbol_offset = (unsigned long) addr - symbol_start; - printf("%s+%llx (%s:%i)\n", + trace_printf("%s+%llx (%s:%i)\n", function_name, (long long) symbol_offset, filename, line); ret = true; @@ -135,7 +135,7 @@ void show_function(void *addr) if (show_exe_function(addr)) return; - printf("\n"); + trace_printf("\n"); } static unsigned long get_greg(gregset_t gregs, int reg) @@ -165,10 +165,10 @@ static void show_registers(gregset_t gregs) ebp = get_greg(gregs, REG_EBP); esp = get_greg(gregs, REG_ESP); - printf("Registers:\n"); - printf(" eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", + trace_printf("Registers:\n"); + trace_printf(" eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", eax, ebx, ecx, edx); - printf(" esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", + trace_printf(" esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", esi, edi, ebp, esp); } @@ -210,13 +210,13 @@ static void show_registers(gregset_t gregs) r14 = get_greg(gregs, REG_R14); r15 = get_greg(gregs, REG_R15); - printf("Registers:\n"); - printf(" rsp: %016lx\n", rsp); - printf(" rax: %016lx ebx: %016lx ecx: %016lx\n", rax, rbx, rcx); - printf(" rdx: %016lx rsi: %016lx rdi: %016lx\n", rdx, rsi, rdi); - printf(" rbp: %016lx r8: %016lx r9: %016lx\n", rbp, r8, r9); - printf(" r10: %016lx r11: %016lx r12: %016lx\n", r10, r11, r12); - printf(" r13: %016lx r14: %016lx r15: %016lx\n", r13, r14, r15); + trace_printf("Registers:\n"); + trace_printf(" rsp: %016lx\n", rsp); + trace_printf(" rax: %016lx ebx: %016lx ecx: %016lx\n", rax, rbx, rcx); + trace_printf(" rdx: %016lx rsi: %016lx rdi: %016lx\n", rdx, rsi, rdi); + trace_printf(" rbp: %016lx r8: %016lx r9: %016lx\n", rbp, r8, r9); + trace_printf(" r10: %016lx r11: %016lx r12: %016lx\n", r10, r11, r12); + trace_printf(" r13: %016lx r14: %016lx r15: %016lx\n", r13, r14, r15); } #endif @@ -231,11 +231,11 @@ void print_backtrace_and_die(int sig, siginfo_t *info, void *secret) switch (sig) { case SIGSEGV: - printf("SIGSEGV at %s %08lx while accessing memory address %08lx.\n", + trace_printf("SIGSEGV at %s %08lx while accessing memory address %08lx.\n", IP_REG_NAME, eip, addr); break; default: - printf("Signal %d at %s %08lx\n", sig, IP_REG_NAME, eip); + trace_printf("Signal %d at %s %08lx\n", sig, IP_REG_NAME, eip); break; }; show_registers(uc->uc_mcontext.gregs); diff --git a/test/vm/stack-trace-stub.c b/test/vm/stack-trace-stub.c index 48cb7c9..d6414b4 100644 --- a/test/vm/stack-trace-stub.c +++ b/test/vm/stack-trace-stub.c @@ -54,11 +54,13 @@ static inline void __show_stack_trace(unsigned long start, unsigned long caller) if (caller) array[1] = (void *) caller; - printf("Native stack trace:\n"); + trace_printf("Native stack trace:\n"); for (i = start; i < size; i++) { - printf(" [<%08lx>] ", (unsigned long) array[i]); + trace_printf(" [<%08lx>] ", (unsigned long) array[i]); show_function(array[i]); } + + trace_flush(); } void print_trace(void) -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 2/4] x86: remove unnecessary XXX markers
Signed-off-by: Tomek Grabiec --- arch/x86/emit-code.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 521c150..2afd1fb 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -395,7 +395,7 @@ void fixup_direct_calls(struct jit_trampoline *t, unsigned long target) bool is_compiled; /* -* XXX: it is possible that we're fixing calls to +* 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 @@ -1489,8 +1489,8 @@ void emit_trampoline(struct compilation_unit *cu, __emit_push_reg(buf, REG_EAX); if (method_is_virtual(cu->method)) { - /* XXX: for JNI calls 'this' pointer is in the second - call argument. */ + /* For JNI calls 'this' pointer is in the second call + argument. */ if (vm_method_is_jni(cu->method)) __emit_push_membase(buf, REG_EBP, 0x0c); else @@ -2417,8 +2417,8 @@ void emit_trampoline(struct compilation_unit *cu, __emit64_mov_imm_reg(buf, (unsigned long) cu, REG_RDI); - /* XXX: for JNI calls 'this' pointer is in the second - call argument. */ + /* For JNI calls 'this' pointer is in the second call + argument. */ if (vm_method_is_jni(cu->method)) __emit64_mov_membase_reg(buf, REG_RBP, 0x18, REG_RSI); else -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH 1/4] vm: cleanup brace placement in jni-interface.c
Signed-off-by: Tomek Grabiec --- vm/jni-interface.c | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 44efde2..dfba479 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -52,19 +52,23 @@ if (!vm_object_is_instance_of((x), vm_java_lang_Class)) \ return NULL; -static void vm_jni_destroy_java_vm(void) { +static void vm_jni_destroy_java_vm(void) +{ NOT_IMPLEMENTED; } -static void vm_jni_attach_current_thread(void) { +static void vm_jni_attach_current_thread(void) +{ NOT_IMPLEMENTED; } -static void vm_jni_detach_current_thread(void) { +static void vm_jni_detach_current_thread(void) +{ NOT_IMPLEMENTED; } -static jint vm_jni_get_env(JavaVM *vm, void **env, jint version) { +static jint vm_jni_get_env(JavaVM *vm, void **env, jint version) +{ enter_vm_from_jni(); /* XXX: We are actually supporting only a little part of 1.2 yet. */ @@ -77,7 +81,8 @@ static jint vm_jni_get_env(JavaVM *vm, void **env, jint version) { return JNI_OK; } -static void vm_jni_attach_current_thread_as_daemon(void) { +static void vm_jni_attach_current_thread_as_daemon(void) +{ NOT_IMPLEMENTED; } -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[RFC][PATCH] test: fix spill-reload-test
The test was (as a single bb): add r1, r1, r1 add r2, r2, r2 r2 is expected to be reloaded, but because liveness analysis was wrong, it did not expect r1 to be reloaded. Now we change the code to: add r2, r1, r1 add r2, r2, r2 and expect the reload to appear before the first instruction. (Please double check, I have no idea why it works now and not before.) Signed-off-by: Vegard Nossum --- test/jit/spill-reload-test.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/jit/spill-reload-test.c b/test/jit/spill-reload-test.c index bf0abba..ad156b9 100644 --- a/test/jit/spill-reload-test.c +++ b/test/jit/spill-reload-test.c @@ -107,7 +107,7 @@ void test_reload_insn_is_inserted_at_the_beginning_of_the_interval_if_necessary( r1 = get_var(cu, J_INT); r2 = get_var(cu, J_INT); -insn_array[0] = arithmetic_insn(INSN_ADD, r1, r1, r1); +insn_array[0] = arithmetic_insn(INSN_ADD, r2, r1, r1); insn_array[1] = arithmetic_insn(INSN_ADD, r2, r2, r2); bb = get_basic_block(cu, 0, 2); @@ -122,16 +122,16 @@ void test_reload_insn_is_inserted_at_the_beginning_of_the_interval_if_necessary( insert_spill_reload_insns(cu); /* -* First instruction stays the same. -*/ +* A reload instruction is inserted at the beginning. +*/ insn = list_first_entry(&bb->insn_list, struct insn, insn_list_node); - assert_ptr_equals(insn_array[0], insn); + assert_ld_insn(INSN_LD_LOCAL, r2->interval->reg, r1->interval->spill_slot, insn); /* -* A reload instruction is inserted before the interval end. -*/ +* Second instruction stays the same. +*/ insn = list_next_entry(&insn->insn_list_node, struct insn, insn_list_node); - assert_ld_insn(INSN_LD_LOCAL, r2->interval->reg, r1->interval->spill_slot, insn); + assert_ptr_equals(insn_array[0], insn); /* * Last instruction stays the same. -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] x86: add USE_DST to INSN_ADD_IMM_REG
"add imm, reg" also uses the reg, so we should put this in the use-def. Someone should probably go through the whole list to verify that the rest is correct too. Signed-off-by: Vegard Nossum --- 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 93bb561..02180bd 100644 --- a/arch/x86/use-def.c +++ b/arch/x86/use-def.c @@ -43,7 +43,7 @@ static struct insn_info insn_infos[] = { DECLARE_INFO(INSN_ADC_IMM_REG, DEF_DST), DECLARE_INFO(INSN_ADC_MEMBASE_REG, USE_SRC | DEF_DST), DECLARE_INFO(INSN_ADC_REG_REG, USE_SRC | DEF_DST), - DECLARE_INFO(INSN_ADD_IMM_REG, DEF_DST), + DECLARE_INFO(INSN_ADD_IMM_REG, USE_DST | DEF_DST), DECLARE_INFO(INSN_ADD_MEMBASE_REG, USE_SRC | DEF_DST), DECLARE_INFO(INSN_ADD_REG_REG, USE_SRC | DEF_DST), DECLARE_INFO(INSN_AND_MEMBASE_REG, USE_SRC | DEF_DST), -- 1.6.0.6 -- 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 application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel