Mercurial > hg > release > icedtea7-forest-2.4 > hotspot
changeset 5057:78628ff1b2a8
ARM32 assembler update for hsx24. Use ARM32JIT to turn it on/off.
author | chrisphi |
---|---|
date | Tue, 18 Feb 2014 20:45:28 +0000 |
parents | 9600c7d61f8f |
children | 8e7b2661433e |
files | make/linux/makefiles/zeroshark.make src/cpu/zero/vm/asm_helper.cpp src/cpu/zero/vm/bytecodes_arm.def src/cpu/zero/vm/cppInterpreter_arm.S src/cpu/zero/vm/cppInterpreter_zero.cpp src/cpu/zero/vm/cppInterpreter_zero.hpp src/cpu/zero/vm/methodHandles_zero.hpp src/cpu/zero/vm/thumb2.cpp src/os_cpu/linux_zero/vm/os_linux_zero.cpp src/share/vm/prims/jvmtiExport.hpp |
diffstat | 10 files changed, 199 insertions(+), 81 deletions(-) [+] |
line wrap: on
line diff
--- a/make/linux/makefiles/zeroshark.make Fri Jan 31 21:14:06 2014 +0000 +++ b/make/linux/makefiles/zeroshark.make Tue Feb 18 20:45:28 2014 +0000 @@ -26,7 +26,8 @@ # Setup common to Zero (non-Shark) and Shark versions of VM ifeq ($(ZERO_LIBARCH),arm) - +# check to see if we are building the assembler jit or just zero. +ifeq ($(ARM32JIT),true) Obj_Files += asm_helper.o Obj_Files += cppInterpreter_arm.o Obj_Files += thumb2.o @@ -54,6 +55,7 @@ $(CXX_COMPILE) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE) endif +endif %.o: %.S @echo Assembling $<
--- a/src/cpu/zero/vm/asm_helper.cpp Fri Jan 31 21:14:06 2014 +0000 +++ b/src/cpu/zero/vm/asm_helper.cpp Tue Feb 18 20:45:28 2014 +0000 @@ -23,6 +23,10 @@ #define ARCH_VFP (1<<17) #define ARCH_CLZ (1<<18) +/* A workaround for private and protected fields */ +#define private public +#define protected public + #include "precompiled.hpp" #include "asm/assembler.hpp" #include "interp_masm_zero.hpp" @@ -33,8 +37,10 @@ #include "oops/methodDataOop.hpp" #include "oops/methodOop.hpp" #include "oops/oop.inline.hpp" +#include "oops/klassOop.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiThreadState.hpp" +#include "runtime/frame.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/sharedRuntime.hpp" @@ -43,6 +49,7 @@ #include "runtime/vframeArray.hpp" #include "utilities/debug.hpp" + #ifndef STATIC_OFFSETS #include <linux/auxvec.h> @@ -68,11 +75,22 @@ // particular method. #define NAME1 "sun.nio.ch.FileChannelImpl$Unmapper.run()V" #define EQ(S1, S2) (S1 && (strncmp(S1, S2, strlen(S2)) == 0)) -extern "C" void my_trace(void *jpc, void *istate) +extern "C" void my_trace(void *jpc, interpreterState istate) { - char *name = meth((interpreterState)istate); - if (EQ(name, NAME1)); - asm volatile("nop"); // Somewhere to put a breakpoint + JavaThread *jt = istate->thread(); + if (jt->zero_stack()->sp() && jt->top_zero_frame()) { + bool has_last_Java_frame = jt->has_last_Java_frame(); + if (!has_last_Java_frame) + jt->set_last_Java_frame(); + + StackFrameStream sfs(jt); + for(int i = 0; !sfs.is_done(); sfs.next(), i++) { + } + + // Reset the frame anchor if necessary + if (!has_last_Java_frame) + jt->reset_last_Java_frame(); + } } extern "C" unsigned hwcap(void) @@ -568,7 +586,7 @@ print_def("_thread_deopt_suspend", Thread::_deopt_suspend); nl(); print_def("METHOD_CONSTMETHOD", offset_of(methodOopDesc, _constMethod)); - print_def("METHOD_CONSTANTS", offset_of(methodOopDesc, _constants)); + print_def("METHOD_CONSTANTS", offset_of(constMethodOopDesc, _constants)); print_def("METHOD_METHODDATA", offset_of(methodOopDesc, _method_data)); print_def("METHOD_INVOKECOUNT", offset_of(methodOopDesc, _interpreter_invocation_count)); print_def("METHOD_ACCESSFLAGS", offset_of(methodOopDesc, _access_flags)); @@ -603,7 +621,7 @@ print_def("CONSTANTPOOL_CACHE", offset_of(constantPoolOopDesc, _cache)); print_def("CONSTANTPOOL_POOL_HOLDER", offset_of(constantPoolOopDesc, _pool_holder)); print_def("CONSTANTPOOL_BASE", sizeof(constantPoolOopDesc)); - print_def("CP_CACHE_VOLATILE_FIELD_FLAG_BIT", ConstantPoolCacheEntry::volatileField); + print_def("CP_CACHE_VOLATILE_FIELD_FLAG_BIT", ConstantPoolCacheEntry::is_volatile_shift); print_def("CP_CACHE_FLAGS", offset_of(ConstantPoolCacheEntry, _flags)); nl(); print_def("CP_OFFSET", in_bytes(constantPoolCacheOopDesc::base_offset())); @@ -704,10 +722,10 @@ print_def("class_fully_initialized", instanceKlass::fully_initialized); print_def("class_init_error", instanceKlass::initialization_error); nl(); - print_def("flag_methodInterface", 1 << ConstantPoolCacheEntry::methodInterface); - print_def("flag_volatileField", 1 << ConstantPoolCacheEntry::volatileField); - print_def("flag_vfinalMethod", 1 << ConstantPoolCacheEntry::vfinalMethod); - print_def("flag_finalField", 1 << ConstantPoolCacheEntry::finalField); + print_def("flag_methodInterface", 1 << ConstantPoolCacheEntry::has_method_type_shift); + print_def("flag_volatileField", 1 << ConstantPoolCacheEntry::is_volatile_shift); + print_def("flag_vfinalMethod", 1 << ConstantPoolCacheEntry::is_vfinal_shift); + print_def("flag_finalField", 1 << ConstantPoolCacheEntry::is_final_shift); nl(); print_def("INVOCATIONCOUNTER_COUNTINCREMENT", InvocationCounter::count_increment); nl(); @@ -722,6 +740,9 @@ print_def("VMSYMBOLS_IncompatibleClassChangeError", vmSymbols::java_lang_IncompatibleClassChangeError_enum); print_def("VMSYMBOLS_InternalError", vmSymbols::java_lang_InternalError_enum); + print_def("AbstractInterpreter_java_lang_math_sin", AbstractInterpreter::java_lang_math_sin); + print_def("AbstractInterpreter_number_of_method_entries", AbstractInterpreter::number_of_method_entries); + return 0; }
--- a/src/cpu/zero/vm/bytecodes_arm.def Fri Jan 31 21:14:06 2014 +0000 +++ b/src/cpu/zero/vm/bytecodes_arm.def Tue Feb 18 20:45:28 2014 +0000 @@ -1950,7 +1950,7 @@ str r3, [thread, #THREAD_LAST_JAVA_SP] ldr r0, [istate, #ISTATE_METHOD] ldr r3, [r2, #0] - ldrh r0, [r0, #40] + ldrh r0, [r0, #METHOD_MAXLOCALS] add r1, r2, #4 str r3, [thread, #THREAD_TOP_ZERO_FRAME] @@ -1981,7 +1981,7 @@ str r3, [thread, #THREAD_LAST_JAVA_SP] ldr r0, [istate, #ISTATE_METHOD] ldr r3, [stack, #0] - ldrh r0, [r0, #40] + ldrh r0, [r0, #METHOD_MAXLOCALS] str r3, [thread, #THREAD_TOP_ZERO_FRAME] str r1, [stack, r0, lsl #2]! @@ -2008,7 +2008,7 @@ str r3, [thread, #THREAD_LAST_JAVA_SP] ldr r0, [istate, #ISTATE_METHOD] ldr r3, [r2, #0] - ldrh r0, [r0, #40] + ldrh r0, [r0, #METHOD_MAXLOCALS] add r1, r2, #4 str r3, [thread, #THREAD_TOP_ZERO_FRAME] @@ -2032,7 +2032,8 @@ ldr r3, [istate, #ISTATE_METHOD] @ method ldrb lr, [jpc, #1] - ldr tmp1, [r3, #METHOD_CONSTANTS] @ constants + ldr tmp1, [r3, #METHOD_CONSTMETHOD] + ldr tmp1, [tmp1, #METHOD_CONSTANTS] @ constants DISPATCH_START \seq_len @@ -2086,7 +2087,8 @@ ldr r3, [istate, #ISTATE_METHOD] @ method ldrb ip, [jpc, #2] - ldr r2, [r3, #METHOD_CONSTANTS] @ constants + ldr r2, [r3, #METHOD_CONSTMETHOD] + ldr r2, [r2, #METHOD_CONSTANTS] @ constants DISPATCH_START \seq_len @@ -2141,7 +2143,8 @@ ldr tmp1, [istate, #ISTATE_METHOD] @ method ldrb lr, [jpc, #2] - ldr r2, [tmp1, #METHOD_CONSTANTS] @ constants + ldr r2, [tmp1, #METHOD_CONSTMETHOD] + ldr r2, [r2, #METHOD_CONSTANTS] @ constants DISPATCH_START \seq_len @@ -3993,7 +3996,7 @@ str r3, [thread, #THREAD_LAST_JAVA_SP] ldr r0, [istate, #ISTATE_METHOD] ldr r3, [stack, #0] - ldrh r0, [r0, #40] + ldrh r0, [r0, #METHOD_MAXLOCALS] str r3, [thread, #THREAD_TOP_ZERO_FRAME] str r1, [stack, r0, lsl #2]! @@ -4022,7 +4025,7 @@ str r3, [thread, #THREAD_LAST_JAVA_SP] ldr r0, [istate, #ISTATE_METHOD] ldr r3, [stack, #0] - ldrh r0, [r0, #40] + ldrh r0, [r0, #METHOD_MAXLOCALS] str r3, [thread, #THREAD_TOP_ZERO_FRAME] str r1, [stack, r0, lsl #2]! @@ -4429,7 +4432,7 @@ str r3, [thread, #THREAD_LAST_JAVA_SP] ldr r0, [istate, #ISTATE_METHOD] ldr r3, [stack, #0] - ldrh r0, [r0, #40] + ldrh r0, [r0, #METHOD_MAXLOCALS] str r3, [thread, #THREAD_TOP_ZERO_FRAME] str r1, [stack, r0, lsl #2]!
--- a/src/cpu/zero/vm/cppInterpreter_arm.S Fri Jan 31 21:14:06 2014 +0000 +++ b/src/cpu/zero/vm/cppInterpreter_arm.S Tue Feb 18 20:45:28 2014 +0000 @@ -367,7 +367,7 @@ flds s1, [stack, #4] add stack, #4 #else - POP r1 + POP r0 #endif .endm @@ -522,7 +522,7 @@ @ passes the current JPC as argument zero. It can be safely @ inserted at any point in the interpreter. .macro TRACE - stmfd sp!, {r0, r1, r2, r3, r4, lr, ip} + stmfd sp!, {r0, r1, r2, r3, r4, ip, lr} mrs r4, cpsr mov r0, jpc ldr r1, [thread, #THREAD_TOP_ZERO_FRAME] @@ -530,7 +530,7 @@ ldr r2, =my_trace blx r2 msr cpsr, r4 - ldmfd sp!, {r0, r1, r2, r3, r4, lr, ip} + ldmfd sp!, {r0, r1, r2, r3, r4, ip, lr} .endm .macro DISPATCH_FINISH @@ -551,6 +551,7 @@ .elseif dispatch_state == 4 DISPATCH_4 .endif + TRACE moveq pc, ip ldrb r1, [jpc, lr] bic ip, ip, #7 @@ -560,6 +561,7 @@ .endm .macro DISPATCH_BYTECODE + TRACE @ ldrb r1, [jpc, #2] ldr ip, [dispatch, r0, lsl #2] ldrb r2, [jpc, #1] @@ -755,7 +757,8 @@ ldreq r4, [r1, #METHOD_CONSTMETHOD] addeq r4, r4, #CONSTMETHOD_CODEOFFSET str r4, [ip, #4] - ldr r4, [r1, #METHOD_CONSTANTS] + ldr r4, [r1, #METHOD_CONSTMETHOD] + ldr r4, [r4, #METHOD_CONSTANTS] ldr r4, [r4, #CONSTANTPOOL_CACHE] str r8, [ip, #28] str r2, [ip, #32] @@ -771,8 +774,9 @@ sub r7, r2, r7, asl #2 str r7, [r3, #8] ldr r2, [r1, #METHOD_ACCESSFLAGS] + ldr r4, [r1, #METHOD_CONSTMETHOD] tst r2, #JVM_ACC_STATIC - ldrne r2, [r1, #METHOD_CONSTANTS] + ldrne r2, [r4, #METHOD_CONSTANTS] ldreq r2, [r6, #0] ldrne r2, [r2, #CONSTANTPOOL_POOL_HOLDER] ldrne r2, [r2, #KLASS_PART + KLASS_JAVA_MIRROR] @@ -797,6 +801,9 @@ .global asm_generate_method_entry .type asm_generate_method_entry, %function asm_generate_method_entry: + mov r3, #AbstractInterpreter_number_of_method_entries + cmp r3, #((3f-2f)/4) // i.e. sizeof asm_method_table + bne vm_fatal_error mov r3, r0 mov r0, #0 #ifdef PRODUCT @@ -819,7 +826,7 @@ cmp r2, #0 bne 1f - cmp r3, #((3f-2f)/4) // i.e. sizeof asm_method_table + cmp r3, #AbstractInterpreter_number_of_method_entries adrcc ip, asm_method_table ldrcc r0, [ip, r3, lsl #2] #endif // PRODUCT @@ -838,7 +845,7 @@ .word empty_entry // empty method (code: _return) .word accessor_entry // accessor method (code: _aload_0, _getfield, _(a|i)return) .word normal_entry // abstract method (throws an AbstractMethodException) - .word method_handle_entry // java.lang.invoke.MethodHandles::invoke + .org (AbstractInterpreter_java_lang_math_sin*4)+asm_method_table .word normal_entry // implementation of java.lang.Math.sin (x) .word normal_entry // implementation of java.lang.Math.cos (x) .word normal_entry // implementation of java.lang.Math.tan (x) @@ -846,6 +853,8 @@ .word normal_entry // implementation of java.lang.Math.sqrt (x) .word normal_entry // implementation of java.lang.Math.log (x) .word normal_entry // implementation of java.lang.Math.log10 (x) + .word normal_entry // implementation of java.lang.Math.pow (x) + .word normal_entry // implementation of java.lang.Math.exp (x) .word accessor_entry // implementation of java.lang.ref.Reference.get() 3: @@ -1053,10 +1062,10 @@ str r5, [r9, #ISTATE_STACK_LIMIT] str r9, [r9, #ISTATE_STACK_BASE] str r0, [r9, #ISTATE_OOP_TEMP] - str r0, [r9, #ISTATE_MSG] - ldr ip, [r11, #METHOD_CONSTANTS] + ldr ip, [r11, #METHOD_CONSTMETHOD] + ldr ip, [ip, #METHOD_CONSTANTS] sub r7, r4, #4 mov r5, #0 add r7, r7, r1, lsl #2 @@ -1152,8 +1161,8 @@ add r1, r1, #4 tst r2, #JVM_ACC_STATIC beq .do_fast_copy_args - - ldr r2, [r11, #METHOD_CONSTANTS] + ldr r2, [r11, #METHOD_CONSTMETHOD] + ldr r2, [r2, #METHOD_CONSTANTS] ldr r2, [r2, #CONSTANTPOOL_POOL_HOLDER] str r3, [lr], #4 ldr r2, [r2, #KLASS_PART + KLASS_JAVA_MIRROR] @@ -2275,7 +2284,9 @@ orr r2, r2, r0, asl #8 DECACHE_JPC DECACHE_STACK - ldr r1, [lr, #METHOD_CONSTANTS] + + ldr r1, [lr, #METHOD_CONSTMETHOD] + ldr r1, [r1, #METHOD_CONSTANTS] mov r0, thread bl _ZN18InterpreterRuntime9anewarrayEP10JavaThreadP19constantPoolOopDescii ldr ip, [thread, #THREAD_PENDING_EXC] @@ -2710,8 +2721,9 @@ @ Do Synchronisation CACHE_STACK CACHE_LOCALS + ldr r2, [r0, #METHOD_CONSTMETHOD] tst r3, #JVM_ACC_STATIC - ldrne r3, [r0, #METHOD_CONSTANTS] + ldrne r3, [r2, #METHOD_CONSTANTS] ldreq tmp1, [locals, #0] ldrne r2, [r3, #CONSTANTPOOL_POOL_HOLDER] ldrne tmp1, [r2, #KLASS_PART+KLASS_JAVA_MIRROR] @@ -3270,6 +3282,7 @@ FAST_ENTRY fast_normal_entry: +@ TRACE adrl ip, dispatch_init_adcon mov tmp1, r0 ldm ip, {r0, r1} @@ -3320,7 +3333,7 @@ add locals, locals, r0, lsl #2 sub stack, istate, #4 ldr jpc, [tmp1, #METHOD_CONSTMETHOD] - ldr constpool, [tmp1, #METHOD_CONSTANTS] + ldr constpool, [jpc, #METHOD_CONSTANTS] add ip, istate, #ISTATE_NEXT_FRAME DISPATCH_START CONSTMETHOD_CODEOFFSET ldr constpool, [constpool, #CONSTANTPOOL_CACHE] @@ -3431,7 +3444,7 @@ str r3, [thread, #THREAD_LAST_JAVA_FP] ldr r0, [istate, #ISTATE_METHOD] ldr r3, [r2, #0] - ldrh r0, [r0, #40] + ldrh r0, [r0, #METHOD_MAXLOCALS] add r1, r2, #4 str r3, [thread, #THREAD_TOP_ZERO_FRAME] @@ -3560,7 +3573,7 @@ str r3, [thread, #THREAD_LAST_JAVA_SP] ldr r0, [istate, #ISTATE_METHOD] ldr r3, [r2, #0] - ldrh r0, [r0, #40] + ldrh r0, [r0, #METHOD_MAXLOCALS] add r1, r2, #4 str r3, [thread, #THREAD_TOP_ZERO_FRAME] @@ -3660,8 +3673,9 @@ ldr r1, [r0, #METHOD_CONSTMETHOD] ldrb r3, [r1, #CONSTMETHOD_CODEOFFSET+2] + + ldr ip, [r1, #METHOD_CONSTANTS] ldrb r1, [r1, #CONSTMETHOD_CODEOFFSET+3] - ldr ip, [r0, #METHOD_CONSTANTS] ldr ip, [ip, #CONSTANTPOOL_CACHE] orr r3, r3, r1, lsl #8 @ r3 = index
--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp Fri Jan 31 21:14:06 2014 +0000 +++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp Tue Feb 18 20:45:28 2014 +0000 @@ -36,6 +36,7 @@ #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiThreadState.hpp" +#include "prims/methodHandles.hpp" #include "runtime/arguments.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" @@ -65,6 +66,14 @@ CALL_VM_NOCHECK_NOFIX(func) \ fixup_after_potential_safepoint() +//#define CPPIDEBUG 1 +#ifdef CPPIDEBUG +#define CPPINT_DEBUG( Z_code_ ) Z_code_ +CPPINT_DEBUG ( static const char *FFng_Zero_Flag = "CPPINT_DEBUG_ON\n"; ) +#else +#define CPPINT_DEBUG( Z_code_ ) +#endif + int CppInterpreter::normal_entry(methodOop method, intptr_t UNUSED, TRAPS) { JavaThread *thread = (JavaThread *) THREAD; @@ -610,6 +619,25 @@ return 0; } +int CppInterpreter::method_handle_entry(methodOop method, + intptr_t UNUSED, TRAPS) { + JavaThread *thread = (JavaThread *) THREAD; + ZeroStack *stack = thread->zero_stack(); + CPPINT_DEBUG( tty->print_cr( "method_handle : 0x%x , thread: 0x%x , stack: %0x%x.", \ + method, thread, stack ); ) + + return MethodHandles::method_handle_entry_invokeBasic(method, UNUSED, THREAD); +} + +void CppInterpreter::process_method_handle(oop method_handle, TRAPS) { + JavaThread *thread = (JavaThread *) THREAD; + ZeroStack *stack = thread->zero_stack(); + CPPINT_DEBUG( tty->print_cr( "process_method_handle : 0x%x , thread: 0x%x , stack: %0x%x.", \ + method_handle, thread, stack ); ) + methodOop method = (methodOop) java_lang_invoke_MemberName::vmtarget(method_handle); + MethodHandles::invoke_target(method, THREAD); +} + // The new slots will be inserted before slot insert_before. // Slots < insert_before will have the same slot number after the insert. // Slots >= insert_before will become old_slot + num_slots. @@ -831,10 +859,19 @@ AbstractInterpreter::MethodKind kind) { address entry_point = NULL; + CPPINT_DEBUG( tty->print_cr( "generate_method_entry : kind 0x%x ", \ + kind ); ) + #ifdef HOTSPOT_ASM address asm_entry = asm_generate_method_entry(kind); - if (asm_entry) - return ((InterpreterGenerator*) this)->generate_entry(asm_entry); + if (asm_entry) { + CPPINT_DEBUG( tty->print_cr( "asm_generate_method_entry : kind 0x%x asm_entry: 0x%x ", \ + kind, asm_entry ); ) + entry_point = ((InterpreterGenerator*) this)->generate_entry(asm_entry); + CPPINT_DEBUG( tty->print_cr( "asm_generate_method_entry return : kind 0x%x entry_point : 0x%x ", \ + kind, entry_point ); ) + return(entry_point); + } #endif // HOTSPOT_ASM switch (kind) { @@ -1061,3 +1098,4 @@ } #endif // CC_INTERP +
--- a/src/cpu/zero/vm/cppInterpreter_zero.hpp Fri Jan 31 21:14:06 2014 +0000 +++ b/src/cpu/zero/vm/cppInterpreter_zero.hpp Tue Feb 18 20:45:28 2014 +0000 @@ -36,6 +36,8 @@ static int native_entry(methodOop method, intptr_t UNUSED, TRAPS); static int accessor_entry(methodOop method, intptr_t UNUSED, TRAPS); static int empty_entry(methodOop method, intptr_t UNUSED, TRAPS); + static int method_handle_entry(methodOop method, intptr_t UNUSED, TRAPS); + static void process_method_handle(oop method_handle, TRAPS); public: // Main loop of normal_entry
--- a/src/cpu/zero/vm/methodHandles_zero.hpp Fri Jan 31 21:14:06 2014 +0000 +++ b/src/cpu/zero/vm/methodHandles_zero.hpp Tue Feb 18 20:45:28 2014 +0000 @@ -29,10 +29,12 @@ adapter_code_size = sizeof(ZeroEntry) * (Interpreter::method_handle_invoke_LAST - Interpreter::method_handle_invoke_FIRST + 1) }; +public: + static int method_handle_entry_invokeBasic(methodOop method, intptr_t UNUSED, TRAPS); + static void invoke_target(methodOop method, TRAPS); + private: static oop popFromStack(TRAPS); - static void invoke_target(methodOop method, TRAPS); - static int method_handle_entry_invokeBasic(methodOop method, intptr_t UNUSED, TRAPS); static int method_handle_entry_linkToStaticOrSpecial(methodOop method, intptr_t UNUSED, TRAPS); static int method_handle_entry_linkToVirtual(methodOop method, intptr_t UNUSED, TRAPS); static int method_handle_entry_linkToInterface(methodOop method, intptr_t UNUSED, TRAPS);
--- a/src/cpu/zero/vm/thumb2.cpp Fri Jan 31 21:14:06 2014 +0000 +++ b/src/cpu/zero/vm/thumb2.cpp Tue Feb 18 20:45:28 2014 +0000 @@ -430,13 +430,15 @@ #ifdef PRODUCT -#define JASSERT(cond, msg) 0 +#define JASSERT(cond, msg) #define J_Unimplemented() longjmp(compiler_error_env, COMPILER_RESULT_FATAL) +#define JDEBUG_( _j_ ) #else #define JASSERT(cond, msg) do { if (!(cond)) fatal(msg); } while (0) #define J_Unimplemented() { report_unimplemented(__FILE__, __LINE__); BREAKPOINT; } +#define JDEBUG_( _j_ ) _j_ #endif // PRODUCT @@ -1320,6 +1322,10 @@ jubyte *code_base = jinfo->code_base; unsigned *bc_stackinfo = jinfo->bc_stackinfo; unsigned *locals_info = jinfo->locals_info; + JDEBUG_ ( + Symbol *name = jinfo->method->name(); + Symbol *sig = jinfo->method->signature(); + ); //constantPoolCacheOop cp = jinfo->method->constants()->cache(); bc_stackinfo[bci] |= BC_BRANCH_TARGET; @@ -1530,11 +1536,11 @@ int site_index = GET_NATIVE_U4(code_base+bci+1); constantPoolOop pool = jinfo->method->constants(); int main_index = pool->cache()->secondary_entry_at(site_index)->main_entry_index(); - // int pool_index = pool->cache()->entry_at(main_index)->constant_pool_index(); + JDEBUG_( int pool_index = pool->cache()->entry_at(main_index)->constant_pool_index(); ); Symbol *sig = pool->signature_ref_at(main_index); const jbyte *base = sig->base(); - //tty->print("%d: %s: %s\n", opcode, name->as_C_string(), sig->as_C_string()); + JDEBUG_( tty->print("InvokeDynamic %d: %s: %s %d %d\n", opcode, name->as_C_string(), sig->as_C_string(), main_index, pool_index); ); stackdepth += method_stackchange(base); opcode = code_base[bci]; bci += 5; @@ -1555,13 +1561,15 @@ const jbyte *base = sig->base(); jinfo->is_leaf = 0; - //tty->print("%d: %s: %s\n", opcode, name->as_C_string(), sig->as_C_string()); + JDEBUG_( tty->print("%d: %s: %s\n", opcode, name->as_C_string(), sig->as_C_string()); ); stackdepth += method_stackchange(base); opcode = code_base[bci]; bci += 3; if (opcode == opc_invokeinterface) bci += 2; if (opcode != opc_invokestatic && opcode != opc_invokestaticresolved) stackdepth -= 1; + JDEBUG_( tty->print("invoke %d: %s: %s %d %d %d\n", opcode, name->as_C_string(), sig->as_C_string(), + bci, index, stackdepth); ); break; } @@ -4571,7 +4579,7 @@ if (!cache->is_resolved((Bytecodes::Code)opc_getfield)) return 0; TosState tos_type = cache->flag_state(); - int field_offset = cache->f2(); + int field_offset = cache->f2_as_index(); // Slow entry point - callee save // R0 = method @@ -4677,7 +4685,8 @@ } } - ldr_imm(jinfo->codebuf, ARM_IP, ARM_R0, METHOD_CONSTANTS, 1, 0); + ldr_imm(jinfo->codebuf, ARM_IP, ARM_R0, METHOD_CONSTMETHOD, 1, 0); + ldr_imm(jinfo->codebuf, ARM_IP, ARM_IP, METHOD_CONSTANTS, 1, 0); add_imm(jinfo->codebuf, Rlocals, Rstack, (jinfo->method->max_locals()-1) * sizeof(int)); @@ -5079,6 +5088,10 @@ void Thumb2_codegen(Thumb2_Info *jinfo, unsigned start) { + JDEBUG_ ( + Symbol *name = jinfo->method->name(); + Symbol *sig = jinfo->method->signature(); + ); unsigned code_size = jinfo->code_size; jubyte *code_base = jinfo->code_base; unsigned *bc_stackinfo = jinfo->bc_stackinfo; @@ -5293,6 +5306,7 @@ r = JSTACK_REG(jstack); PUSH(jstack, r); load_istate(jinfo, r, ISTATE_METHOD, stackdepth+1); + ldr_imm(jinfo->codebuf, r, r, METHOD_CONSTMETHOD, 1, 0); ldr_imm(jinfo->codebuf, r, r, METHOD_CONSTANTS, 1, 0); ldr_imm(jinfo->codebuf, r, r, CONSTANTPOOL_BASE + (index << 2), 1, 0); if (v == JVM_CONSTANT_Class) @@ -5886,7 +5900,7 @@ } TosState tos_type = cache->flag_state(); - int field_offset = cache->f2(); + int field_offset = cache->f2_as_index(); if (tos_type == ltos || tos_type == dtos) { Reg r_lo, r_hi; @@ -5949,7 +5963,8 @@ } TosState tos_type = cache->flag_state(); - int field_offset = cache->f2(); + int field_offset = cache->f2_as_index(); + JDEBUG_( tty->print("f2_as_index getstatic %d: %s: %s %d\n", index , name->as_C_string(), sig->as_C_string(), field_offset); ); if (tos_type == ltos || tos_type == dtos) { Reg r_lo, r_hi, r_addr; @@ -6018,7 +6033,7 @@ storeBarrier(jinfo->codebuf); TosState tos_type = cache->flag_state(); - int field_offset = cache->f2(); + int field_offset = cache->f2_as_index(); if (tos_type == ltos || tos_type == dtos) { Reg r_lo, r_hi; @@ -6083,7 +6098,7 @@ storeBarrier(jinfo->codebuf); TosState tos_type = cache->flag_state(); - int field_offset = cache->f2(); + int field_offset = cache->f2_as_index(); Reg r_obj; if (tos_type == ltos || tos_type == dtos) { @@ -6163,7 +6178,7 @@ break; } - callee = opcode == opc_invokevirtual ? (methodOop)cache->f2() : (methodOop)cache->f1(); + callee = opcode == opc_invokevirtual ? (methodOop)cache->f2_as_index() : (methodOop)cache->f1_as_instance(); if (opcode != opc_invokevirtual || cache->is_vfinal()) { if (handle_special_method(callee, jinfo, stackdepth)) @@ -6181,7 +6196,7 @@ JASSERT(cache->parameter_size() == 1, "not 1 parameter to accessor"); TosState tos_type = entry->flag_state(); - int field_offset = entry->f2(); + int field_offset = entry->f2_as_index(); JASSERT(tos_type == btos || tos_type == ctos || tos_type == stos || tos_type == atos || tos_type == itos, "not itos or atos"); @@ -6228,7 +6243,7 @@ ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, CP_OFFSET + (index << 4) + (opcode == opc_invokevirtual ? 8 : 4), 1, 0); else - ldr_imm(jinfo->codebuf, ARM_R0, ARM_R3, INSTANCEKLASS_VTABLE_OFFSET + cache->f2() * 4, 1, 0); + ldr_imm(jinfo->codebuf, ARM_R0, ARM_R3, INSTANCEKLASS_VTABLE_OFFSET + cache->f2_as_index() * 4, 1, 0); add_imm(jinfo->codebuf, ARM_R2, ARM_R2, bci+CONSTMETHOD_CODEOFFSET); str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0); str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_FP, 1, 0); @@ -6298,7 +6313,7 @@ int r = JSTACK_REG(jstack); PUSH(jstack, r); ldr_imm(jinfo->codebuf, r, Ristate, ISTATE_CONSTANTS, 1, 0); - ldr_imm(jinfo->codebuf, r, r, CP_OFFSET + (index << 4) + 4, 1, 0); // offset to cache->f1() + ldr_imm(jinfo->codebuf, r, r, CP_OFFSET + (index << 4) + 4, 1, 0); // offset to cache->f1_as_instance() } else { Thumb2_Exit(jinfo, H_EXIT_TO_INTERPRETER, bci, stackdepth); } @@ -6823,9 +6838,9 @@ extern "C" int Thumb2_lr_to_bci(unsigned lr, methodOop method, Reg *regs, unsigned *locals) { Compiled_Method *cmethod = compiled_method_list; - typeArrayOop table = method->exception_table(); + ExceptionTable table(method); constantPoolOop pool = method->constants(); - int length = table->length(); + int length = table.length(); while (cmethod) { unsigned *exception_table = cmethod->exception_table; @@ -6835,7 +6850,7 @@ int exception_index = -1; unsigned exception_found = 0; - for (int i = 0; i < length; i += ENTRY_SIZE) { + for (int i = 0; i < length; i++) { unsigned offsets = *exception_table++; unsigned exc_beg = code_base + ((offsets >> 16) << 1); unsigned exc_end = code_base + ((offsets & 0xffff) << 1); @@ -6856,7 +6871,7 @@ } } } - return table->int_at(exception_index + BEG_BCI_OFFSET); + return table.start_pc(exception_index); } } } @@ -6869,15 +6884,15 @@ void Thumb2_generate_exception_table(Compiled_Method *cmethod, Thumb2_Info *jinfo) { methodOop method = jinfo->method; - typeArrayOop table = method->exception_table(); + ExceptionTable table(method); constantPoolOop pool = method->constants(); - int length = table->length(); + int length = table.length(); unsigned *bc_stackinfo = jinfo->bc_stackinfo; cmethod->exception_table = (unsigned *)out_pos(jinfo->codebuf); - for (int i = 0; i < length; i += ENTRY_SIZE) { - int beg_bci = table->int_at(i + BEG_BCI_OFFSET); - int end_bci = table->int_at(i + END_BCI_OFFSET); + for (int i = 0; i < length; i++) { + int beg_bci = table.start_pc(i); + int end_bci = table.end_pc(i); unsigned stackinfo; unsigned beg_offset, end_offset; @@ -6962,9 +6977,26 @@ return 0; } +extern "C" void Debug_Stack(intptr_t *stack) +{ + int i; + char msg[16]; + + tty->print(" Stack:"); + for (i = 0; i < 6; i++) { + tty->print(" ["); + sprintf(msg, "%d", i); + tty->print(msg); + tty->print("] = "); + sprintf(msg, "%08x", (int)stack[i]); + tty->print(msg); + } + tty->cr(); +} + extern "C" void Debug_MethodEntry(interpreterState istate, intptr_t *stack, methodOop callee) { -#if 0 + JDEBUG_( if (DebugSwitch) { methodOop method = istate->method(); tty->print("Entering "); @@ -6975,12 +7007,12 @@ Debug_Stack(stack); tty->flush(); } -#endif + ) } extern "C" void Debug_MethodExit(interpreterState istate, intptr_t *stack) { -#if 0 + JDEBUG_( if (DebugSwitch) { methodOop method = istate->method(); JavaThread *thread = istate->thread(); @@ -6994,12 +7026,12 @@ tty->flush(); if (exc) tty->print_cr("Exception %s", exc->print_value_string()); } -#endif +) } extern "C" void Debug_MethodCall(interpreterState istate, intptr_t *stack, methodOop callee) { -#if 0 + JDEBUG_( if (DebugSwitch) { methodOop method = istate->method(); tty->print("Calling "); @@ -7010,7 +7042,7 @@ Debug_Stack(stack); tty->flush(); } -#endif + ) } extern "C" void Thumb2_Install(methodOop mh, u32 entry); @@ -7681,6 +7713,7 @@ str_imm(&codebuf, ARM_R1, ARM_IP, ISTATE_STACK-ISTATE_NEXT_FRAME, 1, 0); ldr_imm(&codebuf, ARM_R1, ARM_IP, ISTATE_METHOD-ISTATE_NEXT_FRAME, 1, 0); + ldr_imm(&codebuf, ARM_R1, ARM_R1, METHOD_CONSTMETHOD, 1, 0); ldr_imm(&codebuf, ARM_R1, ARM_R1, METHOD_CONSTANTS, 1, 0); mov_imm(&codebuf, ARM_IP, (u32)_ZN18InterpreterRuntime9anewarrayEP10JavaThreadP19constantPoolOopDescii); mov_reg(&codebuf, ARM_R0, Rthread);
--- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Fri Jan 31 21:14:06 2014 +0000 +++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Tue Feb 18 20:45:28 2014 +0000 @@ -53,6 +53,12 @@ #include "thread_linux.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" +#ifdef COMPILER1 +#include "c1/c1_Runtime1.hpp" +#endif +#ifdef COMPILER2 +#include "opto/runtime.hpp" +#endif address os::current_stack_pointer() { address dummy = (address) &dummy; @@ -448,6 +454,7 @@ value = *adr; return value; } + intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) { intptr_t value = errValue; value = *adr; @@ -533,8 +540,3 @@ } }; #endif // !_LP64 - -#ifndef PRODUCT -void os::verify_stack_alignment() { -} -#endif
--- a/src/share/vm/prims/jvmtiExport.hpp Fri Jan 31 21:14:06 2014 +0000 +++ b/src/share/vm/prims/jvmtiExport.hpp Tue Feb 18 20:45:28 2014 +0000 @@ -134,6 +134,13 @@ // internal implementation. Also called from JvmtiDeferredEvent::post() static void post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end); +#ifdef __arm__ + static void post_compiled_method_load(const methodOop method, const jint length, + const void *code_begin, const jint map_length, + const jvmtiAddrLocationMap* map, + const void *compile_info); +#endif // __arm__ + private: // GenerateEvents support to allow posting of CompiledMethodLoad and @@ -281,12 +288,6 @@ jint *cached_length_ptr); static void post_native_method_bind(methodOop method, address* function_ptr); static void post_compiled_method_load(nmethod *nm); -#ifdef __arm__ - static void post_compiled_method_load(const methodOop method, const jint length, - const void *code_begin, const jint map_length, - const jvmtiAddrLocationMap* map, - const void *compile_info) KERNEL_RETURN; -#endif // __arm__ static void post_dynamic_code_generated(const char *name, const void *code_begin, const void *code_end); // used to post a CompiledMethodUnload event