aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2013-07-11Signal tracing supportHEADmasterPekka Enberg5-0/+36
This patch adds '-Xtrace:signals' command line option for tracing VM signals. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-18x86-64: Fix INSN_JMP_MEMINDEX encodingPekka Enberg2-3/+40
Table 2-5 ("Special Cases of REX Encodings") of Intel manual states that: EBP without a displacement must be done using mod = 01 with displacement of 0. The problem is visible on x86-64 where INSN_JMP_MEMINDEX is encoded wrong. This fixes issue #34. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06x86-64: Add stack alignment assert() to native_call_gp()Pekka Enberg1-0/+2
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06x86: Improve check_stack_align() error messagePekka Enberg1-2/+9
Make the error more readable and add information about number of arguments passed on the stack: [penberg@tux jruby-1.7.3]$ jato -Xdebug:stack -jar lib/jruby.jar -v Error: stack is 8 bytes misaligned when entering function: gnu/java/net/loader/JarURLLoader.<init>(Ljava/net/URLClassLoader;Lgnu/java/net/loader/URLStreamHandlerCache;Ljava/net/URLStreamHandlerFactory;Ljava/net/URL;Ljava/net/URL;)V. which has 0 arguments passed on the stack. Aborted Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06Bye, bye, MMIX!Pekka Enberg30-2548/+0
It seemed like a good testing strategy at the time but it has turned out to be more trouble than it's worth. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06vm: Add default case to load_class_from_classpath_file()Pekka Enberg1-3/+3
Spotted by GCC: vm/classloader.c: In function ‘load_class_from_classpath_file’: vm/classloader.c:375:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06runtime: Add default cases to vm/reflection.cPekka Enberg1-7/+3
Spotted by GCC: runtime/reflection.c: In function ‘vm_type_to_class’: runtime/reflection.c:238:2: warning: switch missing default case [-Wswitch-default] runtime/reflection.c: In function ‘object_to_jvalue’: runtime/reflection.c:456:2: warning: switch missing default case [-Wswitch-default] runtime/reflection.c: In function ‘jvalue_to_object’: runtime/reflection.c:574:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06runtime: Add default case to VMField functionsPekka Enberg1-24/+8
Spotted by GCC: runtime/java_lang_reflect_VMField.c: In function ‘to_jlong_value’: runtime/java_lang_reflect_VMField.c:67:2: warning: switch missing default case [-Wswitch-default] runtime/java_lang_reflect_VMField.c: In function ‘to_jint_value’: runtime/java_lang_reflect_VMField.c:95:2: warning: switch missing default case [-Wswitch-default] runtime/java_lang_reflect_VMField.c: In function ‘to_jshort_value’: runtime/java_lang_reflect_VMField.c:122:2: warning: switch missing default case [-Wswitch-default] runtime/java_lang_reflect_VMField.c: In function ‘to_jdouble_value’: runtime/java_lang_reflect_VMField.c:147:2: warning: switch missing default case [-Wswitch-default] runtime/java_lang_reflect_VMField.c: In function ‘to_jfloat_value’: runtime/java_lang_reflect_VMField.c:177:2: warning: switch missing default case [-Wswitch-default] runtime/java_lang_reflect_VMField.c: In function ‘to_jchar_value’: runtime/java_lang_reflect_VMField.c:206:2: warning: switch missing default case [-Wswitch-default] runtime/java_lang_reflect_VMField.c: In function ‘to_jbyte_value’: runtime/java_lang_reflect_VMField.c:230:2: warning: switch missing default case [-Wswitch-default] runtime/java_lang_reflect_VMField.c: In function ‘to_jboolean_value’: runtime/java_lang_reflect_VMField.c:254:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06vm: Fix unsigned int comparisons in vm/fault-inject.cPekka Enberg1-4/+4
Spotted by GCC: CC vm/fault-inject.o vm/fault-inject.c: In function ‘vm_fault_enabled’: vm/fault-inject.c:39:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] vm/fault-inject.c: In function ‘vm_fault_arg’: vm/fault-inject.c:47:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] vm/fault-inject.c: In function ‘native_vm_enable_fault’: vm/fault-inject.c:56:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] vm/fault-inject.c: In function ‘native_vm_disable_fault’: vm/fault-inject.c:65:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06vm: Add default case to vm_object_clone()Pekka Enberg1-2/+4
Spotted by GCC: vm/object.c:303:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06vm: Fix field preload array initializersPekka Enberg2-134/+100
Spotted by GCC: vm/preload.c:80:2: warning: missing initializer [-Wmissing-field-initializers] vm/preload.c:80:2: warning: (near initialization for ‘primitive_preload_entries[0].optional’) [-Wmissing-field-initializers] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06jato: Add default case to main()Pekka Enberg1-0/+2
Spotted by GCC: jato.c: In function ‘main’: jato.c:1213:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06vm: Fix unsigned int comparison in stack_trace_elem_type_name()Pekka Enberg1-1/+1
Spotted by GCC: vm/stack-trace.c: In function ‘stack_trace_elem_type_name’: vm/stack-trace.c:723:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06runtime: Add default case to get_primitive_class_name()Pekka Enberg1-1/+2
Spotted by GCC: runtime/java_lang_VMClassLoader.c: In function ‘get_primitive_class_name’: runtime/java_lang_VMClassLoader.c:44:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06cafebabe: Add default case to cafebabe_constant_pool_deinit()Pekka Enberg1-0/+2
Spotted by GCC: cafebabe/constant_pool.c: In function ‘cafebabe_constant_pool_deinit’: cafebabe/constant_pool.c:318:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06cafebabe: Add default case to cafebabe_annotation_free()Pekka Enberg1-0/+2
Spotted by GCC: cafebabe/annotations_attribute.c: In function ‘cafebabe_annotation_free’: cafebabe/annotations_attribute.c:191:3: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06x86: Add default case to ssa_chg_jmp_direction()Pekka Enberg1-0/+2
Spotted by GCC: arch/x86/instruction.c: In function ‘ssa_chg_jmp_direction’: arch/x86/instruction.c:683:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06vm: Fix old style declarationsPekka Enberg2-2/+2
Spotted by GCC: vm/jni-interface.c:1676:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] vm/verifier.c:674:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06jit: Fix initializer in do_convert_bb_to_ir()Pekka Enberg1-3/+5
Spotted by GCC: jit/bytecode-to-ir.c: In function ‘do_convert_bb_to_ir’: jit/bytecode-to-ir.c:200:9: warning: missing initializer [-Wmissing-field-initializers] jit/bytecode-to-ir.c:200:9: warning: (near initialization for ‘buffer.buffer’) [-Wmissing-field-initializers] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06jit: Add default case to mark_clobbers()Pekka Enberg1-0/+3
Spotted by GCC: jit/clobber.c: In function ‘mark_clobbers’: jit/clobber.c:102:4: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06x86: Fix unsigned int comparison in x86_encode_reg()Pekka Enberg1-1/+1
Spotted by GCC: arch/x86/encode.c: In function ‘x86_encode_reg’: arch/x86/encode.c:109:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06vm: Fix unsigned int comparisons in vm/types.cPekka Enberg1-2/+2
Spotted by GCC: vm/types.c: In function ‘vmtype_to_bytecode_type’: vm/types.c:119:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] vm/types.c: In function ‘get_vm_type_name’: vm/types.c:140:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06x86-64: Add default case to native_call()Pekka Enberg1-0/+2
GCC points out that: arch/x86/call.c: In function ‘native_call’: arch/x86/call.c:247:2: warning: switch missing default case [-Wswitch-default] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06Fix range_is_empty() checkPekka Enberg1-1/+1
GCC reports the following problem in range_is_empty() include/jit/vars.h: In function ‘range_is_empty’: include/jit/vars.h:45:2: warning: comparison is always false due to limited range of data type [-Wtype-limits] Fix it. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-06-06More strict GCC warningsPekka Enberg1-18/+19
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-04-17sys/linux-x86: Simplify install_signal_bh()Pekka Enberg1-8/+5
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-04-15x86-64: Fix stack frame alignment for stack argumentsPekka Enberg6-1/+85
Section 3.2.2 ("The Stack Frame") of the SVR4 x86-64 ABI states that: The end of the input argument area shall be aligned on a 16 byte boundary. In other words, the value (%rsp - 8) is always a multiple of 16 when control is transferred to the function entry point. The stack pointer, %rsp, always points to the end of the latest allocated stack frame. Unfortunately the JIT compiler does not take that into account for arguments that are passed on the stack for x86-64. Fix the problem by adding a new STMT_BEFORE_ARGS statement that aligns the stack pointer properly and teach method_args_cleanup() to deal with the alignment. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-04-15jit, x86: Show entered method on stack alignment errorPekka Enberg3-4/+9
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-26x86-64: Save and restore r10 and r11 in signal_bh_trampoline()Pekka Enberg1-0/+4
The signal_bh_trampoline() function forgot to save and restore r10 and r11 which are also caller-save registers. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-26x86: Stack alignment debug checkPekka Enberg5-0/+33
Add stack alignment check to stack debugging that is enabled by the "-Xdebug:stack" command line option. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-26jit: Add INSN_RESTORE_CALLER_REGS to mark_clobbers()Pekka Enberg1-0/+3
The mark_clobbers() function doesn't deal with INSN_RESTORE_CALLER_REGS which causes caller-save register clobbering when calling functions with the return type void. Fix that up to make x86-64 behave properly again. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-25x86-64: Don't use fixups for GETSTATICPekka Enberg1-29/+9
Fixups are not known to work properly on 64-bit so don't use them. This fixes this: [penberg@golgotha jato]$ ./jato -Xtrace:exceptions -cp test/functional jvm/EntryTest [main] SIGSEGV at RIP 051e9aa8 while accessing memory address 00000000. [main] Registers: [main] rsp: 00007fffde9193d0 [main] rax: 0000000041fb9d20 rbx: 0000000000008000 rcx: 0000000000008000 [main] rdx: 0000000000000000 rsi: 0000000004921000 rdi: 0000000001a5fd20 [main] rbp: 00007fffde9195b0 r8: 0000000000008000 r9: 0000000004921000 [main] r10: 0000003ba1fb0778 r11: 0000000003de7b40 r12: 0000000000008000 [main] r13: 000000000525cc80 r14: 0000000000000002 r15: 0000000001a5fd20 [main] Stack: [main] 0000000001a5fd20 0000000001a5fd20 0000000004921000 0000000000000000 [main] 0000000000008000 0000000000008000 00007fffde919440 0000000005239800 [main] 0000000005296080 0000000000000000 00000000de919460 0000000003de7088 [main] Code: 00 00 00 20 a4 7c 04 00 00 00 00 80 99 1e 05 00 00 00 00 2f 00 00 00 00 00 00 00 e1 00 00 00 00 00 00 00 10 4b 1f 05 00 00 00 00 <30> 12 19 05 00 00 00 00 28 4b 1f 05 00 00 00 00 02 00 00 00 00 [main] Native and Java stack trace: [main] [<051e9aa8>] native : signal_bh_trampoline+4dbbef4 (arch/x86/signal-bh.S:124) [main] [<41fb9140>] jit : java/util/zip/Inflater.inflate(Inflater.java:322) [main] [<41fb77f4>] jit : java/util/zip/InflaterInputStream.read(InflaterInputStream.java:196) [main] [<41f7b710>] jit : java/io/InputStreamReader.read(InputStreamReader.java:393) [main] [<41f79a75>] jit : java/io/BufferedReader.fill(BufferedReader.java:370) [main] [<41f7780b>] jit : java/io/BufferedReader.readLine(BufferedReader.java:469) [main] [<41fb6c03>] jit : gnu/java/util/jar/JarUtils.read_attributes(JarUtils.java:194) [main] [<41fb67a5>] jit : gnu/java/util/jar/JarUtils.readMainSection(JarUtils.java:140) [main] [<41fb4456>] jit : gnu/java/util/jar/JarUtils.readMFManifest(JarUtils.java:101) [main] [<41f38b51>] jit : java/util/jar/Manifest.read(Manifest.java:162) [main] [<41f35b1d>] jit : java/util/jar/Manifest.<init>(Manifest.java:89) [main] [<41f1ebdf>] jit : java/util/jar/JarFile.readManifest(JarFile.java:303) [main] [<41f1d019>] jit : java/util/jar/JarFile.<init>(JarFile.java:268) [main] [<41ecda04>] jit : gnu/java/net/protocol/jar/Connection$JarFileCache.get(Connection.java:99) [main] [<41ecac72>] jit : gnu/java/net/protocol/jar/Connection.connect(Connection.java:141) [main] [<41ec9cb2>] jit : gnu/java/net/protocol/jar/Connection.getInputStream(Connection.java:159) [main] [<41ebfbbd>] jit : java/net/URL.openStream(URL.java:737) [main] [<41bdc459>] jit : java/lang/VMClassLoader.getBootPackages(VMClassLoader.java:262) [main] [<41bcb2ab>] jit : java/lang/VMClassLoader.<clinit>(VMClassLoader.java:88) [main] [<004101b0>] native : vm_class_init+175 (/home/penberg/jato/vm/class.c:748) [main] [<004254c2>] native : vm_class_ensure_init+ffffffffffff2f64 (/home/penberg/jato/include/vm/class.h:126) [main] [<41bc5b22>] jit : java/lang/VMClassLoader.getSystemClassLoader(VMClassLoader.java) [main] [<41bc7c43>] jit : java/lang/ClassLoader$StaticData.<clinit>(ClassLoader.java:154) [main] [<004101b0>] native : vm_class_init+175 (/home/penberg/jato/vm/class.c:748) [main] [<0041e47a>] native : vm_class_ensure_init+fffffffffffebf1c (/home/penberg/jato/include/vm/class.h:126) [main] [<00419e0c>] native : static_field_signal_bh+e (/home/penberg/jato/vm/static.c:66) [main] [<0042dc3b>] native : signal_bh_trampoline+87 (arch/x86/signal-bh.S:124) [main] [<41bc4f20>] jit : java/lang/ClassLoader.getSystemClassLoader(ClassLoader.java:796) [main] [<0041b4ea>] native : native_call_gp+c6 (/home/penberg/jato/arch/x86/call.c:203) [main] [<0041b54f>] native : native_call+42 (/home/penberg/jato/arch/x86/call.c:270) [main] [<0040f877>] native : call_method_a+41 (/home/penberg/jato/vm/call.c:54) [main] [<0040f941>] native : vm_call_method_v+99 (/home/penberg/jato/vm/call.c:71) [main] [<004119f2>] native : vm_call_method_object+48e6 (/home/penberg/jato/include/vm/call.h:81) [main] [<00405e6f>] native : do_main_class+18 (/home/penberg/jato/jato.c:1004) [main] [<00405775>] native : ./jato() [0x405775] [main] [<3ba1c21734>] native : signal_bh_trampoline+3ba17f3b80 (arch/x86/signal-bh.S:124) Aborted (core dumped) and makes it visible what's really happening: [penberg@golgotha jato]$ ./jato -Xtrace:exceptions -cp test/functional jvm/EntryTest [main] trace exception: exception object 0x459a240 (java/lang/IllegalArgumentException) thrown [main] message : 0x45b1e38 = "Non-positive averageCharsPerByte" (java/lang/String) [main] from : 0x40f86260: java/nio/charset/CharsetDecoder.<init>(Ljava/nio/charset/Charset;FFLjava/lang/String;)V [main] (CharsetDecoder.java:72) [main] action : unwind to 0x40f85a71: java/nio/charset/CharsetDecoder.<init>(Ljava/nio/charset/Charset;FF)V [main] (CharsetDecoder.java:89) Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-25Makefile: Fix dependencies after $PROGRAM changePekka Enberg1-12/+10
$PROGRAM is now $PROGRAMS. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-24vm: Fix VM method API namingPekka Enberg9-19/+14
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-24lib: Move option parsing to libPekka Enberg4-38/+77
Separate command line option parsing from the VM launcher. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-24jit: Fix jit_magic_trampoline() state checkPekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-24jit: Remove unused functionPekka Enberg1-11/+0
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-24Makefile: Support for multiple programsPekka Enberg2-6/+8
Add support for compiling multiple programs that use "libjvm.a" so we can experiment with alternative launcher programs. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-24jit: Verify method argument typesPekka Enberg2-7/+83
Reported-by: Vegard Nossum <vegard.nossum@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-11Merge pull request #33 from jvirtanen/fixes/gnu-classpath-deps-on-fedora-17Pekka Enberg1-2/+7
Document GNU Classpath dependencies on Fedora 17
2013-03-11Document GNU Classpath dependencies on Fedora 17Jussi Virtanen1-2/+7
GNU Classpath 0.99 does not appear to require either FastJar or PCCTS. Signed-off-by: Jussi Virtanen <jussi.k.virtanen@gmail.com>
2013-03-11Merge pull request #32 from jvirtanen/cleanups/libzip-documentationPekka Enberg1-3/+3
Remove 'libzip' dependency from documentation
2013-03-11Update GNU Classpath in build instructionsPekka Enberg1-7/+15
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-11Remove 'libzip' dependency from documentationJussi Virtanen1-3/+3
The 'libzip' dependency has already been removed. Update the documentation accordingly. Signed-off-by: Jussi Virtanen <jussi.k.virtanen@gmail.com>
2013-03-11Merge pull request #30 from jvirtanen/cleanups/libzipPekka Enberg1-5/+0
Remove 'libzip' dependency
2013-03-11Remove 'libzip' dependencyJussi Virtanen1-5/+0
It is not actually needed. Signed-off-by: Jussi Virtanen <jussi.k.virtanen@gmail.com>
2013-03-11x86-64: Enable StackTraceTestPekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-11vm: fix missing new line after vm native trace elementTomasz Grabiec1-1/+1
Signed-off-by: Tomasz Grabiec <tgrabiec@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-11vm: include native trampolines in stack tracesTomasz Grabiec2-3/+8
Signed-off-by: Tomasz Grabiec <tgrabiec@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-10vm/jar: Clean up codePekka Enberg1-32/+71
Reading vm/jar.c can feel like pulling teeth at times... Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-10x86-64: Fix infinite loop in compiler when method is missingPekka Enberg2-5/+1
Don't add the same call instruction twice to the compilation unit; otherwise the compile will enter an infinite loop in the liveness analysis. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-10x86-64: Fix invokestatic for missing methodsPekka Enberg1-1/+1
Fix the instruction selector rule for invokestatic to properly handle missing methods. The NoSuchMethodErrorTest test case is not enabled due to unrelated problems that cause it to hang indefinitely while compiling the test method for invokevirtual. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-05Improve TODO some morePekka Enberg1-6/+15
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-03-05Update TODO in preparation for Google Summer of CodePekka Enberg1-59/+72
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-02-02x86: Fix up whitespace in commentPekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2013-01-09Makefile: Improve dependency check error messagesPekka Enberg2-0/+27
Print out a human-readable error message if a dependency check fails. For example, if the libbfd library is missing, we print out the following error message: $ make Makefile:200: *** No libbfd found, please install binutils-devel or binutils-dev package.. Stop. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-09-26Update READMEPekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-09-26README layout updatesPekka Enberg1-10/+12
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-29tools/test, x86-64: Enable passing test casesPekka Enberg1-9/+9
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-29x86-64: Fix call instruction caller-save register clobberingPekka Enberg16-7/+369
Given this test program: public class Hashtable<K, V> { private final float loadFactor; public Hashtable(int initialCapacity, float loadFactor) { HashEntry<K, V>[] buckets = (HashEntry<K, V>[]) new HashEntry[initialCapacity]; if (!(loadFactor > 0)) throw new IllegalArgumentException(); this.loadFactor = loadFactor; } private static final class HashEntry<K, V> { } public static void main(String[] args) { Hashtable ht = new Hashtable(100, 0.75f); } } If you compile Jato with GCC optimization level "-O2", for example: make CFLAGS=-O2 and then run the program as follows: javac Hashtable.java ./jato -Xtrace:exceptions \ -bootclasspath .:/usr/local/classpath/share/classpath/glibj.zip \ -Djava.library.path=/usr/local/classpath/lib/classpath/ \ -Xnosystemclassloader Hashtable You will see the following crash: [main] trace exception: exception object 0x236c630 (java/lang/IllegalArgumentException) thrown [main] message : 0x0 null [main] from : 0x40fa8fc7: Hashtable.<init>(IF)V [main] (Hashtable.java:12) [main] action : unwind to 0x40fa8db1: Hashtable.main([Ljava/lang/String;)V [main] (Hashtable.java:20) [main] trace exception: exception object 0x236c630 (java/lang/IllegalArgumentException) thrown [main] message : 0x0 null [main] from : 0x40fa8db0: Hashtable.main([Ljava/lang/String;)V [main] (Hashtable.java:20) [main] action : unwind to native caller at 0x41e4b8 Exception in thread "main" java.lang.IllegalArgumentException at Hashtable.<init>(Hashtable.java:12) at Hashtable.main(Hashtable.java:20) Now while this doesn't seem to happen with the "-Os" GCC optimization level, it's by pure luck. Looking at the generated assembly, we see that XMM registers (which are *caller saved* registers on x86-64) are not saved before call instructions: [main] 0x41d7ff51: 48 89 e5 mov %rsp,%rbp [main] 0x41d7ff54: 48 83 ec 40 sub $0x40,%rsp [main] 0x41d7ff58: 53 push %rbx [main] 0x41d7ff59: 41 54 push %r12 [main] 0x41d7ff5b: 41 55 push %r13 [main] 0x41d7ff5d: 41 56 push %r14 [main] 0x41d7ff5f: 41 57 push %r15 [main] 0x41d7ff61: 57 push %rdi [main] 0x41d7ff62: 49 89 ff mov %rdi,%r15 [main] 0x41d7ff65: 49 89 f6 mov %rsi,%r14 [main] 0x41d7ff68: f3 0f 10 f8 movss %xmm0,%xmm7 [main] 0x41d7ff6c: 4d 89 fd mov %r15,%r13 [main] 0x41d7ff6f: 4d 85 6d 00 test %r13,0x0(%r13) [main] 0x41d7ff73: 4c 89 ef mov %r13,%rdi [main] 0x41d7ff76: f6 04 25 00 90 d3 00 00 testb $0x0,0xd39000 [main] 0x41d7ff7e: e8 bd cd ff ff callq 0x0000000041d7cd40 # java/lang/Object.<init>()V [main] 0x41d7ff83: 45 89 f6 mov %r14d,%r14d [main] 0x41d7ff86: 4c 89 f7 mov %r14,%rdi [main] 0x41d7ff89: e8 c2 51 6b be callq 0x0000000000435150 # array_size_check+0 (/home/penberg/jato/vm/object.c:494) which means that the any function that uses the XMM registers will clobber our registers. To fix the issue, use the following simple strategy suggested by "Linear Scan Register Allocation" by Poletto and Sarkar (1999): The simplest solution is to use all registers, and insert saves and restores where appropriate around function calls after register allocation. This fixes #25. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-27Convert README to markdownPekka Enberg2-145/+135
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-17vm: Introduce new vm_method_arg_stack_count() API functionPekka Enberg3-12/+19
Move the oddly named 'method_real_argument_count' to 'vm/method.c' and rename it to vm_method_arg_stack_count(). The API is useful for implementing alternative codegen backends. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-17test/unit: Remove more obsolete BC2IR test casesPekka Enberg11-2304/+1
The BC2IR test cases in test/unit were a good idea for bootstrapping Jato back in 2005. However, their usefulness has since decreased and in fact they have held back code cleanups because of the weird dependencies they introduce. So drop them for good. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-17jit: Move get_pure_expr() to jit/ostack-bc.cPekka Enberg2-14/+14
Remove a dependency from the more generic jit/expression.c to a BC2IR specific function that depends on dup_expr(). This makes it easier to remove obsolete BC2IR test cases. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-15vm: Kill "quick" JVM bytecode opcodesPekka Enberg2-28/+2
The "quick" JVM bytecode opcodes have never been used by Jato so drop them. They are there for historical reasons only when Jato was still a JIT compiler inside JamVM. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-15x86-64: Clean up emulate_op_64()Pekka Enberg1-3/+1
The 'edx' variable is always NULL on 64-bit so drop the extra branch. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14Makefile: Cleanup function test definitionsPekka Enberg1-83/+81
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14test/functional: Move ReferenceTest to `test/java/lang/ref` packagePekka Enberg3-4/+5
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14test/functional: Move UnsafeTest to `test/sun/misc` packagePekka Enberg4-258/+261
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14x86-32: Fix reg_default_type() for XMM registersPekka Enberg1-1/+7
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14x86-64: Fix XMM8-XMM15 register encoding for memlocalsPekka Enberg3-4/+32
This patch fixes XMM8-XMM15 register encoding for memlocals on x86-64. I noticed the problem while looking at assembly dumps for caller-save register saving and restoring. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14test/unit: Remove obsolete BC2IR testsPekka Enberg2-351/+0
In preparation for fixing clobbering issues in the register allocator, drop BC2IR test cases that will break. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14test/functional: Move JNITest to `test/java/lang`Pekka Enberg4-120/+120
The `java/lang` package is reserved for the JVM. Jato does not enforce this but HotSpot, for example, does which means we cannot run the same test set on it. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14test/functional: Merge java/lang/Class test casesPekka Enberg4-74/+61
There are two different test cases for java/lang/Class. Merge them to a single file. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14test/functional: Merge java/lang/reflect/Method test casesPekka Enberg4-134/+122
There are two different test cases for java/lang/reflect/Method. Merge them to a single file. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14tools/test: Fix 'Test FAILED' printoutPekka Enberg1-2/+2
Make sure we clear existing text for 'Test FAILED' printout so the output doesn't look like crap. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-08-14test/functional: Add test case for `java/util/HashMap`Pekka Enberg3-1/+21
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86: Move x86_call_disp() to <arch/isa.h>Pekka Enberg5-10/+10
This patch moves x86_call_disp() helper function to <arch/isa.h> and converts x86 architecture code to use it. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86: Simplify IC code wrt. return address and call-sitePekka Enberg1-5/+9
This patch simplifies the inline caching code by separating 'return addresses' from 'call-sites'. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-32: Remove unneeded cast to void pointerPekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86: Make internal IC functions staticPekka Enberg2-4/+2
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86: Clean up includes in arch/x86/inline-cache.cPekka Enberg1-9/+9
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-64: Fix int to pointer cast GCC warningsPekka Enberg1-4/+4
CC arch/x86/inline-cache.o arch/x86/inline-cache.c: In function ‘is_valid_ic’: arch/x86/inline-cache.c:47:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] arch/x86/inline-cache.c:49:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] arch/x86/inline-cache.c: In function ‘ic_set_to_monomorphic’: arch/x86/inline-cache.c:112:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] arch/x86/inline-cache.c:113:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] arch/x86/inline-cache.c:113:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] arch/x86/inline-cache.c: In function ‘ic_set_to_megamorphic’: arch/x86/inline-cache.c:131:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] arch/x86/inline-cache.c:132:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86: Use 32-bit types for inline cache call-sitePekka Enberg1-11/+11
Call instruction target offsets are 32-bit even on x86-64. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86: Move X86_CALL_DISP_OFFSET to <arch/isa.h>Pekka Enberg2-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-64: Fix numbering hole in 'enum machine_reg'Pekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-64: Fix formatting in registers_64.cPekka Enberg1-26/+26
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-64: Rename {save|restore}_regparm to {save|restore}_arg_regs()Pekka Enberg1-14/+14
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-64: Add 'arg_gp_regs' and 'arg_xmm_regs'Pekka Enberg3-30/+46
As a cleanup, introduce 'arg_gp_regs' and 'arg_xmm_regs' on x86-64 and use them. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-64: Drop '-fno-tree-vectorize' from MakefilePekka Enberg1-3/+1
Jato currently only works with the "-Os" GCC optimization level on x86-64. Furthermore, the problems exposed by "-ftree-vectorize" were due to Jato bugs so it's pointless to disable the optimization. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27jit: Make liveness tracing registers greppablePekka Enberg1-2/+2
Use the "r12" format for live intervals in liveness tracing to make searching the LIR and the machine register allocation table easier. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-64: Eliminate redundant EXPR_LOCAL_FLOAT reg -> reg storePekka Enberg1-6/+5
This patch eliminates a redundant register to register store from EXPR_LOCAL_FLOAT instruction selector rule. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27x86-64: Eliminate redundant EXPR_LOCAL reg -> reg storePekka Enberg1-6/+4
This patch eliminates a redundant register to register store from EXPR_LOCAL instruction selector rule. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27jit: Remove bogus NULL check in __update_live_ranges()Pekka Enberg1-2/+0
The get_fixed_var() function always returns a non-NULL 'struct var_info'. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27test/integration: Add LDC bytecode integration testsPekka Enberg1-4/+190
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-27test/unit: Remove unused but set variablePekka Enberg1-2/+1
CC spill-reload-test.o spill-reload-test.c: In function ‘test_empty_interval_is_never_spilled’: spill-reload-test.c:152:22: warning: variable ‘bb’ set but not used [-Wunused-but-set-variable] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-26tools: Add 'ecj-jato' wrapper for ECJ 3.7.2Pekka Enberg4-9/+8
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-26jit: Remove unused but set variablePekka Enberg1-4/+0
Fixes the following issue reported by GCC '-Wunused-but-set-variable': jit/bytecode-to-ir.c: In function ‘pick_and_propagate_temporaries’: jit/bytecode-to-ir.c:363:6: warning: variable ‘slot_ndx’ set but not used [-Wunused-but-set-variable] Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-09jit: Fix ->vm_type for EXPR_ARG expressionsPekka Enberg1-1/+1
This patch fixes ->vm_type for EXPR_ARG expressions. This fixes instruction selector rules on x86-64 that use it to distinguish between MOVSS and MOVSD for floats and doubles, respectively. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-09vm: Fix free_verifier_state()Johannes Laire1-1/+1
Signed-off-by: Johannes Laire <johannes@laire.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-09jit: Fix uninitialized variableJohannes Laire1-3/+1
Signed-off-by: Johannes Laire <johannes@laire.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-02test/functional: Enable passing test casesPekka Enberg1-14/+14
Commit 1421557 ("jit: Fix argument register clobbering") fixed bunch of failing functional tests. Enable them. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-02jit: Fix argument register clobberingPekka Enberg3-11/+61
This patch fixes a long-standing bug on x86-64 where arguments in register are clobbered. The problem is visible in ParameterPassingLivenessTest which passes with this patch applied. Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Cc: Tomek Grabiec <tgrabiec@gmail.com> Cc: Vegard Nossum <vegardno@ifi.uio.no> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-02vm: Specify 'java.runtime.name' system propertyPekka Enberg1-0/+1
This patch fixes a NPE during Jenkins startup. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-02Fix SIGSEGV if user passes invalid file to "-jar"Pekka Enberg1-2/+6
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-04-02x86: Remove unused register definitions from instruction.cPekka Enberg1-10/+0
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-03-14Add java.lang.Long.MAX_VALUE and java.lang.Long.MIN_VALUE checks to JNITestJoonas Reynders1-0/+8
Signed-off-by: Joonas Reynders <joonas.reynders@iki.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-03-02gc: Added a reference table.Nikhil1-0/+23
Signed-off-by: Nikhil Sarda <nikhilsarda.iitkgp@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-23TODO: add GDB proposalEduard - Gabriel Munteanu1-0/+22
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-18Documentation, internals: Core VMPekka Enberg1-12/+18
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-18runtime: Fix java/lang/reflect/Field.set() for base typesPekka Enberg2-1/+23
This fix unblocks Maven from starting up. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-18x86: Fix JNI function 64-bit return values on 32-bitPekka Enberg2-3/+11
This patch fixes edx clobbering issue with 64-bit JNI function return values. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17vm: Fix JVM defined system propertiesPekka Enberg2-5/+8
We advertise Java 1.6 version with "jato -version" but we also need to do that for JVM defined system properties. This fixes Jenkins early startup java.lang.UnsupportedClassVersionError exception. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17TODO: Add JIT preloading projectPekka Enberg1-0/+11
Suggested-by: Charles Oliver Nutter <headius@headius.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17Documentation, internals: More on JIT compiler internalsPekka Enberg1-21/+61
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17Documentation, internals: Add model of intermediate representationsPekka Enberg2-0/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17Documentation, internals: Reorganize sectionsPekka Enberg1-18/+23
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17Documentation, internals: Merge sections on intermediate representationsPekka Enberg1-22/+16
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17Documentation: Fix internals.txt syntaxPekka Enberg1-4/+6
This patch fixes AsciiDoc complaints for internals.txt and adds a table of contents to the document. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17Documentation: Merge jit-compiler-design.txt to internals.txtPekka Enberg2-51/+38
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-17TODO: Add some crazy projects to the listPekka Enberg1-0/+56
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16x86-64, test: Enable test cases that pass after multianewarray fixesPekka Enberg1-3/+3
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16x86-64: Fix multianewarray code generationPekka Enberg7-7/+21
This patch fixes multianewarray code generation on x86-64. Now that we already use proper varargs for vm_object_alloc_multi_array() the only thing remaining is making sure arguments are passed in correct registers and that we don't mess up the stack pointer after the call to vm_object_alloc_multi_array(). Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16x86, jit: Simplify multianewarray code generationPekka Enberg8-108/+14
This patch simplifies multianewarray code generation in preparation for fixing multianewarray on x86-64 and other architectures that pass arguments in registers. The main issue with the current code is that arguments passed to multiarray_size_check() and vm_object_alloc_multi_array() are shared which is fine on 32-bit x86 where arguments are on the stack. Unfortunately for x86-64 arguments are passed in registers and are thus clobbered by the multiarray_size_check() function. By dropping EXPR_MULTIARRAY_SIZE_CHECK, we avoid the issue completely which makes fixing multianewarray easier. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16Fix failing testMethodID testJoonas Reynders1-1/+1
Signed-off-by: Joonas Reynders <joonas.reynders@iki.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16x86: Use varargs for vm_object_alloc_multi_array()Pekka Enberg4-21/+32
In preparation for fixing multianewarray support on x86-64, convert vm_object_alloc_multi_array() to use varargs instead of passing a pointer to stack. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16TODO: Fix bibliography referencePekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16TODO: Add table of contentsPekka Enberg1-0/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16TODO: Add more projectsPekka Enberg1-0/+21
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16TODO: Add more projects to the listPekka Enberg1-13/+54
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16Remove quotes from the TODO listPekka Enberg1-16/+0
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-16TODO: Update ARM statusPekka Enberg1-3/+23
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-15Revert "x86-32: Fix stack pointer alignment with -Xdebug:stack"Pekka Enberg1-9/+6
This reverts commit 12c4f26ce3316e114e9b7949a2eee06954734d93. It breaks EntryTest when -Xdebug:stack is enabled.
2012-02-15x86-32: Make stack_frame_redzone_fail() staticPekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-15x86-32: Fix stack pointer alignment with -Xdebug:stackPekka Enberg1-6/+9
Fix same issues on 32-bit as commit 1dd46e3 ("x86-64: Fix stack pointer alignment with -Xdebug:stack") on 64-bit. This fixes wide-spread test breakage when -Xdebug:stack is enabled. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-15x86-64: Fix stack pointer alignment with -Xdebug:stackPekka Enberg1-0/+4
Running EntryTest on x86-64 with -Xdebug:stack crashes as follows: ./jato -Xdebug:stack -cp test/functional -bootclasspath test/functional:`./tools/classpath-config`/share/classpath/glibj.zip -Djava.library.path=`./tools/classpath-config`/lib/classpath/ -Xnosystemclassloader jvm/EntryTest [main] SIGSEGV at RIP 3de6406973 while accessing memory address 00000000. [main] Registers: [main] rsp: 00007fff9282db78 [main] rax: 0000000000000000 rbx: 0000000001be3090 rcx: 0000000000000020 [main] rdx: 000000000000016c rsi: 000000000000005b rdi: 0000000001be3090 [main] rbp: 00007fff9282dce8 r8: 000000000000000a r9: 0000000070000021 [main] r10: 000000006ffffdff r11: 0000000000000246 r12: 00007fff9282dda0 [main] r13: 000000006ffffeff r14: 00007fff9282dae0 r15: 00007fff9282da80 [main] Stack: [main] 000000000000002d 0000003de6847ffe 0000000000000001 0000000000000014 [main] 00007fff9282dbf8 000000000000002a 0000003de687447e 00007fff9282e200 [main] 00007f6a4844a000 00007f6a4844ad00 00007f6a48449c58 00007fff9282db78 [main] Code: 83 a8 02 00 00 0f 85 7b 05 00 00 48 89 df e8 55 3f 00 00 f6 45 10 08 0f 84 cb 00 00 00 f6 83 d4 03 00 00 20 48 8b 05 ed 8f 21 00 <66> 0f 6f 85 40 ff ff ff 48 0f 45 c3 48 83 3d 51 82 21 00 00 48 [main] Native and Java stack trace: [main] [<3de6406973>] native : signal_bh_trampoline+3de5fc030f (arch/x86/signal-bh.S:124) [main] [<3de6407e76>] native : signal_bh_trampoline+3de5fc1812 (arch/x86/signal-bh.S:124) Aborted The problem is that when we push a 8 byte canary on the stack, the stack pointer is no longer aligned to 16 bytes which is required for some SSE operations on 64-bit. This patch fixes the issue. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-14x86-64: Simplify constant argument code generationPekka Enberg1-53/+0
The specialized instruction selection rules are not needed for correctness because EXPR_VALUE and EXPR_FVALUE combined with EXPR_ARG deals with immediate arguments just fine. The immediate floating point rule is broken so drop bot specialized runes for now. We can reintroduce them later on if we can show there's a performance benefit in having them. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-14x86-64: Fix floating point EXPR_ARG code generationPekka Enberg1-8/+7
Use MOVSS and MOVSD instructions for float and double arguments, respectively, and reserve 8 bytes for each argument on stack regardless of the type. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-12arm: Use MAX_FRAME_SIZE_SUBTRACTED constantPekka Enberg1-1/+1
This patch replaces a magic number with the MAX_FRAME_SIZE_SUBTRACTED constant. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-12arm: Add missing arg_offset() function prototypePekka Enberg1-0/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-12arm: Convert encoding to use new helper macrosPekka Enberg1-52/+20
This cleans up instruction encoding bit-twiddling hacks. We also need to cleanup insn_encode() in the future. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-12arm: Add ARMv5 codegen helper macrosPekka Enberg1-0/+121
This patch adds ARMv5 codegen helper macros in preparation for cleaning up arch/arm/encode.c. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-12arm: Rename instruction encoding tablePekka Enberg1-15/+16
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-12arm: Rename emit_encoded_insn() to emit32()Pekka Enberg1-17/+17
Use shorter name that actually describes what the function does. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-09Add tests for function JNI_MethodIDJoonas Reynders2-0/+50
Signed-off-by: Joonas Reynders <joonas.reynders@iki.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-08x86, x86-64: restore the stack frame correctly when unwindingEduard - Gabriel Munteanu6-2/+32
In addition to space reserved for locals, unwinding has to account for callee-saved registers and other values saved on the stack. Both x86 and x86-64 were affected, the former since it adopted a few stack layout changes (standard prologs/epilogs and canaries), while the latter seems to have been affected for a long time. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-03x86-64: Fix return value tracing for -Xtrace:invoke-verbosePekka Enberg1-0/+4
This patch fixes return value tracing. Note that only integer return values are supported for now. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02x86: Enable GDB hooks on 32-bitPekka Enberg1-0/+4
This patch enables the GDB hooks on 32-bit x86 as well. See Documentation/debugging.txt for details how to set breakpoints in JIT'd code. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm: Fix 32-bit OP_ADD and OP_SUB instruction selectionPekka Enberg4-7/+22
Use 'add' and 'sub' instructions instead of 'adds' and 'subs' for 32-bit operations, respectively. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm, linux: Implement signal handling functionsPekka Enberg1-4/+11
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm, linux: Implement print_backtrace_and_die()Pekka Enberg2-4/+165
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm: Remove bogus function prototype from arch/encode.hPekka Enberg1-1/+0
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm: Simplify instruction selection rulesPekka Enberg1-83/+0
This patch simplifies instruction selection rules for binary operations that involve immediate values. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm, test: Simplify test_emit_uncond_branch_insn()Pekka Enberg1-3/+3
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm, test: Remove unused variable from encode-test.cPekka Enberg1-1/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm, test: Cleanup test cases to use common machine regsPekka Enberg1-10/+15
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02Merge /home/penberg/src/jatoPekka Enberg8-3/+20
2012-02-02x86: Add nop instruction supportPekka Enberg6-0/+11
This patch adds INSN_NOP support for x86 architecture. The instruction is useful for marking instruction selector rules for debugging purposes. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm: Fix unit test link errorPekka Enberg1-0/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02arm, ppc: Fix disassemble() function typePekka Enberg2-2/+2
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-02boehmgc: Pass -marm to make boehmgc build on thumb2 ARM systems.Xerxes Rånby1-0/+7
Signed-off-by: Xerxes Rånby <xerxes@zafena.se>
2012-02-01test, integration: Don't run dstore/fstore tests on ARMPekka Enberg1-3/+2
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-01arm: Fix unit test link errorPekka Enberg1-0/+1
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-01arm, ppc: Fix disassemble() function typePekka Enberg2-2/+2
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-02-01x86-32: Fix non-standard stack frame layoutPekka Enberg5-25/+8
This patch fixes the non-standard stack frame layout on 32-bit. Prolog is changed as follows: Before: [main] 0xa736b790: 57 push %edi [main] 0xa736b791: 56 push %esi [main] 0xa736b792: 53 push %ebx [main] 0xa736b793: 55 push %ebp [main] 0xa736b794: 89 e5 mov %esp,%ebp [main] 0xa736b796: 83 ec 10 sub $0x10,%esp After: [main] 0xa73db4a8: 55 push %ebp [main] 0xa73db4a9: 89 e5 mov %esp,%ebp [main] 0xa73db4ab: 83 ec 10 sub $0x10,%esp [main] 0xa73db4ae: 57 push %edi [main] 0xa73db4af: 56 push %esi [main] 0xa73db4b0: 53 push %ebx Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-30Add test for JNI function GetObjectClassJoonas Reynders2-0/+16
Signed-off-by: Joonas Reynders <joonas.reynders@iki.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-29Add implementation and tests for JNI function NewObjectVJoonas Reynders3-6/+80
Signed-off-by: Joonas Reynders <joonas.reynders@iki.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-28x86-64: get rid of __emit64_mov_imm_reg(), always use the 64-bit oneEduard - Gabriel Munteanu1-13/+7
We've been mistakenly using the 32-bit mov in a few cases, since it went by the name of __emit_mov_imm_reg(). This removes the 32-bit version altogether to avoid confusion. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-28x86-64: add stack redzoningEduard - Gabriel Munteanu1-0/+39
This places a canary value on the stack to check for corruption. Despite being called "redzoning", it has nothing to do with the x86-64 redzone as described in the ABI. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-28x86-64: use %rbp instead of %rsp to retrieve *this for lockingEduard - Gabriel Munteanu1-2/+6
Using %rsp to get *this seems fragile, we can look it up relative to %rbp if we know the frame size and the stack layout used by prologs. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-28tools/test.py: add option for checking skipped testsEduard - Gabriel Munteanu1-2/+11
It's useful to check whether additional tests pass following some changes. This adds the option '-s' to tools/test.py which runs only the unsupported tests and reports the ones which are passed, instead of failures. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-28jit: pass the frame size to emit_lock_this() and its counterpartEduard - Gabriel Munteanu6-17/+19
Let these emitters know the frame size in case we need to recover *this in a non-trivial way. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-28test/unit: ensure method_info is initializedEduard - Gabriel Munteanu4-0/+26
The uninitialized method_info proved problematic when tests failed. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-28jit: fix comment pertaining to invokesEduard - Gabriel Munteanu1-1/+1
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-22Refactor JNI NewObject test functions to accept argsJoonas Reynders2-17/+69
Signed-off-by: Joonas Reynders <joonas.reynders@iki.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-16x86-32: Make stack frame redzone failures debuggablePekka Enberg1-4/+5
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-16x86-32: Fix EXPR_LOOKUPSWITCH_BSEARCH generated codePekka Enberg1-0/+1
We need to cleanup stack after the call to bsearch() in generated code. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-16vm: Fix args count for static JNI methodsPekka Enberg2-5/+5
We pass reference to method class automatically for static JNI methods. However, we also need to clean them up on architectures that pass arguments on the stack. Before: [main] 0xa72f7997: bf 30 ac 53 0a mov $0xa53ac30,%edi [main] 0xa72f799c: 57 push %edi [main] 0xa72f799d: f6 04 25 00 f0 9f 09 00 testb $0x0,0x99ff000(,%eiz,1) [main] 0xa72f79a5: e8 f6 e0 ff ff call 0x00000000a72f5aa0 # gnu/java/nio/VMChannel.initIDs()V [main] 0xa72f79aa: 65 8b 3d ec b7 ff ff mov %gs:0xffffb7ec,%edi [main] 0xa72f79b1: 85 3f test %edi,(%edi) [main] 0xa72f79b3: e9 01 00 00 00 jmp 0x00000000a72f79b9 After: [main] 0xa735b997: bf 30 6c 45 0a mov $0xa456c30,%edi [main] 0xa735b99c: 57 push %edi [main] 0xa735b99d: f6 04 25 00 b0 91 09 00 testb $0x0,0x991b000(,%eiz,1) [main] 0xa735b9a5: e8 f6 e0 ff ff call 0x00000000a7359aa0 # gnu/java/nio/VMChannel.initIDs()V [main] 0xa735b9aa: 81 c4 04 00 00 00 add $0x4,%esp [main] 0xa735b9b0: 65 8b 3d ec b7 ff ff mov %gs:0xffffb7ec,%edi [main] 0xa735b9b7: 85 3f test %edi,(%edi) [main] 0xa735b9b9: e9 01 00 00 00 jmp 0x00000000a735b9bf This patch fixes one stack smashing bug detected by -Xdebug:stack command line option on 32-bit x86. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-16vm: Eliminate redundant assignmentPekka Enberg1-1/+0
The vm_method_do_init() function overwrites struct vm_method::args_count so there's absolutely no reason to assign it in vm_method_init_from_interface(). Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-15Add tests for JNI NewObject functions and fix missing checks for Interface ↵Joonas Reynders3-0/+53
and Abstract classes Signed-off-by: Joonas Reynders <joonas.reynders@iki.fi> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-15x86-32: Add stack smashing debuggingPekka Enberg5-5/+61
This patch introduces -Xdebug:stack command line option that enables JIT code stack smashing detection. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86: Fix cu_frame_locals_offset() frame size calculationPekka Enberg1-2/+1
Commit 02b74cf ("x86-32: Fix stack frame size in generated prolog") forgot to fix cu_frame_locals_offset(). Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86-32: Simplify __emit_insn()Pekka Enberg1-19/+7
Same as commit 0ab0e6f ("x86-64: Simplify __emit_insn()") but for 32-bit. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86-32: Remove forward declarations from emit_32.cPekka Enberg1-29/+22
Same as commit 8319a7f ("x86-64: Remove forward declarations from emit_64.c") but for 32-bit. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86-32: Remove 64-bit ifdefs from emit_32.cPekka Enberg1-1210/+0
Same as commit 27dcbf7 ("x86-64: Remove 32-bit ifdefs from emit_64.c") but for 32-bit. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86-64: Simplify __emit_insn()Pekka Enberg1-19/+7
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86-64: Remove forward declarations from emit_64.cPekka Enberg1-35/+26
Move code around so that we can drop forward declarations. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86-64: Remove 32-bit ifdefs from emit_64.cPekka Enberg1-822/+4
As a first step to cleaning up the file, remove 32-bit ifdefs. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86: Separate emit-code.c into 32-bit and 64-bit versionsPekka Enberg4-2/+2550
The arch/x86/emit-code.c file is a twisted maze these days. Split it into 32-bit and 64-bit versions so that we can clean it up. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86-64: Simplify prolog and epilog code generationPekka Enberg3-11/+36
Same as commit f3a677c ("x86-32: Simplify prolog and epilog code generation") but on x86-64. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14x86-32: Simplify prolog and epilog code generationPekka Enberg3-9/+35
This patch introduces a 'callee_save_regs' array and changes emit_prolog() and emit_epilog() to use it. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-14Adds missing handling and test for abstract classes to JNI AllocObjectJoonas Reynders2-1/+8
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-13test/functional: add ParameterPassingLivenessTestEduard - Gabriel Munteanu3-0/+44
Passing certain parameters results in nested calling sequences on x86-64, but this isn't handled correctly at the moment. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-13x86-64: disable GDB support for normal buildsEduard - Gabriel Munteanu2-2/+5
GDB doesn't give us sensible backtraces when building without debugging CFLAGS. Moreover, registering compiled methods with GDB could impact performance needlessly. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-13x86: Fix frame_local_offset() on 64-bitPekka Enberg1-1/+2
The ->args_count member of struct vm_method represents the total number of arguments. However, in frame_local_offset() we are interested in the number of arguments that are passed on the stack. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-13x86-64: Fix stack frame size in generated prologPekka Enberg1-5/+3
Same as commit 02b74cf ("x86-32: Fix stack frame size in generated prolog") but for 64-bit x86. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-13x86-32: Fix stack frame size in generated prologPekka Enberg1-3/+3
The frame_locals_size() function returns stack frame size in bytes so just use the returned value in emit_prolog(). This fixes unnecessary large stack frames on x86-32. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-13x86: Align stack pointer to 16 bytesPekka Enberg2-1/+7
SSE instructions that operate on the stack require stack pointer to be aligned to 16 bytes. This patch is needed to be able to fix too large stack frame sizes on x86. Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-11x86-32: Generate better code for static method trampolinesPekka Enberg1-4/+2
This patch removes a redundant push eax/pop eax pair from static method trampolines. Before: [main] # Trampoline: [main] 0xa739cab0: 55 push %ebp [main] 0xa739cab1: 89 e5 mov %esp,%ebp [main] 0xa739cab3: 68 40 16 b7 08 push $0x8b71640 [main] 0xa739cab8: e8 73 38 d0 60 call 0x00000000080a0330 # jit_magic_trampoline+0 (/home/penberg/src/jato/jit/trampoline.c:95) [main] [main] 0xa739cabd: 83 c4 04 add $0x4,%esp [main] 0xa739cac0: 65 8b 0d f0 b7 ff ff mov %gs:0xffffb7f0,%ecx [main] 0xa739cac7: 85 09 test %ecx,(%ecx) [main] 0xa739cac9: 50 push %eax [main] 0xa739caca: 58 pop %eax [main] 0xa739cacb: 5d pop %ebp [main] 0xa739cacc: ff e0 jmp *%eax After: [unknown] # Trampoline: [unknown] 0xa7399f80: 55 push %ebp [unknown] 0xa7399f81: 89 e5 mov %esp,%ebp [unknown] 0xa7399f83: 68 c0 d8 c2 08 push $0x8c2d8c0 [unknown] 0xa7399f88: e8 a3 63 d0 60 call 0x00000000080a0330 # jit_magic_trampoline+0 (/home/penberg/src/jato/jit/trampoline.c:95) [unknown] [unknown] 0xa7399f8d: 83 c4 04 add $0x4,%esp [unknown] 0xa7399f90: 65 8b 0d f0 b7 ff ff mov %gs:0xffffb7f0,%ecx [unknown] 0xa7399f97: 85 09 test %ecx,(%ecx) [unknown] 0xa7399f99: 5d pop %ebp [unknown] 0xa7399f9a: ff e0 jmp *%eax Signed-off-by: Pekka Enberg <penberg@kernel.org>
2012-01-11x86: Show function names in disassembly outputPekka Enberg5-9/+69
Signed-off-by: Pekka Enberg <penberg@kernel.org>