Wed, 06 Jan 2010 22:21:39 -0800
Merge
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/SystemDictionary.java Wed Dec 23 03:12:16 2009 -0800 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/SystemDictionary.java Wed Jan 06 22:21:39 2010 -0800 1.3 @@ -63,12 +63,12 @@ 1.4 javaSystemLoaderField = type.getOopField("_java_system_loader"); 1.5 nofBuckets = db.lookupIntConstant("SystemDictionary::_nof_buckets").intValue(); 1.6 1.7 - objectKlassField = type.getOopField(WK_KLASS("object_klass")); 1.8 - classLoaderKlassField = type.getOopField(WK_KLASS("classloader_klass")); 1.9 - stringKlassField = type.getOopField(WK_KLASS("string_klass")); 1.10 - systemKlassField = type.getOopField(WK_KLASS("system_klass")); 1.11 - threadKlassField = type.getOopField(WK_KLASS("thread_klass")); 1.12 - threadGroupKlassField = type.getOopField(WK_KLASS("threadGroup_klass")); 1.13 + objectKlassField = type.getOopField(WK_KLASS("Object_klass")); 1.14 + classLoaderKlassField = type.getOopField(WK_KLASS("ClassLoader_klass")); 1.15 + stringKlassField = type.getOopField(WK_KLASS("String_klass")); 1.16 + systemKlassField = type.getOopField(WK_KLASS("System_klass")); 1.17 + threadKlassField = type.getOopField(WK_KLASS("Thread_klass")); 1.18 + threadGroupKlassField = type.getOopField(WK_KLASS("ThreadGroup_klass")); 1.19 } 1.20 1.21 // This WK functions must follow the definitions in systemDictionary.hpp:
2.1 --- a/src/cpu/sparc/vm/sparc.ad Wed Dec 23 03:12:16 2009 -0800 2.2 +++ b/src/cpu/sparc/vm/sparc.ad Wed Jan 06 22:21:39 2010 -0800 2.3 @@ -1885,6 +1885,10 @@ 2.4 return RegMask(); 2.5 } 2.6 2.7 +const RegMask Matcher::method_handle_invoke_SP_save_mask() { 2.8 + return RegMask(); 2.9 +} 2.10 + 2.11 %} 2.12 2.13
3.1 --- a/src/cpu/x86/vm/frame_x86.cpp Wed Dec 23 03:12:16 2009 -0800 3.2 +++ b/src/cpu/x86/vm/frame_x86.cpp Wed Jan 06 22:21:39 2010 -0800 3.3 @@ -330,6 +330,14 @@ 3.4 // This is the sp before any possible extension (adapter/locals). 3.5 intptr_t* unextended_sp = interpreter_frame_sender_sp(); 3.6 3.7 + address sender_pc = this->sender_pc(); 3.8 + CodeBlob* sender_cb = CodeCache::find_blob_unsafe(sender_pc); 3.9 + assert(sender_cb, "sanity"); 3.10 + nmethod* sender_nm = sender_cb->as_nmethod_or_null(); 3.11 + if (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc)) { 3.12 + unextended_sp = (intptr_t*) at(link_offset); 3.13 + } 3.14 + 3.15 // The interpreter and compiler(s) always save EBP/RBP in a known 3.16 // location on entry. We must record where that location is 3.17 // so this if EBP/RBP was live on callout from c2 we can find 3.18 @@ -352,7 +360,7 @@ 3.19 #endif // AMD64 3.20 } 3.21 #endif /* COMPILER2 */ 3.22 - return frame(sp, unextended_sp, link(), sender_pc()); 3.23 + return frame(sp, unextended_sp, link(), sender_pc); 3.24 } 3.25 3.26 3.27 @@ -375,6 +383,18 @@ 3.28 3.29 intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset); 3.30 3.31 + intptr_t* unextended_sp = sender_sp; 3.32 + // If we are returning to a compiled method handle call site, 3.33 + // the saved_fp will in fact be a saved value of the unextended SP. 3.34 + // The simplest way to tell whether we are returning to such a call 3.35 + // site is as follows: 3.36 + CodeBlob* sender_cb = CodeCache::find_blob_unsafe(sender_pc); 3.37 + assert(sender_cb, "sanity"); 3.38 + nmethod* sender_nm = sender_cb->as_nmethod_or_null(); 3.39 + if (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc)) { 3.40 + unextended_sp = saved_fp; 3.41 + } 3.42 + 3.43 if (map->update_map()) { 3.44 // Tell GC to use argument oopmaps for some runtime stubs that need it. 3.45 // For C1, the runtime stub might not have oop maps, so set this flag 3.46 @@ -399,7 +419,7 @@ 3.47 } 3.48 3.49 assert(sender_sp != sp(), "must have changed"); 3.50 - return frame(sender_sp, saved_fp, sender_pc); 3.51 + return frame(sender_sp, unextended_sp, saved_fp, sender_pc); 3.52 } 3.53 3.54 frame frame::sender(RegisterMap* map) const {
4.1 --- a/src/cpu/x86/vm/frame_x86.inline.hpp Wed Dec 23 03:12:16 2009 -0800 4.2 +++ b/src/cpu/x86/vm/frame_x86.inline.hpp Wed Jan 06 22:21:39 2010 -0800 4.3 @@ -225,11 +225,12 @@ 4.4 // top of expression stack 4.5 inline intptr_t* frame::interpreter_frame_tos_address() const { 4.6 intptr_t* last_sp = interpreter_frame_last_sp(); 4.7 - if (last_sp == NULL ) { 4.8 + if (last_sp == NULL) { 4.9 return sp(); 4.10 } else { 4.11 - // sp() may have been extended by an adapter 4.12 - assert(last_sp < fp() && last_sp >= sp(), "bad tos"); 4.13 + // sp() may have been extended or shrunk by an adapter. At least 4.14 + // check that we don't fall behind the legal region. 4.15 + assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(), "bad tos"); 4.16 return last_sp; 4.17 } 4.18 }
5.1 --- a/src/cpu/x86/vm/methodHandles_x86.cpp Wed Dec 23 03:12:16 2009 -0800 5.2 +++ b/src/cpu/x86/vm/methodHandles_x86.cpp Wed Jan 06 22:21:39 2010 -0800 5.3 @@ -65,9 +65,9 @@ 5.4 // Verify that argslot lies within (rsp, rbp]. 5.5 Label L_ok, L_bad; 5.6 __ cmpptr(rax_argslot, rbp); 5.7 - __ jcc(Assembler::above, L_bad); 5.8 + __ jccb(Assembler::above, L_bad); 5.9 __ cmpptr(rsp, rax_argslot); 5.10 - __ jcc(Assembler::below, L_ok); 5.11 + __ jccb(Assembler::below, L_ok); 5.12 __ bind(L_bad); 5.13 __ stop(error_message); 5.14 __ bind(L_ok); 5.15 @@ -136,9 +136,9 @@ 5.16 if (arg_slots.is_register()) { 5.17 Label L_ok, L_bad; 5.18 __ cmpptr(arg_slots.as_register(), (int32_t) NULL_WORD); 5.19 - __ jcc(Assembler::greater, L_bad); 5.20 + __ jccb(Assembler::greater, L_bad); 5.21 __ testl(arg_slots.as_register(), -stack_move_unit() - 1); 5.22 - __ jcc(Assembler::zero, L_ok); 5.23 + __ jccb(Assembler::zero, L_ok); 5.24 __ bind(L_bad); 5.25 __ stop("assert arg_slots <= 0 and clear low bits"); 5.26 __ bind(L_ok); 5.27 @@ -173,7 +173,7 @@ 5.28 __ movptr(Address(rdx_temp, arg_slots, Address::times_ptr), rbx_temp); 5.29 __ addptr(rdx_temp, wordSize); 5.30 __ cmpptr(rdx_temp, rax_argslot); 5.31 - __ jcc(Assembler::less, loop); 5.32 + __ jccb(Assembler::less, loop); 5.33 } 5.34 5.35 // Now move the argslot down, to point to the opened-up space. 5.36 @@ -211,9 +211,9 @@ 5.37 Label L_ok, L_bad; 5.38 __ lea(rbx_temp, Address(rax_argslot, arg_slots, Address::times_ptr)); 5.39 __ cmpptr(rbx_temp, rbp); 5.40 - __ jcc(Assembler::above, L_bad); 5.41 + __ jccb(Assembler::above, L_bad); 5.42 __ cmpptr(rsp, rax_argslot); 5.43 - __ jcc(Assembler::below, L_ok); 5.44 + __ jccb(Assembler::below, L_ok); 5.45 __ bind(L_bad); 5.46 __ stop("deleted argument(s) must fall within current frame"); 5.47 __ bind(L_ok); 5.48 @@ -221,9 +221,9 @@ 5.49 if (arg_slots.is_register()) { 5.50 Label L_ok, L_bad; 5.51 __ cmpptr(arg_slots.as_register(), (int32_t) NULL_WORD); 5.52 - __ jcc(Assembler::less, L_bad); 5.53 + __ jccb(Assembler::less, L_bad); 5.54 __ testl(arg_slots.as_register(), -stack_move_unit() - 1); 5.55 - __ jcc(Assembler::zero, L_ok); 5.56 + __ jccb(Assembler::zero, L_ok); 5.57 __ bind(L_bad); 5.58 __ stop("assert arg_slots >= 0 and clear low bits"); 5.59 __ bind(L_ok); 5.60 @@ -258,7 +258,7 @@ 5.61 __ movptr(Address(rdx_temp, arg_slots, Address::times_ptr), rbx_temp); 5.62 __ addptr(rdx_temp, -wordSize); 5.63 __ cmpptr(rdx_temp, rsp); 5.64 - __ jcc(Assembler::greaterEqual, loop); 5.65 + __ jccb(Assembler::greaterEqual, loop); 5.66 } 5.67 5.68 // Now move the argslot up, to point to the just-copied block. 5.69 @@ -268,8 +268,9 @@ 5.70 } 5.71 5.72 #ifndef PRODUCT 5.73 +extern "C" void print_method_handle(oop mh); 5.74 void trace_method_handle_stub(const char* adaptername, 5.75 - oopDesc* mh, 5.76 + oop mh, 5.77 intptr_t* entry_sp, 5.78 intptr_t* saved_sp, 5.79 intptr_t* saved_bp) { 5.80 @@ -280,6 +281,7 @@ 5.81 adaptername, (intptr_t)mh, (intptr_t)entry_sp, (intptr_t)(saved_sp - entry_sp), (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp); 5.82 if (last_sp != saved_sp) 5.83 printf("*** last_sp="INTPTR_FORMAT"\n", (intptr_t)last_sp); 5.84 + if (Verbose) print_method_handle(mh); 5.85 } 5.86 #endif //PRODUCT 5.87 5.88 @@ -382,11 +384,11 @@ 5.89 // FIXME: fill in _raise_exception_method with a suitable sun.dyn method 5.90 __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method)); 5.91 __ testptr(rbx_method, rbx_method); 5.92 - __ jcc(Assembler::zero, no_method); 5.93 + __ jccb(Assembler::zero, no_method); 5.94 int jobject_oop_offset = 0; 5.95 __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset)); // dereference the jobject 5.96 __ testptr(rbx_method, rbx_method); 5.97 - __ jcc(Assembler::zero, no_method); 5.98 + __ jccb(Assembler::zero, no_method); 5.99 __ verify_oop(rbx_method); 5.100 __ push(rdi_pc); // and restore caller PC 5.101 __ jmp(rbx_method_fie); 5.102 @@ -533,16 +535,15 @@ 5.103 if (arg_type == T_OBJECT) { 5.104 __ movptr(Address(rax_argslot, 0), rbx_temp); 5.105 } else { 5.106 - __ load_sized_value(rbx_temp, prim_value_addr, 5.107 + __ load_sized_value(rdx_temp, prim_value_addr, 5.108 type2aelembytes(arg_type), is_signed_subword_type(arg_type)); 5.109 - __ movptr(Address(rax_argslot, 0), rbx_temp); 5.110 + __ movptr(Address(rax_argslot, 0), rdx_temp); 5.111 #ifndef _LP64 5.112 if (arg_slots == 2) { 5.113 - __ movl(rbx_temp, prim_value_addr.plus_disp(wordSize)); 5.114 - __ movl(Address(rax_argslot, Interpreter::stackElementSize()), rbx_temp); 5.115 + __ movl(rdx_temp, prim_value_addr.plus_disp(wordSize)); 5.116 + __ movl(Address(rax_argslot, Interpreter::stackElementSize()), rdx_temp); 5.117 } 5.118 #endif //_LP64 5.119 - break; 5.120 } 5.121 5.122 if (direct_to_method) { 5.123 @@ -584,7 +585,7 @@ 5.124 Label done; 5.125 __ movptr(rdx_temp, vmarg); 5.126 __ testl(rdx_temp, rdx_temp); 5.127 - __ jcc(Assembler::zero, done); // no cast if null 5.128 + __ jccb(Assembler::zero, done); // no cast if null 5.129 __ load_klass(rdx_temp, rdx_temp); 5.130 5.131 // live at this point: 5.132 @@ -675,24 +676,24 @@ 5.133 // (now we are done with the old MH) 5.134 5.135 // original 32-bit vmdata word must be of this form: 5.136 - // | MBZ:16 | signBitCount:8 | srcDstTypes:8 | conversionOp:8 | 5.137 - __ xchgl(rcx, rbx_vminfo); // free rcx for shifts 5.138 + // | MBZ:6 | signBitCount:8 | srcDstTypes:8 | conversionOp:8 | 5.139 + __ xchgptr(rcx, rbx_vminfo); // free rcx for shifts 5.140 __ shll(rdx_temp /*, rcx*/); 5.141 Label zero_extend, done; 5.142 __ testl(rcx, CONV_VMINFO_SIGN_FLAG); 5.143 - __ jcc(Assembler::zero, zero_extend); 5.144 + __ jccb(Assembler::zero, zero_extend); 5.145 5.146 // this path is taken for int->byte, int->short 5.147 __ sarl(rdx_temp /*, rcx*/); 5.148 - __ jmp(done); 5.149 + __ jmpb(done); 5.150 5.151 __ bind(zero_extend); 5.152 // this is taken for int->char 5.153 __ shrl(rdx_temp /*, rcx*/); 5.154 5.155 __ bind(done); 5.156 - __ movptr(vmarg, rdx_temp); 5.157 - __ xchgl(rcx, rbx_vminfo); // restore rcx_recv 5.158 + __ movl(vmarg, rdx_temp); 5.159 + __ xchgptr(rcx, rbx_vminfo); // restore rcx_recv 5.160 5.161 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); 5.162 } 5.163 @@ -861,7 +862,7 @@ 5.164 // Verify that argslot > destslot, by at least swap_bytes. 5.165 Label L_ok; 5.166 __ cmpptr(rax_argslot, rbx_destslot); 5.167 - __ jcc(Assembler::aboveEqual, L_ok); 5.168 + __ jccb(Assembler::aboveEqual, L_ok); 5.169 __ stop("source must be above destination (upward rotation)"); 5.170 __ bind(L_ok); 5.171 } 5.172 @@ -877,7 +878,7 @@ 5.173 __ movptr(Address(rax_argslot, swap_bytes), rdx_temp); 5.174 __ addptr(rax_argslot, -wordSize); 5.175 __ cmpptr(rax_argslot, rbx_destslot); 5.176 - __ jcc(Assembler::aboveEqual, loop); 5.177 + __ jccb(Assembler::aboveEqual, loop); 5.178 } else { 5.179 __ addptr(rax_argslot, swap_bytes); 5.180 #ifdef ASSERT 5.181 @@ -885,7 +886,7 @@ 5.182 // Verify that argslot < destslot, by at least swap_bytes. 5.183 Label L_ok; 5.184 __ cmpptr(rax_argslot, rbx_destslot); 5.185 - __ jcc(Assembler::belowEqual, L_ok); 5.186 + __ jccb(Assembler::belowEqual, L_ok); 5.187 __ stop("source must be below destination (downward rotation)"); 5.188 __ bind(L_ok); 5.189 } 5.190 @@ -901,7 +902,7 @@ 5.191 __ movptr(Address(rax_argslot, -swap_bytes), rdx_temp); 5.192 __ addptr(rax_argslot, wordSize); 5.193 __ cmpptr(rax_argslot, rbx_destslot); 5.194 - __ jcc(Assembler::belowEqual, loop); 5.195 + __ jccb(Assembler::belowEqual, loop); 5.196 } 5.197 5.198 // pop the original first chunk into the destination slot, now free 5.199 @@ -967,7 +968,7 @@ 5.200 __ addptr(rax_argslot, wordSize); 5.201 __ addptr(rdx_newarg, wordSize); 5.202 __ cmpptr(rdx_newarg, rbx_oldarg); 5.203 - __ jcc(Assembler::less, loop); 5.204 + __ jccb(Assembler::less, loop); 5.205 5.206 __ pop(rdi); // restore temp 5.207 5.208 @@ -1119,7 +1120,7 @@ 5.209 } 5.210 __ addptr(rax_argslot, Interpreter::stackElementSize()); 5.211 __ cmpptr(rax_argslot, rdx_argslot_limit); 5.212 - __ jcc(Assembler::less, loop); 5.213 + __ jccb(Assembler::less, loop); 5.214 } else if (length_constant == 0) { 5.215 __ bind(skip_array_check); 5.216 // nothing to copy
6.1 --- a/src/cpu/x86/vm/runtime_x86_32.cpp Wed Dec 23 03:12:16 2009 -0800 6.2 +++ b/src/cpu/x86/vm/runtime_x86_32.cpp Wed Jan 06 22:21:39 2010 -0800 6.3 @@ -43,11 +43,11 @@ 6.4 // This code is entered with a jmp. 6.5 // 6.6 // Arguments: 6.7 -// rax,: exception oop 6.8 +// rax: exception oop 6.9 // rdx: exception pc 6.10 // 6.11 // Results: 6.12 -// rax,: exception oop 6.13 +// rax: exception oop 6.14 // rdx: exception pc in caller or ??? 6.15 // destination: exception handler of caller 6.16 // 6.17 @@ -113,17 +113,17 @@ 6.18 __ addptr(rsp, return_off * wordSize); // Epilog! 6.19 __ pop(rdx); // Exception pc 6.20 6.21 + // rax: exception handler for given <exception oop/exception pc> 6.22 6.23 - // rax,: exception handler for given <exception oop/exception pc> 6.24 + // Restore SP from BP if the exception PC is a MethodHandle call. 6.25 + __ cmpl(Address(rcx, JavaThread::is_method_handle_exception_offset()), 0); 6.26 + __ cmovptr(Assembler::notEqual, rsp, rbp); 6.27 6.28 // We have a handler in rax, (could be deopt blob) 6.29 // rdx - throwing pc, deopt blob will need it. 6.30 6.31 __ push(rax); 6.32 6.33 - // rcx contains handler address 6.34 - 6.35 - __ get_thread(rcx); // TLS 6.36 // Get the exception 6.37 __ movptr(rax, Address(rcx, JavaThread::exception_oop_offset())); 6.38 // Get the exception pc in case we are deoptimized 6.39 @@ -137,7 +137,7 @@ 6.40 6.41 __ pop(rcx); 6.42 6.43 - // rax,: exception oop 6.44 + // rax: exception oop 6.45 // rcx: exception handler 6.46 // rdx: exception pc 6.47 __ jmp (rcx);
7.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Wed Dec 23 03:12:16 2009 -0800 7.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Wed Jan 06 22:21:39 2010 -0800 7.3 @@ -638,6 +638,10 @@ 7.4 7.5 __ movptr(rax, Address(rsp, 0)); 7.6 7.7 + // Must preserve original SP for loading incoming arguments because 7.8 + // we need to align the outgoing SP for compiled code. 7.9 + __ movptr(r11, rsp); 7.10 + 7.11 // Cut-out for having no stack args. Since up to 2 int/oop args are passed 7.12 // in registers, we will occasionally have no stack args. 7.13 int comp_words_on_stack = 0; 7.14 @@ -661,6 +665,10 @@ 7.15 // as far as the placement of the call instruction 7.16 __ push(rax); 7.17 7.18 + // Put saved SP in another register 7.19 + const Register saved_sp = rax; 7.20 + __ movptr(saved_sp, r11); 7.21 + 7.22 // Will jump to the compiled code just as if compiled code was doing it. 7.23 // Pre-load the register-jump target early, to schedule it better. 7.24 __ movptr(r11, Address(rbx, in_bytes(methodOopDesc::from_compiled_offset()))); 7.25 @@ -680,11 +688,7 @@ 7.26 assert(!regs[i].second()->is_valid() || regs[i].first()->next() == regs[i].second(), 7.27 "scrambled load targets?"); 7.28 // Load in argument order going down. 7.29 - // int ld_off = (total_args_passed + comp_words_on_stack -i)*wordSize; 7.30 - // base ld_off on r13 (sender_sp) as the stack alignment makes offsets from rsp 7.31 - // unpredictable 7.32 - int ld_off = ((total_args_passed - 1) - i)*Interpreter::stackElementSize(); 7.33 - 7.34 + int ld_off = (total_args_passed - i)*Interpreter::stackElementSize() + Interpreter::value_offset_in_bytes(); 7.35 // Point to interpreter value (vs. tag) 7.36 int next_off = ld_off - Interpreter::stackElementSize(); 7.37 // 7.38 @@ -699,10 +703,14 @@ 7.39 if (r_1->is_stack()) { 7.40 // Convert stack slot to an SP offset (+ wordSize to account for return address ) 7.41 int st_off = regs[i].first()->reg2stack()*VMRegImpl::stack_slot_size + wordSize; 7.42 + 7.43 + // We can use r13 as a temp here because compiled code doesn't need r13 as an input 7.44 + // and if we end up going thru a c2i because of a miss a reasonable value of r13 7.45 + // will be generated. 7.46 if (!r_2->is_valid()) { 7.47 // sign extend??? 7.48 - __ movl(rax, Address(r13, ld_off)); 7.49 - __ movptr(Address(rsp, st_off), rax); 7.50 + __ movl(r13, Address(saved_sp, ld_off)); 7.51 + __ movptr(Address(rsp, st_off), r13); 7.52 } else { 7.53 // 7.54 // We are using two optoregs. This can be either T_OBJECT, T_ADDRESS, T_LONG, or T_DOUBLE 7.55 @@ -715,9 +723,9 @@ 7.56 // ld_off is MSW so get LSW 7.57 const int offset = (sig_bt[i]==T_LONG||sig_bt[i]==T_DOUBLE)? 7.58 next_off : ld_off; 7.59 - __ movq(rax, Address(r13, offset)); 7.60 + __ movq(r13, Address(saved_sp, offset)); 7.61 // st_off is LSW (i.e. reg.first()) 7.62 - __ movq(Address(rsp, st_off), rax); 7.63 + __ movq(Address(rsp, st_off), r13); 7.64 } 7.65 } else if (r_1->is_Register()) { // Register argument 7.66 Register r = r_1->as_Register(); 7.67 @@ -732,16 +740,16 @@ 7.68 next_off : ld_off; 7.69 7.70 // this can be a misaligned move 7.71 - __ movq(r, Address(r13, offset)); 7.72 + __ movq(r, Address(saved_sp, offset)); 7.73 } else { 7.74 // sign extend and use a full word? 7.75 - __ movl(r, Address(r13, ld_off)); 7.76 + __ movl(r, Address(saved_sp, ld_off)); 7.77 } 7.78 } else { 7.79 if (!r_2->is_valid()) { 7.80 - __ movflt(r_1->as_XMMRegister(), Address(r13, ld_off)); 7.81 + __ movflt(r_1->as_XMMRegister(), Address(saved_sp, ld_off)); 7.82 } else { 7.83 - __ movdbl(r_1->as_XMMRegister(), Address(r13, next_off)); 7.84 + __ movdbl(r_1->as_XMMRegister(), Address(saved_sp, next_off)); 7.85 } 7.86 } 7.87 } 7.88 @@ -3319,6 +3327,10 @@ 7.89 7.90 // rax: exception handler 7.91 7.92 + // Restore SP from BP if the exception PC is a MethodHandle call. 7.93 + __ cmpl(Address(r15_thread, JavaThread::is_method_handle_exception_offset()), 0); 7.94 + __ cmovptr(Assembler::notEqual, rsp, rbp); 7.95 + 7.96 // We have a handler in rax (could be deopt blob). 7.97 __ mov(r8, rax); 7.98
8.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Wed Dec 23 03:12:16 2009 -0800 8.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Wed Jan 06 22:21:39 2010 -0800 8.3 @@ -1488,7 +1488,10 @@ 8.4 8.5 if (interpreter_frame != NULL) { 8.6 #ifdef ASSERT 8.7 - assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable"); 8.8 + if (!EnableMethodHandles) 8.9 + // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences? 8.10 + // Probably, since deoptimization doesn't work yet. 8.11 + assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable"); 8.12 assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)"); 8.13 #endif 8.14
9.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Wed Dec 23 03:12:16 2009 -0800 9.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Wed Jan 06 22:21:39 2010 -0800 9.3 @@ -449,8 +449,12 @@ 9.4 __ addptr(rax, stack_base); 9.5 __ subptr(rax, stack_size); 9.6 9.7 + // Use the maximum number of pages we might bang. 9.8 + const int max_pages = StackShadowPages > (StackRedPages+StackYellowPages) ? StackShadowPages : 9.9 + (StackRedPages+StackYellowPages); 9.10 + 9.11 // add in the red and yellow zone sizes 9.12 - __ addptr(rax, (StackRedPages + StackYellowPages) * page_size); 9.13 + __ addptr(rax, max_pages * page_size); 9.14 9.15 // check against the current stack bottom 9.16 __ cmpptr(rsp, rax); 9.17 @@ -1502,8 +1506,10 @@ 9.18 tempcount* Interpreter::stackElementWords() + popframe_extra_args; 9.19 if (interpreter_frame != NULL) { 9.20 #ifdef ASSERT 9.21 - assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), 9.22 - "Frame not properly walkable"); 9.23 + if (!EnableMethodHandles) 9.24 + // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences? 9.25 + // Probably, since deoptimization doesn't work yet. 9.26 + assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable"); 9.27 assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)"); 9.28 #endif 9.29
10.1 --- a/src/cpu/x86/vm/x86_32.ad Wed Dec 23 03:12:16 2009 -0800 10.2 +++ b/src/cpu/x86/vm/x86_32.ad Wed Jan 06 22:21:39 2010 -0800 10.3 @@ -268,22 +268,36 @@ 10.4 static jlong *float_signflip_pool = double_quadword(&fp_signmask_pool[3*2], CONST64(0x8000000080000000), CONST64(0x8000000080000000)); 10.5 static jlong *double_signflip_pool = double_quadword(&fp_signmask_pool[4*2], CONST64(0x8000000000000000), CONST64(0x8000000000000000)); 10.6 10.7 +// Offset hacking within calls. 10.8 +static int pre_call_FPU_size() { 10.9 + if (Compile::current()->in_24_bit_fp_mode()) 10.10 + return 6; // fldcw 10.11 + return 0; 10.12 +} 10.13 + 10.14 +static int preserve_SP_size() { 10.15 + return LP64_ONLY(1 +) 2; // [rex,] op, rm(reg/reg) 10.16 +} 10.17 + 10.18 // !!!!! Special hack to get all type of calls to specify the byte offset 10.19 // from the start of the call to the point where the return address 10.20 // will point. 10.21 int MachCallStaticJavaNode::ret_addr_offset() { 10.22 - return 5 + (Compile::current()->in_24_bit_fp_mode() ? 6 : 0); // 5 bytes from start of call to where return address points 10.23 + int offset = 5 + pre_call_FPU_size(); // 5 bytes from start of call to where return address points 10.24 + if (_method_handle_invoke) 10.25 + offset += preserve_SP_size(); 10.26 + return offset; 10.27 } 10.28 10.29 int MachCallDynamicJavaNode::ret_addr_offset() { 10.30 - return 10 + (Compile::current()->in_24_bit_fp_mode() ? 6 : 0); // 10 bytes from start of call to where return address points 10.31 + return 10 + pre_call_FPU_size(); // 10 bytes from start of call to where return address points 10.32 } 10.33 10.34 static int sizeof_FFree_Float_Stack_All = -1; 10.35 10.36 int MachCallRuntimeNode::ret_addr_offset() { 10.37 assert(sizeof_FFree_Float_Stack_All != -1, "must have been emitted already"); 10.38 - return sizeof_FFree_Float_Stack_All + 5 + (Compile::current()->in_24_bit_fp_mode() ? 6 : 0); 10.39 + return sizeof_FFree_Float_Stack_All + 5 + pre_call_FPU_size(); 10.40 } 10.41 10.42 // Indicate if the safepoint node needs the polling page as an input. 10.43 @@ -299,8 +313,16 @@ 10.44 // The address of the call instruction needs to be 4-byte aligned to 10.45 // ensure that it does not span a cache line so that it can be patched. 10.46 int CallStaticJavaDirectNode::compute_padding(int current_offset) const { 10.47 - if (Compile::current()->in_24_bit_fp_mode()) 10.48 - current_offset += 6; // skip fldcw in pre_call_FPU, if any 10.49 + current_offset += pre_call_FPU_size(); // skip fldcw, if any 10.50 + current_offset += 1; // skip call opcode byte 10.51 + return round_to(current_offset, alignment_required()) - current_offset; 10.52 +} 10.53 + 10.54 +// The address of the call instruction needs to be 4-byte aligned to 10.55 +// ensure that it does not span a cache line so that it can be patched. 10.56 +int CallStaticJavaHandleNode::compute_padding(int current_offset) const { 10.57 + current_offset += pre_call_FPU_size(); // skip fldcw, if any 10.58 + current_offset += preserve_SP_size(); // skip mov rbp, rsp 10.59 current_offset += 1; // skip call opcode byte 10.60 return round_to(current_offset, alignment_required()) - current_offset; 10.61 } 10.62 @@ -308,8 +330,7 @@ 10.63 // The address of the call instruction needs to be 4-byte aligned to 10.64 // ensure that it does not span a cache line so that it can be patched. 10.65 int CallDynamicJavaDirectNode::compute_padding(int current_offset) const { 10.66 - if (Compile::current()->in_24_bit_fp_mode()) 10.67 - current_offset += 6; // skip fldcw in pre_call_FPU, if any 10.68 + current_offset += pre_call_FPU_size(); // skip fldcw, if any 10.69 current_offset += 5; // skip MOV instruction 10.70 current_offset += 1; // skip call opcode byte 10.71 return round_to(current_offset, alignment_required()) - current_offset; 10.72 @@ -1460,6 +1481,10 @@ 10.73 return RegMask(); 10.74 } 10.75 10.76 +const RegMask Matcher::method_handle_invoke_SP_save_mask() { 10.77 + return EBP_REG_mask; 10.78 +} 10.79 + 10.80 %} 10.81 10.82 //----------ENCODING BLOCK----------------------------------------------------- 10.83 @@ -1772,10 +1797,13 @@ 10.84 10.85 enc_class pre_call_FPU %{ 10.86 // If method sets FPU control word restore it here 10.87 + debug_only(int off0 = cbuf.code_size()); 10.88 if( Compile::current()->in_24_bit_fp_mode() ) { 10.89 MacroAssembler masm(&cbuf); 10.90 masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std())); 10.91 } 10.92 + debug_only(int off1 = cbuf.code_size()); 10.93 + assert(off1 - off0 == pre_call_FPU_size(), "correct size prediction"); 10.94 %} 10.95 10.96 enc_class post_call_FPU %{ 10.97 @@ -1786,6 +1814,21 @@ 10.98 } 10.99 %} 10.100 10.101 + enc_class preserve_SP %{ 10.102 + debug_only(int off0 = cbuf.code_size()); 10.103 + MacroAssembler _masm(&cbuf); 10.104 + // RBP is preserved across all calls, even compiled calls. 10.105 + // Use it to preserve RSP in places where the callee might change the SP. 10.106 + __ movptr(rbp, rsp); 10.107 + debug_only(int off1 = cbuf.code_size()); 10.108 + assert(off1 - off0 == preserve_SP_size(), "correct size prediction"); 10.109 + %} 10.110 + 10.111 + enc_class restore_SP %{ 10.112 + MacroAssembler _masm(&cbuf); 10.113 + __ movptr(rsp, rbp); 10.114 + %} 10.115 + 10.116 enc_class Java_Static_Call (method meth) %{ // JAVA STATIC CALL 10.117 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine 10.118 // who we intended to call. 10.119 @@ -13406,6 +13449,7 @@ 10.120 // compute_padding() functions will have to be adjusted. 10.121 instruct CallStaticJavaDirect(method meth) %{ 10.122 match(CallStaticJava); 10.123 + predicate(! ((CallStaticJavaNode*)n)->is_method_handle_invoke()); 10.124 effect(USE meth); 10.125 10.126 ins_cost(300); 10.127 @@ -13420,6 +13464,30 @@ 10.128 ins_alignment(4); 10.129 %} 10.130 10.131 +// Call Java Static Instruction (method handle version) 10.132 +// Note: If this code changes, the corresponding ret_addr_offset() and 10.133 +// compute_padding() functions will have to be adjusted. 10.134 +instruct CallStaticJavaHandle(method meth, eBPRegP ebp) %{ 10.135 + match(CallStaticJava); 10.136 + predicate(((CallStaticJavaNode*)n)->is_method_handle_invoke()); 10.137 + effect(USE meth); 10.138 + // EBP is saved by all callees (for interpreter stack correction). 10.139 + // We use it here for a similar purpose, in {preserve,restore}_SP. 10.140 + 10.141 + ins_cost(300); 10.142 + format %{ "CALL,static/MethodHandle " %} 10.143 + opcode(0xE8); /* E8 cd */ 10.144 + ins_encode( pre_call_FPU, 10.145 + preserve_SP, 10.146 + Java_Static_Call( meth ), 10.147 + restore_SP, 10.148 + call_epilog, 10.149 + post_call_FPU ); 10.150 + ins_pipe( pipe_slow ); 10.151 + ins_pc_relative(1); 10.152 + ins_alignment(4); 10.153 +%} 10.154 + 10.155 // Call Java Dynamic Instruction 10.156 // Note: If this code changes, the corresponding ret_addr_offset() and 10.157 // compute_padding() functions will have to be adjusted.
11.1 --- a/src/cpu/x86/vm/x86_64.ad Wed Dec 23 03:12:16 2009 -0800 11.2 +++ b/src/cpu/x86/vm/x86_64.ad Wed Jan 06 22:21:39 2010 -0800 11.3 @@ -551,12 +551,19 @@ 11.4 11.5 #define __ _masm. 11.6 11.7 +static int preserve_SP_size() { 11.8 + return LP64_ONLY(1 +) 2; // [rex,] op, rm(reg/reg) 11.9 +} 11.10 + 11.11 // !!!!! Special hack to get all types of calls to specify the byte offset 11.12 // from the start of the call to the point where the return address 11.13 // will point. 11.14 int MachCallStaticJavaNode::ret_addr_offset() 11.15 { 11.16 - return 5; // 5 bytes from start of call to where return address points 11.17 + int offset = 5; // 5 bytes from start of call to where return address points 11.18 + if (_method_handle_invoke) 11.19 + offset += preserve_SP_size(); 11.20 + return offset; 11.21 } 11.22 11.23 int MachCallDynamicJavaNode::ret_addr_offset() 11.24 @@ -589,6 +596,15 @@ 11.25 11.26 // The address of the call instruction needs to be 4-byte aligned to 11.27 // ensure that it does not span a cache line so that it can be patched. 11.28 +int CallStaticJavaHandleNode::compute_padding(int current_offset) const 11.29 +{ 11.30 + current_offset += preserve_SP_size(); // skip mov rbp, rsp 11.31 + current_offset += 1; // skip call opcode byte 11.32 + return round_to(current_offset, alignment_required()) - current_offset; 11.33 +} 11.34 + 11.35 +// The address of the call instruction needs to be 4-byte aligned to 11.36 +// ensure that it does not span a cache line so that it can be patched. 11.37 int CallDynamicJavaDirectNode::compute_padding(int current_offset) const 11.38 { 11.39 current_offset += 11; // skip movq instruction + call opcode byte 11.40 @@ -2113,6 +2129,10 @@ 11.41 return LONG_RDX_REG_mask; 11.42 } 11.43 11.44 +const RegMask Matcher::method_handle_invoke_SP_save_mask() { 11.45 + return PTR_RBP_REG_mask; 11.46 +} 11.47 + 11.48 static Address build_address(int b, int i, int s, int d) { 11.49 Register index = as_Register(i); 11.50 Address::ScaleFactor scale = (Address::ScaleFactor)s; 11.51 @@ -2608,6 +2628,21 @@ 11.52 RELOC_DISP32); 11.53 %} 11.54 11.55 + enc_class preserve_SP %{ 11.56 + debug_only(int off0 = cbuf.code_size()); 11.57 + MacroAssembler _masm(&cbuf); 11.58 + // RBP is preserved across all calls, even compiled calls. 11.59 + // Use it to preserve RSP in places where the callee might change the SP. 11.60 + __ movptr(rbp, rsp); 11.61 + debug_only(int off1 = cbuf.code_size()); 11.62 + assert(off1 - off0 == preserve_SP_size(), "correct size prediction"); 11.63 + %} 11.64 + 11.65 + enc_class restore_SP %{ 11.66 + MacroAssembler _masm(&cbuf); 11.67 + __ movptr(rsp, rbp); 11.68 + %} 11.69 + 11.70 enc_class Java_Static_Call(method meth) 11.71 %{ 11.72 // JAVA STATIC CALL 11.73 @@ -12526,9 +12561,9 @@ 11.74 // Call Java Static Instruction 11.75 // Note: If this code changes, the corresponding ret_addr_offset() and 11.76 // compute_padding() functions will have to be adjusted. 11.77 -instruct CallStaticJavaDirect(method meth) 11.78 -%{ 11.79 +instruct CallStaticJavaDirect(method meth) %{ 11.80 match(CallStaticJava); 11.81 + predicate(!((CallStaticJavaNode*) n)->is_method_handle_invoke()); 11.82 effect(USE meth); 11.83 11.84 ins_cost(300); 11.85 @@ -12540,6 +12575,28 @@ 11.86 ins_alignment(4); 11.87 %} 11.88 11.89 +// Call Java Static Instruction (method handle version) 11.90 +// Note: If this code changes, the corresponding ret_addr_offset() and 11.91 +// compute_padding() functions will have to be adjusted. 11.92 +instruct CallStaticJavaHandle(method meth, rbp_RegP rbp) %{ 11.93 + match(CallStaticJava); 11.94 + predicate(((CallStaticJavaNode*) n)->is_method_handle_invoke()); 11.95 + effect(USE meth); 11.96 + // RBP is saved by all callees (for interpreter stack correction). 11.97 + // We use it here for a similar purpose, in {preserve,restore}_SP. 11.98 + 11.99 + ins_cost(300); 11.100 + format %{ "call,static/MethodHandle " %} 11.101 + opcode(0xE8); /* E8 cd */ 11.102 + ins_encode(preserve_SP, 11.103 + Java_Static_Call(meth), 11.104 + restore_SP, 11.105 + call_epilog); 11.106 + ins_pipe(pipe_slow); 11.107 + ins_pc_relative(1); 11.108 + ins_alignment(4); 11.109 +%} 11.110 + 11.111 // Call Java Dynamic Instruction 11.112 // Note: If this code changes, the corresponding ret_addr_offset() and 11.113 // compute_padding() functions will have to be adjusted.
12.1 --- a/src/cpu/zero/vm/cppInterpreter_zero.cpp Wed Dec 23 03:12:16 2009 -0800 12.2 +++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp Wed Jan 06 22:21:39 2010 -0800 12.3 @@ -245,7 +245,7 @@ 12.4 if (handlerAddr == NULL) { 12.5 CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method)); 12.6 if (HAS_PENDING_EXCEPTION) 12.7 - goto unwind_and_return; 12.8 + goto unlock_unwind_and_return; 12.9 12.10 handlerAddr = method->signature_handler(); 12.11 assert(handlerAddr != NULL, "eh?"); 12.12 @@ -254,7 +254,7 @@ 12.13 CALL_VM_NOCHECK(handlerAddr = 12.14 InterpreterRuntime::slow_signature_handler(thread, method, NULL,NULL)); 12.15 if (HAS_PENDING_EXCEPTION) 12.16 - goto unwind_and_return; 12.17 + goto unlock_unwind_and_return; 12.18 } 12.19 handler = \ 12.20 InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr); 12.21 @@ -365,10 +365,10 @@ 12.22 // Reset handle block 12.23 thread->active_handles()->clear(); 12.24 12.25 - // Unlock if necessary. It seems totally wrong that this 12.26 - // is skipped in the event of an exception but apparently 12.27 - // the template interpreter does this so we do too. 12.28 - if (monitor && !HAS_PENDING_EXCEPTION) { 12.29 + unlock_unwind_and_return: 12.30 + 12.31 + // Unlock if necessary 12.32 + if (monitor) { 12.33 BasicLock *lock = monitor->lock(); 12.34 markOop header = lock->displaced_header(); 12.35 oop rcvr = monitor->obj();
13.1 --- a/src/share/vm/c1/c1_IR.hpp Wed Dec 23 03:12:16 2009 -0800 13.2 +++ b/src/share/vm/c1/c1_IR.hpp Wed Jan 06 22:21:39 2010 -0800 13.3 @@ -251,8 +251,9 @@ 13.4 DebugToken* expvals = recorder->create_scope_values(expressions()); 13.5 DebugToken* monvals = recorder->create_monitor_values(monitors()); 13.6 // reexecute allowed only for the topmost frame 13.7 - bool reexecute = topmost ? should_reexecute() : false; 13.8 - recorder->describe_scope(pc_offset, scope()->method(), bci(), reexecute, locvals, expvals, monvals); 13.9 + bool reexecute = topmost ? should_reexecute() : false; 13.10 + bool is_method_handle_invoke = false; 13.11 + recorder->describe_scope(pc_offset, scope()->method(), bci(), reexecute, is_method_handle_invoke, locvals, expvals, monvals); 13.12 } 13.13 }; 13.14
14.1 --- a/src/share/vm/c1/c1_Runtime1.cpp Wed Dec 23 03:12:16 2009 -0800 14.2 +++ b/src/share/vm/c1/c1_Runtime1.cpp Wed Jan 06 22:21:39 2010 -0800 14.3 @@ -425,7 +425,7 @@ 14.4 assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); 14.5 assert(exception->is_oop(), "just checking"); 14.6 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError 14.7 - if (!(exception->is_a(SystemDictionary::throwable_klass()))) { 14.8 + if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { 14.9 if (ExitVMOnVerifyError) vm_exit(-1); 14.10 ShouldNotReachHere(); 14.11 }
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/src/share/vm/ci/ciCPCache.cpp Wed Jan 06 22:21:39 2010 -0800 15.3 @@ -0,0 +1,49 @@ 15.4 +/* 15.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 + * 15.8 + * This code is free software; you can redistribute it and/or modify it 15.9 + * under the terms of the GNU General Public License version 2 only, as 15.10 + * published by the Free Software Foundation. 15.11 + * 15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.15 + * version 2 for more details (a copy is included in the LICENSE file that 15.16 + * accompanied this code). 15.17 + * 15.18 + * You should have received a copy of the GNU General Public License version 15.19 + * 2 along with this work; if not, write to the Free Software Foundation, 15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.21 + * 15.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 15.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 15.24 + * have any questions. 15.25 + * 15.26 + */ 15.27 + 15.28 +#include "incls/_precompiled.incl" 15.29 +#include "incls/_ciCPCache.cpp.incl" 15.30 + 15.31 +// ciCPCache 15.32 + 15.33 +// ------------------------------------------------------------------ 15.34 +// ciCPCache::get_f1_offset 15.35 +size_t ciCPCache::get_f1_offset(int index) { 15.36 + // Calculate the offset from the constantPoolCacheOop to the f1 15.37 + // field. 15.38 + ByteSize f1_offset = 15.39 + constantPoolCacheOopDesc::entry_offset(index) + 15.40 + ConstantPoolCacheEntry::f1_offset(); 15.41 + 15.42 + return in_bytes(f1_offset); 15.43 +} 15.44 + 15.45 + 15.46 +// ------------------------------------------------------------------ 15.47 +// ciCPCache::print 15.48 +// 15.49 +// Print debugging information about the cache. 15.50 +void ciCPCache::print() { 15.51 + Unimplemented(); 15.52 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/src/share/vm/ci/ciCPCache.hpp Wed Jan 06 22:21:39 2010 -0800 16.3 @@ -0,0 +1,43 @@ 16.4 +/* 16.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 + * 16.8 + * This code is free software; you can redistribute it and/or modify it 16.9 + * under the terms of the GNU General Public License version 2 only, as 16.10 + * published by the Free Software Foundation. 16.11 + * 16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 + * version 2 for more details (a copy is included in the LICENSE file that 16.16 + * accompanied this code). 16.17 + * 16.18 + * You should have received a copy of the GNU General Public License version 16.19 + * 2 along with this work; if not, write to the Free Software Foundation, 16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 + * 16.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 16.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 16.24 + * have any questions. 16.25 + * 16.26 + */ 16.27 + 16.28 +// ciCPCache 16.29 +// 16.30 +// This class represents a constant pool cache. 16.31 +// 16.32 +// Note: This class is called ciCPCache as ciConstantPoolCache is used 16.33 +// for something different. 16.34 +class ciCPCache : public ciObject { 16.35 +public: 16.36 + ciCPCache(constantPoolCacheHandle cpcache) : ciObject(cpcache) {} 16.37 + 16.38 + // What kind of ciObject is this? 16.39 + bool is_cpcache() const { return true; } 16.40 + 16.41 + // Get the offset in bytes from the oop to the f1 field of the 16.42 + // requested entry. 16.43 + size_t get_f1_offset(int index); 16.44 + 16.45 + void print(); 16.46 +};
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/src/share/vm/ci/ciCallSite.cpp Wed Jan 06 22:21:39 2010 -0800 17.3 @@ -0,0 +1,46 @@ 17.4 +/* 17.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.7 + * 17.8 + * This code is free software; you can redistribute it and/or modify it 17.9 + * under the terms of the GNU General Public License version 2 only, as 17.10 + * published by the Free Software Foundation. 17.11 + * 17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.15 + * version 2 for more details (a copy is included in the LICENSE file that 17.16 + * accompanied this code). 17.17 + * 17.18 + * You should have received a copy of the GNU General Public License version 17.19 + * 2 along with this work; if not, write to the Free Software Foundation, 17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.21 + * 17.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 17.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 17.24 + * have any questions. 17.25 + * 17.26 + */ 17.27 + 17.28 +#include "incls/_precompiled.incl" 17.29 +#include "incls/_ciCallSite.cpp.incl" 17.30 + 17.31 +// ciCallSite 17.32 + 17.33 +// ------------------------------------------------------------------ 17.34 +// ciCallSite::get_target 17.35 +// 17.36 +// Return the target MethodHandle of this CallSite. 17.37 +ciMethodHandle* ciCallSite::get_target() const { 17.38 + VM_ENTRY_MARK; 17.39 + oop method_handle_oop = java_dyn_CallSite::target(get_oop()); 17.40 + return CURRENT_ENV->get_object(method_handle_oop)->as_method_handle(); 17.41 +} 17.42 + 17.43 +// ------------------------------------------------------------------ 17.44 +// ciCallSite::print 17.45 +// 17.46 +// Print debugging information about the CallSite. 17.47 +void ciCallSite::print() { 17.48 + Unimplemented(); 17.49 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/src/share/vm/ci/ciCallSite.hpp Wed Jan 06 22:21:39 2010 -0800 18.3 @@ -0,0 +1,39 @@ 18.4 +/* 18.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 + * 18.8 + * This code is free software; you can redistribute it and/or modify it 18.9 + * under the terms of the GNU General Public License version 2 only, as 18.10 + * published by the Free Software Foundation. 18.11 + * 18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 + * version 2 for more details (a copy is included in the LICENSE file that 18.16 + * accompanied this code). 18.17 + * 18.18 + * You should have received a copy of the GNU General Public License version 18.19 + * 2 along with this work; if not, write to the Free Software Foundation, 18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 + * 18.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 18.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 18.24 + * have any questions. 18.25 + * 18.26 + */ 18.27 + 18.28 +// ciCallSite 18.29 +// 18.30 +// The class represents a java.dyn.CallSite object. 18.31 +class ciCallSite : public ciInstance { 18.32 +public: 18.33 + ciCallSite(instanceHandle h_i) : ciInstance(h_i) {} 18.34 + 18.35 + // What kind of ciObject is this? 18.36 + bool is_call_site() const { return true; } 18.37 + 18.38 + // Return the target MethodHandle of this CallSite. 18.39 + ciMethodHandle* get_target() const; 18.40 + 18.41 + void print(); 18.42 +};
19.1 --- a/src/share/vm/ci/ciClassList.hpp Wed Dec 23 03:12:16 2009 -0800 19.2 +++ b/src/share/vm/ci/ciClassList.hpp Wed Jan 06 22:21:39 2010 -0800 19.3 @@ -25,6 +25,7 @@ 19.4 class ciEnv; 19.5 class ciObjectFactory; 19.6 class ciConstantPoolCache; 19.7 +class ciCPCache; 19.8 19.9 class ciField; 19.10 class ciConstant; 19.11 @@ -42,6 +43,8 @@ 19.12 class ciObject; 19.13 class ciNullObject; 19.14 class ciInstance; 19.15 +class ciCallSite; 19.16 +class ciMethodHandle; 19.17 class ciMethod; 19.18 class ciMethodData; 19.19 class ciReceiverTypeData; // part of ciMethodData 19.20 @@ -78,6 +81,7 @@ 19.21 // Any more access must be given explicitly. 19.22 #define CI_PACKAGE_ACCESS_TO \ 19.23 friend class ciObjectFactory; \ 19.24 +friend class ciCallSite; \ 19.25 friend class ciConstantPoolCache; \ 19.26 friend class ciField; \ 19.27 friend class ciConstant; \ 19.28 @@ -93,6 +97,7 @@ 19.29 friend class ciInstance; \ 19.30 friend class ciMethod; \ 19.31 friend class ciMethodData; \ 19.32 +friend class ciMethodHandle; \ 19.33 friend class ciReceiverTypeData; \ 19.34 friend class ciSymbol; \ 19.35 friend class ciArray; \
20.1 --- a/src/share/vm/ci/ciEnv.cpp Wed Dec 23 03:12:16 2009 -0800 20.2 +++ b/src/share/vm/ci/ciEnv.cpp Wed Jan 06 22:21:39 2010 -0800 20.3 @@ -38,17 +38,9 @@ 20.4 ciTypeArrayKlassKlass* ciEnv::_type_array_klass_klass_instance; 20.5 ciObjArrayKlassKlass* ciEnv::_obj_array_klass_klass_instance; 20.6 20.7 -ciInstanceKlass* ciEnv::_ArrayStoreException; 20.8 -ciInstanceKlass* ciEnv::_Class; 20.9 -ciInstanceKlass* ciEnv::_ClassCastException; 20.10 -ciInstanceKlass* ciEnv::_Object; 20.11 -ciInstanceKlass* ciEnv::_Throwable; 20.12 -ciInstanceKlass* ciEnv::_Thread; 20.13 -ciInstanceKlass* ciEnv::_OutOfMemoryError; 20.14 -ciInstanceKlass* ciEnv::_String; 20.15 -ciInstanceKlass* ciEnv::_StringBuffer; 20.16 -ciInstanceKlass* ciEnv::_StringBuilder; 20.17 -ciInstanceKlass* ciEnv::_Integer; 20.18 +#define WK_KLASS_DEFN(name, ignore_s, ignore_o) ciInstanceKlass* ciEnv::_##name = NULL; 20.19 +WK_KLASSES_DO(WK_KLASS_DEFN) 20.20 +#undef WK_KLASS_DEFN 20.21 20.22 ciSymbol* ciEnv::_unloaded_cisymbol = NULL; 20.23 ciInstanceKlass* ciEnv::_unloaded_ciinstance_klass = NULL; 20.24 @@ -442,12 +434,11 @@ 20.25 // ciEnv::get_klass_by_index_impl 20.26 // 20.27 // Implementation of get_klass_by_index. 20.28 -ciKlass* ciEnv::get_klass_by_index_impl(ciInstanceKlass* accessor, 20.29 +ciKlass* ciEnv::get_klass_by_index_impl(constantPoolHandle cpool, 20.30 int index, 20.31 - bool& is_accessible) { 20.32 - assert(accessor->get_instanceKlass()->is_linked(), "must be linked before accessing constant pool"); 20.33 + bool& is_accessible, 20.34 + ciInstanceKlass* accessor) { 20.35 EXCEPTION_CONTEXT; 20.36 - constantPoolHandle cpool(THREAD, accessor->get_instanceKlass()->constants()); 20.37 KlassHandle klass (THREAD, constantPoolOopDesc::klass_at_if_loaded(cpool, index)); 20.38 symbolHandle klass_name; 20.39 if (klass.is_null()) { 20.40 @@ -509,22 +500,21 @@ 20.41 // ciEnv::get_klass_by_index 20.42 // 20.43 // Get a klass from the constant pool. 20.44 -ciKlass* ciEnv::get_klass_by_index(ciInstanceKlass* accessor, 20.45 +ciKlass* ciEnv::get_klass_by_index(constantPoolHandle cpool, 20.46 int index, 20.47 - bool& is_accessible) { 20.48 - GUARDED_VM_ENTRY(return get_klass_by_index_impl(accessor, index, is_accessible);) 20.49 + bool& is_accessible, 20.50 + ciInstanceKlass* accessor) { 20.51 + GUARDED_VM_ENTRY(return get_klass_by_index_impl(cpool, index, is_accessible, accessor);) 20.52 } 20.53 20.54 // ------------------------------------------------------------------ 20.55 // ciEnv::get_constant_by_index_impl 20.56 // 20.57 // Implementation of get_constant_by_index(). 20.58 -ciConstant ciEnv::get_constant_by_index_impl(ciInstanceKlass* accessor, 20.59 - int index) { 20.60 +ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool, 20.61 + int index, 20.62 + ciInstanceKlass* accessor) { 20.63 EXCEPTION_CONTEXT; 20.64 - instanceKlass* ik_accessor = accessor->get_instanceKlass(); 20.65 - assert(ik_accessor->is_linked(), "must be linked before accessing constant pool"); 20.66 - constantPoolOop cpool = ik_accessor->constants(); 20.67 constantTag tag = cpool->tag_at(index); 20.68 if (tag.is_int()) { 20.69 return ciConstant(T_INT, (jint)cpool->int_at(index)); 20.70 @@ -552,7 +542,7 @@ 20.71 } else if (tag.is_klass() || tag.is_unresolved_klass()) { 20.72 // 4881222: allow ldc to take a class type 20.73 bool ignore; 20.74 - ciKlass* klass = get_klass_by_index_impl(accessor, index, ignore); 20.75 + ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore, accessor); 20.76 if (HAS_PENDING_EXCEPTION) { 20.77 CLEAR_PENDING_EXCEPTION; 20.78 record_out_of_memory_failure(); 20.79 @@ -561,6 +551,11 @@ 20.80 assert (klass->is_instance_klass() || klass->is_array_klass(), 20.81 "must be an instance or array klass "); 20.82 return ciConstant(T_OBJECT, klass); 20.83 + } else if (tag.is_object()) { 20.84 + oop obj = cpool->object_at(index); 20.85 + assert(obj->is_instance(), "must be an instance"); 20.86 + ciObject* ciobj = get_object(obj); 20.87 + return ciConstant(T_OBJECT, ciobj); 20.88 } else { 20.89 ShouldNotReachHere(); 20.90 return ciConstant(); 20.91 @@ -597,9 +592,10 @@ 20.92 // Pull a constant out of the constant pool. How appropriate. 20.93 // 20.94 // Implementation note: this query is currently in no way cached. 20.95 -ciConstant ciEnv::get_constant_by_index(ciInstanceKlass* accessor, 20.96 - int index) { 20.97 - GUARDED_VM_ENTRY(return get_constant_by_index_impl(accessor, index); ) 20.98 +ciConstant ciEnv::get_constant_by_index(constantPoolHandle cpool, 20.99 + int index, 20.100 + ciInstanceKlass* accessor) { 20.101 + GUARDED_VM_ENTRY(return get_constant_by_index_impl(cpool, index, accessor);) 20.102 } 20.103 20.104 // ------------------------------------------------------------------ 20.105 @@ -609,7 +605,7 @@ 20.106 // 20.107 // Implementation note: this query is currently in no way cached. 20.108 bool ciEnv::is_unresolved_string(ciInstanceKlass* accessor, 20.109 - int index) const { 20.110 + int index) const { 20.111 GUARDED_VM_ENTRY(return is_unresolved_string_impl(accessor->get_instanceKlass(), index); ) 20.112 } 20.113 20.114 @@ -620,7 +616,7 @@ 20.115 // 20.116 // Implementation note: this query is currently in no way cached. 20.117 bool ciEnv::is_unresolved_klass(ciInstanceKlass* accessor, 20.118 - int index) const { 20.119 + int index) const { 20.120 GUARDED_VM_ENTRY(return is_unresolved_klass_impl(accessor->get_instanceKlass(), index); ) 20.121 } 20.122 20.123 @@ -701,15 +697,12 @@ 20.124 20.125 // ------------------------------------------------------------------ 20.126 // ciEnv::get_method_by_index_impl 20.127 -ciMethod* ciEnv::get_method_by_index_impl(ciInstanceKlass* accessor, 20.128 - int index, Bytecodes::Code bc) { 20.129 - // Get the method's declared holder. 20.130 - 20.131 - assert(accessor->get_instanceKlass()->is_linked(), "must be linked before accessing constant pool"); 20.132 - constantPoolHandle cpool = accessor->get_instanceKlass()->constants(); 20.133 +ciMethod* ciEnv::get_method_by_index_impl(constantPoolHandle cpool, 20.134 + int index, Bytecodes::Code bc, 20.135 + ciInstanceKlass* accessor) { 20.136 int holder_index = cpool->klass_ref_index_at(index); 20.137 bool holder_is_accessible; 20.138 - ciKlass* holder = get_klass_by_index_impl(accessor, holder_index, holder_is_accessible); 20.139 + ciKlass* holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor); 20.140 ciInstanceKlass* declared_holder = get_instance_klass_for_declared_method_holder(holder); 20.141 20.142 // Get the method's name and signature. 20.143 @@ -736,6 +729,33 @@ 20.144 20.145 20.146 // ------------------------------------------------------------------ 20.147 +// ciEnv::get_fake_invokedynamic_method_impl 20.148 +ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool, 20.149 + int index, Bytecodes::Code bc) { 20.150 + assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic"); 20.151 + 20.152 + // Get the CallSite from the constant pool cache. 20.153 + ConstantPoolCacheEntry* cpc_entry = cpool->cache()->secondary_entry_at(index); 20.154 + assert(cpc_entry != NULL && cpc_entry->is_secondary_entry(), "sanity"); 20.155 + Handle call_site = cpc_entry->f1(); 20.156 + 20.157 + // Call site might not be linked yet. 20.158 + if (call_site.is_null()) { 20.159 + ciInstanceKlass* mh_klass = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass(); 20.160 + ciSymbol* sig_sym = get_object(cpool->signature_ref_at(index))->as_symbol(); 20.161 + return get_unloaded_method(mh_klass, ciSymbol::invoke_name(), sig_sym); 20.162 + } 20.163 + 20.164 + // Get the methodOop from the CallSite. 20.165 + methodOop method_oop = (methodOop) java_dyn_CallSite::vmmethod(call_site()); 20.166 + assert(method_oop != NULL, "sanity"); 20.167 + assert(method_oop->is_method_handle_invoke(), "consistent"); 20.168 + 20.169 + return get_object(method_oop)->as_method(); 20.170 +} 20.171 + 20.172 + 20.173 +// ------------------------------------------------------------------ 20.174 // ciEnv::get_instance_klass_for_declared_method_holder 20.175 ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* method_holder) { 20.176 // For the case of <array>.clone(), the method holder can be a ciArrayKlass 20.177 @@ -757,15 +777,19 @@ 20.178 } 20.179 20.180 20.181 - 20.182 - 20.183 // ------------------------------------------------------------------ 20.184 // ciEnv::get_method_by_index 20.185 -ciMethod* ciEnv::get_method_by_index(ciInstanceKlass* accessor, 20.186 - int index, Bytecodes::Code bc) { 20.187 - GUARDED_VM_ENTRY(return get_method_by_index_impl(accessor, index, bc);) 20.188 +ciMethod* ciEnv::get_method_by_index(constantPoolHandle cpool, 20.189 + int index, Bytecodes::Code bc, 20.190 + ciInstanceKlass* accessor) { 20.191 + if (bc == Bytecodes::_invokedynamic) { 20.192 + GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(cpool, index, bc);) 20.193 + } else { 20.194 + GUARDED_VM_ENTRY(return get_method_by_index_impl(cpool, index, bc, accessor);) 20.195 + } 20.196 } 20.197 20.198 + 20.199 // ------------------------------------------------------------------ 20.200 // ciEnv::name_buffer 20.201 char *ciEnv::name_buffer(int req_len) {
21.1 --- a/src/share/vm/ci/ciEnv.hpp Wed Dec 23 03:12:16 2009 -0800 21.2 +++ b/src/share/vm/ci/ciEnv.hpp Wed Jan 06 22:21:39 2010 -0800 21.3 @@ -74,17 +74,9 @@ 21.4 static ciTypeArrayKlassKlass* _type_array_klass_klass_instance; 21.5 static ciObjArrayKlassKlass* _obj_array_klass_klass_instance; 21.6 21.7 - static ciInstanceKlass* _ArrayStoreException; 21.8 - static ciInstanceKlass* _Class; 21.9 - static ciInstanceKlass* _ClassCastException; 21.10 - static ciInstanceKlass* _Object; 21.11 - static ciInstanceKlass* _Throwable; 21.12 - static ciInstanceKlass* _Thread; 21.13 - static ciInstanceKlass* _OutOfMemoryError; 21.14 - static ciInstanceKlass* _String; 21.15 - static ciInstanceKlass* _StringBuffer; 21.16 - static ciInstanceKlass* _StringBuilder; 21.17 - static ciInstanceKlass* _Integer; 21.18 +#define WK_KLASS_DECL(name, ignore_s, ignore_o) static ciInstanceKlass* _##name; 21.19 + WK_KLASSES_DO(WK_KLASS_DECL) 21.20 +#undef WK_KLASS_DECL 21.21 21.22 static ciSymbol* _unloaded_cisymbol; 21.23 static ciInstanceKlass* _unloaded_ciinstance_klass; 21.24 @@ -120,37 +112,45 @@ 21.25 bool require_local); 21.26 21.27 // Constant pool access. 21.28 - ciKlass* get_klass_by_index(ciInstanceKlass* loading_klass, 21.29 + ciKlass* get_klass_by_index(constantPoolHandle cpool, 21.30 int klass_index, 21.31 - bool& is_accessible); 21.32 - ciConstant get_constant_by_index(ciInstanceKlass* loading_klass, 21.33 - int constant_index); 21.34 + bool& is_accessible, 21.35 + ciInstanceKlass* loading_klass); 21.36 + ciConstant get_constant_by_index(constantPoolHandle cpool, 21.37 + int constant_index, 21.38 + ciInstanceKlass* accessor); 21.39 bool is_unresolved_string(ciInstanceKlass* loading_klass, 21.40 int constant_index) const; 21.41 bool is_unresolved_klass(ciInstanceKlass* loading_klass, 21.42 int constant_index) const; 21.43 ciField* get_field_by_index(ciInstanceKlass* loading_klass, 21.44 int field_index); 21.45 - ciMethod* get_method_by_index(ciInstanceKlass* loading_klass, 21.46 - int method_index, Bytecodes::Code bc); 21.47 + ciMethod* get_method_by_index(constantPoolHandle cpool, 21.48 + int method_index, Bytecodes::Code bc, 21.49 + ciInstanceKlass* loading_klass); 21.50 21.51 // Implementation methods for loading and constant pool access. 21.52 ciKlass* get_klass_by_name_impl(ciKlass* accessing_klass, 21.53 ciSymbol* klass_name, 21.54 bool require_local); 21.55 - ciKlass* get_klass_by_index_impl(ciInstanceKlass* loading_klass, 21.56 + ciKlass* get_klass_by_index_impl(constantPoolHandle cpool, 21.57 int klass_index, 21.58 - bool& is_accessible); 21.59 - ciConstant get_constant_by_index_impl(ciInstanceKlass* loading_klass, 21.60 - int constant_index); 21.61 + bool& is_accessible, 21.62 + ciInstanceKlass* loading_klass); 21.63 + ciConstant get_constant_by_index_impl(constantPoolHandle cpool, 21.64 + int constant_index, 21.65 + ciInstanceKlass* loading_klass); 21.66 bool is_unresolved_string_impl (instanceKlass* loading_klass, 21.67 int constant_index) const; 21.68 bool is_unresolved_klass_impl (instanceKlass* loading_klass, 21.69 int constant_index) const; 21.70 ciField* get_field_by_index_impl(ciInstanceKlass* loading_klass, 21.71 int field_index); 21.72 - ciMethod* get_method_by_index_impl(ciInstanceKlass* loading_klass, 21.73 - int method_index, Bytecodes::Code bc); 21.74 + ciMethod* get_method_by_index_impl(constantPoolHandle cpool, 21.75 + int method_index, Bytecodes::Code bc, 21.76 + ciInstanceKlass* loading_klass); 21.77 + ciMethod* get_fake_invokedynamic_method_impl(constantPoolHandle cpool, 21.78 + int index, Bytecodes::Code bc); 21.79 21.80 // Helper methods 21.81 bool check_klass_accessibility(ciKlass* accessing_klass, 21.82 @@ -292,39 +292,13 @@ 21.83 21.84 21.85 // Access to certain well known ciObjects. 21.86 - ciInstanceKlass* ArrayStoreException_klass() { 21.87 - return _ArrayStoreException; 21.88 +#define WK_KLASS_FUNC(name, ignore_s, ignore_o) \ 21.89 + ciInstanceKlass* name() { \ 21.90 + return _##name;\ 21.91 } 21.92 - ciInstanceKlass* Class_klass() { 21.93 - return _Class; 21.94 - } 21.95 - ciInstanceKlass* ClassCastException_klass() { 21.96 - return _ClassCastException; 21.97 - } 21.98 - ciInstanceKlass* Object_klass() { 21.99 - return _Object; 21.100 - } 21.101 - ciInstanceKlass* Throwable_klass() { 21.102 - return _Throwable; 21.103 - } 21.104 - ciInstanceKlass* Thread_klass() { 21.105 - return _Thread; 21.106 - } 21.107 - ciInstanceKlass* OutOfMemoryError_klass() { 21.108 - return _OutOfMemoryError; 21.109 - } 21.110 - ciInstanceKlass* String_klass() { 21.111 - return _String; 21.112 - } 21.113 - ciInstanceKlass* StringBuilder_klass() { 21.114 - return _StringBuilder; 21.115 - } 21.116 - ciInstanceKlass* StringBuffer_klass() { 21.117 - return _StringBuffer; 21.118 - } 21.119 - ciInstanceKlass* Integer_klass() { 21.120 - return _Integer; 21.121 - } 21.122 + WK_KLASSES_DO(WK_KLASS_FUNC) 21.123 +#undef WK_KLASS_FUNC 21.124 + 21.125 ciInstance* NullPointerException_instance() { 21.126 assert(_NullPointerException_instance != NULL, "initialization problem"); 21.127 return _NullPointerException_instance;
22.1 --- a/src/share/vm/ci/ciExceptionHandler.cpp Wed Dec 23 03:12:16 2009 -0800 22.2 +++ b/src/share/vm/ci/ciExceptionHandler.cpp Wed Jan 06 22:21:39 2010 -0800 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright 1999-2003 Sun Microsystems, Inc. All Rights Reserved. 22.6 + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -34,12 +34,16 @@ 22.11 // 22.12 // Get the exception klass that this handler catches. 22.13 ciInstanceKlass* ciExceptionHandler::catch_klass() { 22.14 + VM_ENTRY_MARK; 22.15 assert(!is_catch_all(), "bad index"); 22.16 if (_catch_klass == NULL) { 22.17 bool will_link; 22.18 - ciKlass* k = CURRENT_ENV->get_klass_by_index(_loading_klass, 22.19 + assert(_loading_klass->get_instanceKlass()->is_linked(), "must be linked before accessing constant pool"); 22.20 + constantPoolHandle cpool(_loading_klass->get_instanceKlass()->constants()); 22.21 + ciKlass* k = CURRENT_ENV->get_klass_by_index(cpool, 22.22 _catch_klass_index, 22.23 - will_link); 22.24 + will_link, 22.25 + _loading_klass); 22.26 if (!will_link && k->is_loaded()) { 22.27 GUARDED_VM_ENTRY( 22.28 k = CURRENT_ENV->get_unloaded_klass(_loading_klass, k->name());
23.1 --- a/src/share/vm/ci/ciField.cpp Wed Dec 23 03:12:16 2009 -0800 23.2 +++ b/src/share/vm/ci/ciField.cpp Wed Jan 06 22:21:39 2010 -0800 23.3 @@ -1,5 +1,5 @@ 23.4 /* 23.5 - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. 23.6 + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.8 * 23.9 * This code is free software; you can redistribute it and/or modify it 23.10 @@ -86,7 +86,7 @@ 23.11 bool ignore; 23.12 // This is not really a class reference; the index always refers to the 23.13 // field's type signature, as a symbol. Linkage checks do not apply. 23.14 - _type = ciEnv::current(thread)->get_klass_by_index(klass, sig_index, ignore); 23.15 + _type = ciEnv::current(thread)->get_klass_by_index(cpool, sig_index, ignore, klass); 23.16 } else { 23.17 _type = ciType::make(field_type); 23.18 } 23.19 @@ -100,9 +100,9 @@ 23.20 int holder_index = cpool->klass_ref_index_at(index); 23.21 bool holder_is_accessible; 23.22 ciInstanceKlass* declared_holder = 23.23 - ciEnv::current(thread)->get_klass_by_index(klass, holder_index, 23.24 - holder_is_accessible) 23.25 - ->as_instance_klass(); 23.26 + ciEnv::current(thread)->get_klass_by_index(cpool, holder_index, 23.27 + holder_is_accessible, 23.28 + klass)->as_instance_klass(); 23.29 23.30 // The declared holder of this field may not have been loaded. 23.31 // Bail out with partial field information. 23.32 @@ -168,8 +168,18 @@ 23.33 _holder = CURRENT_ENV->get_object(fd->field_holder())->as_instance_klass(); 23.34 23.35 // Check to see if the field is constant. 23.36 - if (_holder->is_initialized() && 23.37 - this->is_final() && this->is_static()) { 23.38 + if (_holder->is_initialized() && this->is_final()) { 23.39 + if (!this->is_static()) { 23.40 + // A field can be constant if it's a final static field or if it's 23.41 + // a final non-static field of a trusted class ({java,sun}.dyn). 23.42 + if (_holder->is_in_package("java/dyn") || _holder->is_in_package("sun/dyn")) { 23.43 + _is_constant = true; 23.44 + return; 23.45 + } 23.46 + _is_constant = false; 23.47 + return; 23.48 + } 23.49 + 23.50 // This field just may be constant. The only cases where it will 23.51 // not be constant are: 23.52 // 23.53 @@ -182,8 +192,8 @@ 23.54 // java.lang.System.out, and java.lang.System.err. 23.55 23.56 klassOop k = _holder->get_klassOop(); 23.57 - assert( SystemDictionary::system_klass() != NULL, "Check once per vm"); 23.58 - if( k == SystemDictionary::system_klass() ) { 23.59 + assert( SystemDictionary::System_klass() != NULL, "Check once per vm"); 23.60 + if( k == SystemDictionary::System_klass() ) { 23.61 // Check offsets for case 2: System.in, System.out, or System.err 23.62 if( _offset == java_lang_System::in_offset_in_bytes() || 23.63 _offset == java_lang_System::out_offset_in_bytes() ||
24.1 --- a/src/share/vm/ci/ciField.hpp Wed Dec 23 03:12:16 2009 -0800 24.2 +++ b/src/share/vm/ci/ciField.hpp Wed Jan 06 22:21:39 2010 -0800 24.3 @@ -138,10 +138,18 @@ 24.4 24.5 // Get the constant value of this field. 24.6 ciConstant constant_value() { 24.7 - assert(is_constant(), "illegal call to constant_value()"); 24.8 + assert(is_static() && is_constant(), "illegal call to constant_value()"); 24.9 return _constant_value; 24.10 } 24.11 24.12 + // Get the constant value of non-static final field in the given 24.13 + // object. 24.14 + ciConstant constant_value_of(ciObject* object) { 24.15 + assert(!is_static() && is_constant(), "only if field is non-static constant"); 24.16 + assert(object->is_instance(), "must be instance"); 24.17 + return object->as_instance()->field_value(this); 24.18 + } 24.19 + 24.20 // Check for link time errors. Accessing a field from a 24.21 // certain class via a certain bytecode may or may not be legal. 24.22 // This call checks to see if an exception may be raised by
25.1 --- a/src/share/vm/ci/ciInstance.cpp Wed Dec 23 03:12:16 2009 -0800 25.2 +++ b/src/share/vm/ci/ciInstance.cpp Wed Jan 06 22:21:39 2010 -0800 25.3 @@ -36,7 +36,7 @@ 25.4 VM_ENTRY_MARK; 25.5 oop m = get_oop(); 25.6 // Return NULL if it is not java.lang.Class. 25.7 - if (m == NULL || m->klass() != SystemDictionary::class_klass()) { 25.8 + if (m == NULL || m->klass() != SystemDictionary::Class_klass()) { 25.9 return NULL; 25.10 } 25.11 // Return either a primitive type or a klass.
26.1 --- a/src/share/vm/ci/ciInstanceKlass.cpp Wed Dec 23 03:12:16 2009 -0800 26.2 +++ b/src/share/vm/ci/ciInstanceKlass.cpp Wed Jan 06 22:21:39 2010 -0800 26.3 @@ -75,7 +75,7 @@ 26.4 _java_mirror = NULL; 26.5 26.6 if (is_shared()) { 26.7 - if (h_k() != SystemDictionary::object_klass()) { 26.8 + if (h_k() != SystemDictionary::Object_klass()) { 26.9 super(); 26.10 } 26.11 java_mirror(); 26.12 @@ -232,8 +232,48 @@ 26.13 // ------------------------------------------------------------------ 26.14 // ciInstanceKlass::uses_default_loader 26.15 bool ciInstanceKlass::uses_default_loader() { 26.16 - VM_ENTRY_MARK; 26.17 - return loader() == NULL; 26.18 + // Note: We do not need to resolve the handle or enter the VM 26.19 + // in order to test null-ness. 26.20 + return _loader == NULL; 26.21 +} 26.22 + 26.23 +// ------------------------------------------------------------------ 26.24 +// ciInstanceKlass::is_in_package 26.25 +// 26.26 +// Is this klass in the given package? 26.27 +bool ciInstanceKlass::is_in_package(const char* packagename, int len) { 26.28 + // To avoid class loader mischief, this test always rejects application classes. 26.29 + if (!uses_default_loader()) 26.30 + return false; 26.31 + GUARDED_VM_ENTRY( 26.32 + return is_in_package_impl(packagename, len); 26.33 + ) 26.34 +} 26.35 + 26.36 +bool ciInstanceKlass::is_in_package_impl(const char* packagename, int len) { 26.37 + ASSERT_IN_VM; 26.38 + 26.39 + // If packagename contains trailing '/' exclude it from the 26.40 + // prefix-test since we test for it explicitly. 26.41 + if (packagename[len - 1] == '/') 26.42 + len--; 26.43 + 26.44 + if (!name()->starts_with(packagename, len)) 26.45 + return false; 26.46 + 26.47 + // Test if the class name is something like "java/lang". 26.48 + if ((len + 1) > name()->utf8_length()) 26.49 + return false; 26.50 + 26.51 + // Test for trailing '/' 26.52 + if ((char) name()->byte_at(len) != '/') 26.53 + return false; 26.54 + 26.55 + // Make sure it's not actually in a subpackage: 26.56 + if (name()->index_of_at(len+1, "/", 1) >= 0) 26.57 + return false; 26.58 + 26.59 + return true; 26.60 } 26.61 26.62 // ------------------------------------------------------------------
27.1 --- a/src/share/vm/ci/ciInstanceKlass.hpp Wed Dec 23 03:12:16 2009 -0800 27.2 +++ b/src/share/vm/ci/ciInstanceKlass.hpp Wed Jan 06 22:21:39 2010 -0800 27.3 @@ -29,10 +29,11 @@ 27.4 // be loaded. 27.5 class ciInstanceKlass : public ciKlass { 27.6 CI_PACKAGE_ACCESS 27.7 + friend class ciBytecodeStream; 27.8 friend class ciEnv; 27.9 + friend class ciExceptionHandler; 27.10 friend class ciMethod; 27.11 friend class ciField; 27.12 - friend class ciBytecodeStream; 27.13 27.14 private: 27.15 jobject _loader; 27.16 @@ -78,6 +79,8 @@ 27.17 27.18 const char* type_string() { return "ciInstanceKlass"; } 27.19 27.20 + bool is_in_package_impl(const char* packagename, int len); 27.21 + 27.22 void print_impl(outputStream* st); 27.23 27.24 ciConstantPoolCache* field_cache(); 27.25 @@ -196,6 +199,12 @@ 27.26 27.27 bool is_java_lang_Object(); 27.28 27.29 + // Is this klass in the given package? 27.30 + bool is_in_package(const char* packagename) { 27.31 + return is_in_package(packagename, (int) strlen(packagename)); 27.32 + } 27.33 + bool is_in_package(const char* packagename, int len); 27.34 + 27.35 // What kind of ciObject is this? 27.36 bool is_instance_klass() { return true; } 27.37 bool is_java_klass() { return true; }
28.1 --- a/src/share/vm/ci/ciKlass.cpp Wed Dec 23 03:12:16 2009 -0800 28.2 +++ b/src/share/vm/ci/ciKlass.cpp Wed Jan 06 22:21:39 2010 -0800 28.3 @@ -1,5 +1,5 @@ 28.4 /* 28.5 - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. 28.6 + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 28.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.8 * 28.9 * This code is free software; you can redistribute it and/or modify it
29.1 --- a/src/share/vm/ci/ciKlass.hpp Wed Dec 23 03:12:16 2009 -0800 29.2 +++ b/src/share/vm/ci/ciKlass.hpp Wed Jan 06 22:21:39 2010 -0800 29.3 @@ -1,5 +1,5 @@ 29.4 /* 29.5 - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. 29.6 + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 29.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.8 * 29.9 * This code is free software; you can redistribute it and/or modify it 29.10 @@ -69,7 +69,7 @@ 29.11 ciKlass(KlassHandle k_h); 29.12 29.13 // What is the name of this klass? 29.14 - ciSymbol* name() { return _name; } 29.15 + ciSymbol* name() const { return _name; } 29.16 29.17 // What is its layout helper value? 29.18 jint layout_helper() { return _layout_helper; }
30.1 --- a/src/share/vm/ci/ciMethod.cpp Wed Dec 23 03:12:16 2009 -0800 30.2 +++ b/src/share/vm/ci/ciMethod.cpp Wed Jan 06 22:21:39 2010 -0800 30.3 @@ -687,7 +687,7 @@ 30.4 // ------------------------------------------------------------------ 30.5 // invokedynamic support 30.6 // 30.7 -bool ciMethod::is_method_handle_invoke() { 30.8 +bool ciMethod::is_method_handle_invoke() const { 30.9 check_is_loaded(); 30.10 bool flag = ((flags().as_int() & JVM_MH_INVOKE_BITS) == JVM_MH_INVOKE_BITS); 30.11 #ifdef ASSERT
31.1 --- a/src/share/vm/ci/ciMethod.hpp Wed Dec 23 03:12:16 2009 -0800 31.2 +++ b/src/share/vm/ci/ciMethod.hpp Wed Jan 06 22:21:39 2010 -0800 31.3 @@ -38,6 +38,8 @@ 31.4 CI_PACKAGE_ACCESS 31.5 friend class ciEnv; 31.6 friend class ciExceptionHandlerStream; 31.7 + friend class ciBytecodeStream; 31.8 + friend class ciMethodHandle; 31.9 31.10 private: 31.11 // General method information. 31.12 @@ -213,7 +215,7 @@ 31.13 bool check_call(int refinfo_index, bool is_static) const; 31.14 void build_method_data(); // make sure it exists in the VM also 31.15 int scale_count(int count, float prof_factor = 1.); // make MDO count commensurate with IIC 31.16 - bool is_method_handle_invoke(); 31.17 + bool is_method_handle_invoke() const; 31.18 ciInstance* method_handle_type(); 31.19 31.20 // What kind of ciObject is this? 31.21 @@ -251,4 +253,10 @@ 31.22 // Print the name of this method in various incarnations. 31.23 void print_name(outputStream* st = tty); 31.24 void print_short_name(outputStream* st = tty); 31.25 + 31.26 + methodOop get_method_handle_target() { 31.27 + klassOop receiver_limit_oop = NULL; 31.28 + int flags = 0; 31.29 + return MethodHandles::decode_method(get_oop(), receiver_limit_oop, flags); 31.30 + } 31.31 };
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/src/share/vm/ci/ciMethodHandle.cpp Wed Jan 06 22:21:39 2010 -0800 32.3 @@ -0,0 +1,52 @@ 32.4 +/* 32.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.7 + * 32.8 + * This code is free software; you can redistribute it and/or modify it 32.9 + * under the terms of the GNU General Public License version 2 only, as 32.10 + * published by the Free Software Foundation. 32.11 + * 32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 32.15 + * version 2 for more details (a copy is included in the LICENSE file that 32.16 + * accompanied this code). 32.17 + * 32.18 + * You should have received a copy of the GNU General Public License version 32.19 + * 2 along with this work; if not, write to the Free Software Foundation, 32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 32.21 + * 32.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 32.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 32.24 + * have any questions. 32.25 + * 32.26 + */ 32.27 + 32.28 +#include "incls/_precompiled.incl" 32.29 +#include "incls/_ciMethodHandle.cpp.incl" 32.30 + 32.31 +// ciMethodHandle 32.32 + 32.33 +// ------------------------------------------------------------------ 32.34 +// ciMethodHandle::get_adapter 32.35 +// 32.36 +// Return an adapter for this MethodHandle. 32.37 +ciMethod* ciMethodHandle::get_adapter(bool is_invokedynamic) const { 32.38 + VM_ENTRY_MARK; 32.39 + 32.40 + Handle h(get_oop()); 32.41 + methodHandle callee(_callee->get_methodOop()); 32.42 + MethodHandleCompiler mhc(h, callee, is_invokedynamic, THREAD); 32.43 + methodHandle m = mhc.compile(CHECK_NULL); 32.44 + return CURRENT_ENV->get_object(m())->as_method(); 32.45 +} 32.46 + 32.47 + 32.48 +// ------------------------------------------------------------------ 32.49 +// ciMethodHandle::print_impl 32.50 +// 32.51 +// Implementation of the print method. 32.52 +void ciMethodHandle::print_impl(outputStream* st) { 32.53 + st->print(" type="); 32.54 + get_oop()->print(); 32.55 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/src/share/vm/ci/ciMethodHandle.hpp Wed Jan 06 22:21:39 2010 -0800 33.3 @@ -0,0 +1,56 @@ 33.4 +/* 33.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.7 + * 33.8 + * This code is free software; you can redistribute it and/or modify it 33.9 + * under the terms of the GNU General Public License version 2 only, as 33.10 + * published by the Free Software Foundation. 33.11 + * 33.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 33.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 33.15 + * version 2 for more details (a copy is included in the LICENSE file that 33.16 + * accompanied this code). 33.17 + * 33.18 + * You should have received a copy of the GNU General Public License version 33.19 + * 2 along with this work; if not, write to the Free Software Foundation, 33.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 33.21 + * 33.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 33.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 33.24 + * have any questions. 33.25 + * 33.26 + */ 33.27 + 33.28 +// ciMethodHandle 33.29 +// 33.30 +// The class represents a java.dyn.MethodHandle object. 33.31 +class ciMethodHandle : public ciInstance { 33.32 +private: 33.33 + ciMethod* _callee; 33.34 + 33.35 + // Return an adapter for this MethodHandle. 33.36 + ciMethod* get_adapter(bool is_invokedynamic) const; 33.37 + 33.38 +protected: 33.39 + void print_impl(outputStream* st); 33.40 + 33.41 +public: 33.42 + ciMethodHandle(instanceHandle h_i) : ciInstance(h_i) {}; 33.43 + 33.44 + // What kind of ciObject is this? 33.45 + bool is_method_handle() const { return true; } 33.46 + 33.47 + ciMethod* callee() const { return _callee; } 33.48 + void set_callee(ciMethod* m) { _callee = m; } 33.49 + 33.50 + // Return an adapter for a MethodHandle call. 33.51 + ciMethod* get_method_handle_adapter() const { 33.52 + return get_adapter(false); 33.53 + } 33.54 + 33.55 + // Return an adapter for an invokedynamic call. 33.56 + ciMethod* get_invokedynamic_adapter() const { 33.57 + return get_adapter(true); 33.58 + } 33.59 +};
34.1 --- a/src/share/vm/ci/ciObject.hpp Wed Dec 23 03:12:16 2009 -0800 34.2 +++ b/src/share/vm/ci/ciObject.hpp Wed Jan 06 22:21:39 2010 -0800 34.3 @@ -131,9 +131,12 @@ 34.4 34.5 // What kind of ciObject is this? 34.6 virtual bool is_null_object() const { return false; } 34.7 + virtual bool is_call_site() const { return false; } 34.8 + virtual bool is_cpcache() const { return false; } 34.9 virtual bool is_instance() { return false; } 34.10 virtual bool is_method() { return false; } 34.11 virtual bool is_method_data() { return false; } 34.12 + virtual bool is_method_handle() const { return false; } 34.13 virtual bool is_array() { return false; } 34.14 virtual bool is_obj_array() { return false; } 34.15 virtual bool is_type_array() { return false; } 34.16 @@ -185,6 +188,14 @@ 34.17 assert(is_null_object(), "bad cast"); 34.18 return (ciNullObject*)this; 34.19 } 34.20 + ciCallSite* as_call_site() { 34.21 + assert(is_call_site(), "bad cast"); 34.22 + return (ciCallSite*) this; 34.23 + } 34.24 + ciCPCache* as_cpcache() { 34.25 + assert(is_cpcache(), "bad cast"); 34.26 + return (ciCPCache*) this; 34.27 + } 34.28 ciInstance* as_instance() { 34.29 assert(is_instance(), "bad cast"); 34.30 return (ciInstance*)this; 34.31 @@ -197,6 +208,10 @@ 34.32 assert(is_method_data(), "bad cast"); 34.33 return (ciMethodData*)this; 34.34 } 34.35 + ciMethodHandle* as_method_handle() { 34.36 + assert(is_method_handle(), "bad cast"); 34.37 + return (ciMethodHandle*) this; 34.38 + } 34.39 ciArray* as_array() { 34.40 assert(is_array(), "bad cast"); 34.41 return (ciArray*)this;
35.1 --- a/src/share/vm/ci/ciObjectFactory.cpp Wed Dec 23 03:12:16 2009 -0800 35.2 +++ b/src/share/vm/ci/ciObjectFactory.cpp Wed Jan 06 22:21:39 2010 -0800 35.3 @@ -144,39 +144,13 @@ 35.4 ciEnv::_obj_array_klass_klass_instance = 35.5 get(Universe::objArrayKlassKlassObj()) 35.6 ->as_obj_array_klass_klass(); 35.7 - ciEnv::_ArrayStoreException = 35.8 - get(SystemDictionary::ArrayStoreException_klass()) 35.9 - ->as_instance_klass(); 35.10 - ciEnv::_Class = 35.11 - get(SystemDictionary::class_klass()) 35.12 - ->as_instance_klass(); 35.13 - ciEnv::_ClassCastException = 35.14 - get(SystemDictionary::ClassCastException_klass()) 35.15 - ->as_instance_klass(); 35.16 - ciEnv::_Object = 35.17 - get(SystemDictionary::object_klass()) 35.18 - ->as_instance_klass(); 35.19 - ciEnv::_Throwable = 35.20 - get(SystemDictionary::throwable_klass()) 35.21 - ->as_instance_klass(); 35.22 - ciEnv::_Thread = 35.23 - get(SystemDictionary::thread_klass()) 35.24 - ->as_instance_klass(); 35.25 - ciEnv::_OutOfMemoryError = 35.26 - get(SystemDictionary::OutOfMemoryError_klass()) 35.27 - ->as_instance_klass(); 35.28 - ciEnv::_String = 35.29 - get(SystemDictionary::string_klass()) 35.30 - ->as_instance_klass(); 35.31 - ciEnv::_StringBuffer = 35.32 - get(SystemDictionary::stringBuffer_klass()) 35.33 - ->as_instance_klass(); 35.34 - ciEnv::_StringBuilder = 35.35 - get(SystemDictionary::StringBuilder_klass()) 35.36 - ->as_instance_klass(); 35.37 - ciEnv::_Integer = 35.38 - get(SystemDictionary::int_klass()) 35.39 - ->as_instance_klass(); 35.40 + 35.41 +#define WK_KLASS_DEFN(name, ignore_s, opt) \ 35.42 + if (SystemDictionary::name() != NULL) \ 35.43 + ciEnv::_##name = get(SystemDictionary::name())->as_instance_klass(); 35.44 + 35.45 + WK_KLASSES_DO(WK_KLASS_DEFN) 35.46 +#undef WK_KLASS_DEFN 35.47 35.48 for (int len = -1; len != _ci_objects->length(); ) { 35.49 len = _ci_objects->length(); 35.50 @@ -333,13 +307,21 @@ 35.51 return new (arena()) ciMethodData(h_md); 35.52 } else if (o->is_instance()) { 35.53 instanceHandle h_i(THREAD, (instanceOop)o); 35.54 - return new (arena()) ciInstance(h_i); 35.55 + if (java_dyn_CallSite::is_instance(o)) 35.56 + return new (arena()) ciCallSite(h_i); 35.57 + else if (java_dyn_MethodHandle::is_instance(o)) 35.58 + return new (arena()) ciMethodHandle(h_i); 35.59 + else 35.60 + return new (arena()) ciInstance(h_i); 35.61 } else if (o->is_objArray()) { 35.62 objArrayHandle h_oa(THREAD, (objArrayOop)o); 35.63 return new (arena()) ciObjArray(h_oa); 35.64 } else if (o->is_typeArray()) { 35.65 typeArrayHandle h_ta(THREAD, (typeArrayOop)o); 35.66 return new (arena()) ciTypeArray(h_ta); 35.67 + } else if (o->is_constantPoolCache()) { 35.68 + constantPoolCacheHandle h_cpc(THREAD, (constantPoolCacheOop) o); 35.69 + return new (arena()) ciCPCache(h_cpc); 35.70 } 35.71 35.72 // The oop is of some type not supported by the compiler interface. 35.73 @@ -576,7 +558,7 @@ 35.74 if (key->is_perm() && _non_perm_count == 0) { 35.75 return emptyBucket; 35.76 } else if (key->is_instance()) { 35.77 - if (key->klass() == SystemDictionary::class_klass()) { 35.78 + if (key->klass() == SystemDictionary::Class_klass()) { 35.79 // class mirror instances are always perm 35.80 return emptyBucket; 35.81 }
36.1 --- a/src/share/vm/ci/ciStreams.cpp Wed Dec 23 03:12:16 2009 -0800 36.2 +++ b/src/share/vm/ci/ciStreams.cpp Wed Jan 06 22:21:39 2010 -0800 36.3 @@ -186,8 +186,9 @@ 36.4 // If this bytecode is a new, newarray, multianewarray, instanceof, 36.5 // or checkcast, get the referenced klass. 36.6 ciKlass* ciBytecodeStream::get_klass(bool& will_link) { 36.7 - return CURRENT_ENV->get_klass_by_index(_holder, get_klass_index(), 36.8 - will_link); 36.9 + VM_ENTRY_MARK; 36.10 + constantPoolHandle cpool(_method->get_methodOop()->constants()); 36.11 + return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder); 36.12 } 36.13 36.14 // ------------------------------------------------------------------ 36.15 @@ -213,7 +214,9 @@ 36.16 // If this bytecode is one of the ldc variants, get the referenced 36.17 // constant. 36.18 ciConstant ciBytecodeStream::get_constant() { 36.19 - return CURRENT_ENV->get_constant_by_index(_holder, get_constant_index()); 36.20 + VM_ENTRY_MARK; 36.21 + constantPoolHandle cpool(_method->get_methodOop()->constants()); 36.22 + return CURRENT_ENV->get_constant_by_index(cpool, get_constant_index(), _holder); 36.23 } 36.24 36.25 // ------------------------------------------------------------------ 36.26 @@ -264,9 +267,11 @@ 36.27 // There is no "will_link" result passed back. The user is responsible 36.28 // for checking linkability when retrieving the associated field. 36.29 ciInstanceKlass* ciBytecodeStream::get_declared_field_holder() { 36.30 + VM_ENTRY_MARK; 36.31 + constantPoolHandle cpool(_method->get_methodOop()->constants()); 36.32 int holder_index = get_field_holder_index(); 36.33 bool ignore; 36.34 - return CURRENT_ENV->get_klass_by_index(_holder, holder_index, ignore) 36.35 + return CURRENT_ENV->get_klass_by_index(cpool, holder_index, ignore, _holder) 36.36 ->as_instance_klass(); 36.37 } 36.38 36.39 @@ -277,9 +282,10 @@ 36.40 // referenced by the current bytecode. Used for generating 36.41 // deoptimization information. 36.42 int ciBytecodeStream::get_field_holder_index() { 36.43 - VM_ENTRY_MARK; 36.44 - constantPoolOop cpool = _holder->get_instanceKlass()->constants(); 36.45 - return cpool->klass_ref_index_at(get_field_index()); 36.46 + GUARDED_VM_ENTRY( 36.47 + constantPoolOop cpool = _holder->get_instanceKlass()->constants(); 36.48 + return cpool->klass_ref_index_at(get_field_index()); 36.49 + ) 36.50 } 36.51 36.52 // ------------------------------------------------------------------ 36.53 @@ -321,7 +327,9 @@ 36.54 // 36.55 // If this is a method invocation bytecode, get the invoked method. 36.56 ciMethod* ciBytecodeStream::get_method(bool& will_link) { 36.57 - ciMethod* m = CURRENT_ENV->get_method_by_index(_holder, get_method_index(),cur_bc()); 36.58 + VM_ENTRY_MARK; 36.59 + constantPoolHandle cpool(_method->get_methodOop()->constants()); 36.60 + ciMethod* m = CURRENT_ENV->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder); 36.61 will_link = m->is_loaded(); 36.62 return m; 36.63 } 36.64 @@ -338,11 +346,13 @@ 36.65 // There is no "will_link" result passed back. The user is responsible 36.66 // for checking linkability when retrieving the associated method. 36.67 ciKlass* ciBytecodeStream::get_declared_method_holder() { 36.68 + VM_ENTRY_MARK; 36.69 + constantPoolHandle cpool(_method->get_methodOop()->constants()); 36.70 bool ignore; 36.71 - // report as Dynamic for invokedynamic, which is syntactically classless 36.72 + // report as InvokeDynamic for invokedynamic, which is syntactically classless 36.73 if (cur_bc() == Bytecodes::_invokedynamic) 36.74 - return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_dyn_Dynamic(), false); 36.75 - return CURRENT_ENV->get_klass_by_index(_holder, get_method_holder_index(), ignore); 36.76 + return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_dyn_InvokeDynamic(), false); 36.77 + return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder); 36.78 } 36.79 36.80 // ------------------------------------------------------------------ 36.81 @@ -352,8 +362,7 @@ 36.82 // referenced by the current bytecode. Used for generating 36.83 // deoptimization information. 36.84 int ciBytecodeStream::get_method_holder_index() { 36.85 - VM_ENTRY_MARK; 36.86 - constantPoolOop cpool = _holder->get_instanceKlass()->constants(); 36.87 + constantPoolOop cpool = _method->get_methodOop()->constants(); 36.88 return cpool->klass_ref_index_at(get_method_index()); 36.89 } 36.90 36.91 @@ -370,3 +379,31 @@ 36.92 int name_and_type_index = cpool->name_and_type_ref_index_at(method_index); 36.93 return cpool->signature_ref_index_at(name_and_type_index); 36.94 } 36.95 + 36.96 +// ------------------------------------------------------------------ 36.97 +// ciBytecodeStream::get_cpcache 36.98 +ciCPCache* ciBytecodeStream::get_cpcache() { 36.99 + VM_ENTRY_MARK; 36.100 + // Get the constant pool. 36.101 + constantPoolOop cpool = _holder->get_instanceKlass()->constants(); 36.102 + constantPoolCacheOop cpcache = cpool->cache(); 36.103 + 36.104 + return CURRENT_ENV->get_object(cpcache)->as_cpcache(); 36.105 +} 36.106 + 36.107 +// ------------------------------------------------------------------ 36.108 +// ciBytecodeStream::get_call_site 36.109 +ciCallSite* ciBytecodeStream::get_call_site() { 36.110 + VM_ENTRY_MARK; 36.111 + // Get the constant pool. 36.112 + constantPoolOop cpool = _holder->get_instanceKlass()->constants(); 36.113 + constantPoolCacheOop cpcache = cpool->cache(); 36.114 + 36.115 + // Get the CallSite from the constant pool cache. 36.116 + int method_index = get_method_index(); 36.117 + ConstantPoolCacheEntry* cpcache_entry = cpcache->secondary_entry_at(method_index); 36.118 + oop call_site_oop = cpcache_entry->f1(); 36.119 + 36.120 + // Create a CallSite object and return it. 36.121 + return CURRENT_ENV->get_object(call_site_oop)->as_call_site(); 36.122 +}
37.1 --- a/src/share/vm/ci/ciStreams.hpp Wed Dec 23 03:12:16 2009 -0800 37.2 +++ b/src/share/vm/ci/ciStreams.hpp Wed Jan 06 22:21:39 2010 -0800 37.3 @@ -232,6 +232,9 @@ 37.4 int get_method_holder_index(); 37.5 int get_method_signature_index(); 37.6 37.7 + ciCPCache* get_cpcache(); 37.8 + ciCallSite* get_call_site(); 37.9 + 37.10 private: 37.11 void assert_index_size(int required_size) const { 37.12 #ifdef ASSERT
38.1 --- a/src/share/vm/ci/ciSymbol.cpp Wed Dec 23 03:12:16 2009 -0800 38.2 +++ b/src/share/vm/ci/ciSymbol.cpp Wed Jan 06 22:21:39 2010 -0800 38.3 @@ -1,5 +1,5 @@ 38.4 /* 38.5 - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. 38.6 + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 38.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.8 * 38.9 * This code is free software; you can redistribute it and/or modify it 38.10 @@ -60,6 +60,22 @@ 38.11 } 38.12 38.13 // ------------------------------------------------------------------ 38.14 +// ciSymbol::starts_with 38.15 +// 38.16 +// Tests if the symbol starts with the given prefix. 38.17 +bool ciSymbol::starts_with(const char* prefix, int len) const { 38.18 + GUARDED_VM_ENTRY(return get_symbolOop()->starts_with(prefix, len);) 38.19 +} 38.20 + 38.21 +// ------------------------------------------------------------------ 38.22 +// ciSymbol::index_of 38.23 +// 38.24 +// Determines where the symbol contains the given substring. 38.25 +int ciSymbol::index_of_at(int i, const char* str, int len) const { 38.26 + GUARDED_VM_ENTRY(return get_symbolOop()->index_of_at(i, str, len);) 38.27 +} 38.28 + 38.29 +// ------------------------------------------------------------------ 38.30 // ciSymbol::utf8_length 38.31 int ciSymbol::utf8_length() { 38.32 GUARDED_VM_ENTRY(return get_symbolOop()->utf8_length();)
39.1 --- a/src/share/vm/ci/ciSymbol.hpp Wed Dec 23 03:12:16 2009 -0800 39.2 +++ b/src/share/vm/ci/ciSymbol.hpp Wed Jan 06 22:21:39 2010 -0800 39.3 @@ -1,5 +1,5 @@ 39.4 /* 39.5 - * Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved. 39.6 + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 39.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.8 * 39.9 * This code is free software; you can redistribute it and/or modify it 39.10 @@ -28,6 +28,7 @@ 39.11 // machine. 39.12 class ciSymbol : public ciObject { 39.13 CI_PACKAGE_ACCESS 39.14 + // These friends all make direct use of get_symbolOop: 39.15 friend class ciEnv; 39.16 friend class ciInstanceKlass; 39.17 friend class ciSignature; 39.18 @@ -38,13 +39,13 @@ 39.19 ciSymbol(symbolOop s) : ciObject(s) {} 39.20 ciSymbol(symbolHandle s); // for use with vmSymbolHandles 39.21 39.22 - symbolOop get_symbolOop() { return (symbolOop)get_oop(); } 39.23 + symbolOop get_symbolOop() const { return (symbolOop)get_oop(); } 39.24 39.25 const char* type_string() { return "ciSymbol"; } 39.26 39.27 void print_impl(outputStream* st); 39.28 39.29 - int byte_at(int i); 39.30 + // This is public in symbolOop but private here, because the base can move: 39.31 jbyte* base(); 39.32 39.33 // Make a ciSymbol from a C string (implementation). 39.34 @@ -55,6 +56,15 @@ 39.35 const char* as_utf8(); 39.36 int utf8_length(); 39.37 39.38 + // Return the i-th utf8 byte, where i < utf8_length 39.39 + int byte_at(int i); 39.40 + 39.41 + // Tests if the symbol starts with the given prefix. 39.42 + bool starts_with(const char* prefix, int len) const; 39.43 + 39.44 + // Determines where the symbol contains the given substring. 39.45 + int index_of_at(int i, const char* str, int len) const; 39.46 + 39.47 // What kind of ciObject is this? 39.48 bool is_symbol() { return true; } 39.49
40.1 --- a/src/share/vm/ci/ciType.cpp Wed Dec 23 03:12:16 2009 -0800 40.2 +++ b/src/share/vm/ci/ciType.cpp Wed Jan 06 22:21:39 2010 -0800 40.3 @@ -111,7 +111,7 @@ 40.4 // short, etc. 40.5 // Note: Bare T_ADDRESS means a raw pointer type, not a return_address. 40.6 assert((uint)t < T_CONFLICT+1, "range check"); 40.7 - if (t == T_OBJECT) return ciEnv::_Object; // java/lang/Object 40.8 + if (t == T_OBJECT) return ciEnv::_Object_klass; // java/lang/Object 40.9 assert(_basic_types[t] != NULL, "domain check"); 40.10 return _basic_types[t]; 40.11 }
41.1 --- a/src/share/vm/ci/ciTypeFlow.cpp Wed Dec 23 03:12:16 2009 -0800 41.2 +++ b/src/share/vm/ci/ciTypeFlow.cpp Wed Jan 06 22:21:39 2010 -0800 41.3 @@ -635,8 +635,15 @@ 41.4 ciMethod* method = str->get_method(will_link); 41.5 if (!will_link) { 41.6 // We weren't able to find the method. 41.7 - ciKlass* unloaded_holder = method->holder(); 41.8 - trap(str, unloaded_holder, str->get_method_holder_index()); 41.9 + if (str->cur_bc() == Bytecodes::_invokedynamic) { 41.10 + trap(str, NULL, 41.11 + Deoptimization::make_trap_request 41.12 + (Deoptimization::Reason_uninitialized, 41.13 + Deoptimization::Action_reinterpret)); 41.14 + } else { 41.15 + ciKlass* unloaded_holder = method->holder(); 41.16 + trap(str, unloaded_holder, str->get_method_holder_index()); 41.17 + } 41.18 } else { 41.19 ciSignature* signature = method->signature(); 41.20 ciSignatureStream sigstr(signature); 41.21 @@ -1292,8 +1299,8 @@ 41.22 case Bytecodes::_invokeinterface: do_invoke(str, true); break; 41.23 case Bytecodes::_invokespecial: do_invoke(str, true); break; 41.24 case Bytecodes::_invokestatic: do_invoke(str, false); break; 41.25 - 41.26 case Bytecodes::_invokevirtual: do_invoke(str, true); break; 41.27 + case Bytecodes::_invokedynamic: do_invoke(str, false); break; 41.28 41.29 case Bytecodes::_istore: store_local_int(str->get_index()); break; 41.30 case Bytecodes::_istore_0: store_local_int(0); break;
42.1 --- a/src/share/vm/ci/ciUtilities.hpp Wed Dec 23 03:12:16 2009 -0800 42.2 +++ b/src/share/vm/ci/ciUtilities.hpp Wed Jan 06 22:21:39 2010 -0800 42.3 @@ -79,7 +79,7 @@ 42.4 THREAD); \ 42.5 if (HAS_PENDING_EXCEPTION) { \ 42.6 if (PENDING_EXCEPTION->klass() == \ 42.7 - SystemDictionary::threaddeath_klass()) { \ 42.8 + SystemDictionary::ThreadDeath_klass()) { \ 42.9 /* Kill the compilation. */ \ 42.10 fatal("unhandled ci exception"); \ 42.11 return (result); \
43.1 --- a/src/share/vm/classfile/classFileParser.cpp Wed Dec 23 03:12:16 2009 -0800 43.2 +++ b/src/share/vm/classfile/classFileParser.cpp Wed Jan 06 22:21:39 2010 -0800 43.3 @@ -430,7 +430,7 @@ 43.4 case JVM_CONSTANT_UnresolvedClass : 43.5 // Patching a class means pre-resolving it. 43.6 // The name in the constant pool is ignored. 43.7 - if (patch->klass() == SystemDictionary::class_klass()) { // %%% java_lang_Class::is_instance 43.8 + if (patch->klass() == SystemDictionary::Class_klass()) { // %%% java_lang_Class::is_instance 43.9 guarantee_property(!java_lang_Class::is_primitive(patch()), 43.10 "Illegal class patch at %d in class file %s", 43.11 index, CHECK); 43.12 @@ -643,7 +643,7 @@ 43.13 guarantee_property(value_type.is_int(), "Inconsistent constant value type in class file %s", CHECK); 43.14 break; 43.15 case T_OBJECT: 43.16 - guarantee_property((cp->symbol_at(signature_index)->equals("Ljava/lang/String;", 18) 43.17 + guarantee_property((cp->symbol_at(signature_index)->equals("Ljava/lang/String;") 43.18 && (value_type.is_string() || value_type.is_unresolved_string())), 43.19 "Bad string initial value in class file %s", CHECK); 43.20 break; 43.21 @@ -1718,9 +1718,7 @@ 43.22 m->set_exception_table(exception_handlers()); 43.23 43.24 // Copy byte codes 43.25 - if (code_length > 0) { 43.26 - memcpy(m->code_base(), code_start, code_length); 43.27 - } 43.28 + m->set_code(code_start); 43.29 43.30 // Copy line number table 43.31 if (linenumber_table != NULL) { 43.32 @@ -3471,8 +3469,8 @@ 43.33 #endif 43.34 43.35 // Check if this klass supports the java.lang.Cloneable interface 43.36 - if (SystemDictionary::cloneable_klass_loaded()) { 43.37 - if (k->is_subtype_of(SystemDictionary::cloneable_klass())) { 43.38 + if (SystemDictionary::Cloneable_klass_loaded()) { 43.39 + if (k->is_subtype_of(SystemDictionary::Cloneable_klass())) { 43.40 k->set_is_cloneable(); 43.41 } 43.42 } 43.43 @@ -4178,7 +4176,7 @@ 43.44 // Check if ch is Java identifier start or is Java identifier part 43.45 // 4672820: call java.lang.Character methods directly without generating separate tables. 43.46 EXCEPTION_MARK; 43.47 - instanceKlassHandle klass (THREAD, SystemDictionary::char_klass()); 43.48 + instanceKlassHandle klass (THREAD, SystemDictionary::Character_klass()); 43.49 43.50 // return value 43.51 JavaValue result(T_BOOLEAN);
44.1 --- a/src/share/vm/classfile/classLoader.cpp Wed Dec 23 03:12:16 2009 -0800 44.2 +++ b/src/share/vm/classfile/classLoader.cpp Wed Jan 06 22:21:39 2010 -0800 44.3 @@ -819,7 +819,7 @@ 44.4 _package_hash_table->copy_pkgnames(packages); 44.5 } 44.6 // Allocate objArray and fill with java.lang.String 44.7 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::string_klass(), 44.8 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), 44.9 nof_entries, CHECK_0); 44.10 objArrayHandle result(THREAD, r); 44.11 for (int i = 0; i < nof_entries; i++) {
45.1 --- a/src/share/vm/classfile/javaAssertions.cpp Wed Dec 23 03:12:16 2009 -0800 45.2 +++ b/src/share/vm/classfile/javaAssertions.cpp Wed Jan 06 22:21:39 2010 -0800 45.3 @@ -95,14 +95,14 @@ 45.4 int len; 45.5 typeArrayOop t; 45.6 len = OptionList::count(_packages); 45.7 - objArrayOop pn = oopFactory::new_objArray(SystemDictionary::string_klass(), len, CHECK_NULL); 45.8 + objArrayOop pn = oopFactory::new_objArray(SystemDictionary::String_klass(), len, CHECK_NULL); 45.9 objArrayHandle pkgNames (THREAD, pn); 45.10 t = oopFactory::new_typeArray(T_BOOLEAN, len, CHECK_NULL); 45.11 typeArrayHandle pkgEnabled(THREAD, t); 45.12 fillJavaArrays(_packages, len, pkgNames, pkgEnabled, CHECK_NULL); 45.13 45.14 len = OptionList::count(_classes); 45.15 - objArrayOop cn = oopFactory::new_objArray(SystemDictionary::string_klass(), len, CHECK_NULL); 45.16 + objArrayOop cn = oopFactory::new_objArray(SystemDictionary::String_klass(), len, CHECK_NULL); 45.17 objArrayHandle classNames (THREAD, cn); 45.18 t = oopFactory::new_typeArray(T_BOOLEAN, len, CHECK_NULL); 45.19 typeArrayHandle classEnabled(THREAD, t);
46.1 --- a/src/share/vm/classfile/javaClasses.cpp Wed Dec 23 03:12:16 2009 -0800 46.2 +++ b/src/share/vm/classfile/javaClasses.cpp Wed Jan 06 22:21:39 2010 -0800 46.3 @@ -68,9 +68,9 @@ 46.4 // and the char array it points to end up in the same cache line. 46.5 oop obj; 46.6 if (tenured) { 46.7 - obj = instanceKlass::cast(SystemDictionary::string_klass())->allocate_permanent_instance(CHECK_NH); 46.8 + obj = instanceKlass::cast(SystemDictionary::String_klass())->allocate_permanent_instance(CHECK_NH); 46.9 } else { 46.10 - obj = instanceKlass::cast(SystemDictionary::string_klass())->allocate_instance(CHECK_NH); 46.11 + obj = instanceKlass::cast(SystemDictionary::String_klass())->allocate_instance(CHECK_NH); 46.12 } 46.13 46.14 // Create the char array. The String object must be handlized here 46.15 @@ -293,7 +293,7 @@ 46.16 46.17 bool java_lang_String::equals(oop java_string, jchar* chars, int len) { 46.18 assert(SharedSkipVerify || 46.19 - java_string->klass() == SystemDictionary::string_klass(), 46.20 + java_string->klass() == SystemDictionary::String_klass(), 46.21 "must be java_string"); 46.22 typeArrayOop value = java_lang_String::value(java_string); 46.23 int offset = java_lang_String::offset(java_string); 46.24 @@ -311,7 +311,7 @@ 46.25 46.26 void java_lang_String::print(Handle java_string, outputStream* st) { 46.27 oop obj = java_string(); 46.28 - assert(obj->klass() == SystemDictionary::string_klass(), "must be java_string"); 46.29 + assert(obj->klass() == SystemDictionary::String_klass(), "must be java_string"); 46.30 typeArrayOop value = java_lang_String::value(obj); 46.31 int offset = java_lang_String::offset(obj); 46.32 int length = java_lang_String::length(obj); 46.33 @@ -339,9 +339,9 @@ 46.34 // class is put into the system dictionary. 46.35 int computed_modifiers = k->compute_modifier_flags(CHECK_0); 46.36 k->set_modifier_flags(computed_modifiers); 46.37 - if (SystemDictionary::class_klass_loaded()) { 46.38 + if (SystemDictionary::Class_klass_loaded()) { 46.39 // Allocate mirror (java.lang.Class instance) 46.40 - Handle mirror = instanceKlass::cast(SystemDictionary::class_klass())->allocate_permanent_instance(CHECK_0); 46.41 + Handle mirror = instanceKlass::cast(SystemDictionary::Class_klass())->allocate_permanent_instance(CHECK_0); 46.42 // Setup indirections 46.43 mirror->obj_field_put(klass_offset, k()); 46.44 k->set_java_mirror(mirror()); 46.45 @@ -378,7 +378,7 @@ 46.46 oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) { 46.47 // This should be improved by adding a field at the Java level or by 46.48 // introducing a new VM klass (see comment in ClassFileParser) 46.49 - oop java_class = instanceKlass::cast(SystemDictionary::class_klass())->allocate_permanent_instance(CHECK_0); 46.50 + oop java_class = instanceKlass::cast(SystemDictionary::Class_klass())->allocate_permanent_instance(CHECK_0); 46.51 if (type != T_VOID) { 46.52 klassOop aklass = Universe::typeArrayKlassObj(type); 46.53 assert(aklass != NULL, "correct bootstrap"); 46.54 @@ -502,7 +502,7 @@ 46.55 46.56 oop java_lang_Class::primitive_mirror(BasicType t) { 46.57 oop mirror = Universe::java_mirror(t); 46.58 - assert(mirror != NULL && mirror->is_a(SystemDictionary::class_klass()), "must be a Class"); 46.59 + assert(mirror != NULL && mirror->is_a(SystemDictionary::Class_klass()), "must be a Class"); 46.60 assert(java_lang_Class::is_primitive(mirror), "must be primitive"); 46.61 return mirror; 46.62 } 46.63 @@ -515,14 +515,14 @@ 46.64 assert(!offsets_computed, "offsets should be initialized only once"); 46.65 offsets_computed = true; 46.66 46.67 - klassOop k = SystemDictionary::class_klass(); 46.68 + klassOop k = SystemDictionary::Class_klass(); 46.69 // The classRedefinedCount field is only present starting in 1.5, 46.70 // so don't go fatal. 46.71 compute_optional_offset(classRedefinedCount_offset, 46.72 k, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature()); 46.73 46.74 // The field indicating parallelCapable (parallelLockMap) is only present starting in 7, 46.75 - klassOop k1 = SystemDictionary::classloader_klass(); 46.76 + klassOop k1 = SystemDictionary::ClassLoader_klass(); 46.77 compute_optional_offset(parallelCapable_offset, 46.78 k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature()); 46.79 } 46.80 @@ -588,7 +588,7 @@ 46.81 void java_lang_Thread::compute_offsets() { 46.82 assert(_group_offset == 0, "offsets should be initialized only once"); 46.83 46.84 - klassOop k = SystemDictionary::thread_klass(); 46.85 + klassOop k = SystemDictionary::Thread_klass(); 46.86 compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::char_array_signature()); 46.87 compute_offset(_group_offset, k, vmSymbols::group_name(), vmSymbols::threadgroup_signature()); 46.88 compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature()); 46.89 @@ -847,7 +847,7 @@ 46.90 void java_lang_ThreadGroup::compute_offsets() { 46.91 assert(_parent_offset == 0, "offsets should be initialized only once"); 46.92 46.93 - klassOop k = SystemDictionary::threadGroup_klass(); 46.94 + klassOop k = SystemDictionary::ThreadGroup_klass(); 46.95 46.96 compute_offset(_parent_offset, k, vmSymbols::parent_name(), vmSymbols::threadgroup_signature()); 46.97 compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); 46.98 @@ -1344,7 +1344,7 @@ 46.99 // No-op if stack trace is disabled 46.100 if (!StackTraceInThrowable) return; 46.101 46.102 - assert(throwable->is_a(SystemDictionary::throwable_klass()), "sanity check"); 46.103 + assert(throwable->is_a(SystemDictionary::Throwable_klass()), "sanity check"); 46.104 46.105 oop backtrace = java_lang_Throwable::backtrace(throwable()); 46.106 assert(backtrace != NULL, "backtrace not preallocated"); 46.107 @@ -1449,7 +1449,7 @@ 46.108 assert(JDK_Version::is_gte_jdk14x_version(), "should only be called in >= 1.4"); 46.109 46.110 // Allocate java.lang.StackTraceElement instance 46.111 - klassOop k = SystemDictionary::stackTraceElement_klass(); 46.112 + klassOop k = SystemDictionary::StackTraceElement_klass(); 46.113 assert(k != NULL, "must be loaded in 1.4+"); 46.114 instanceKlassHandle ik (THREAD, k); 46.115 if (ik->should_be_initialized()) { 46.116 @@ -1487,7 +1487,7 @@ 46.117 46.118 46.119 void java_lang_reflect_AccessibleObject::compute_offsets() { 46.120 - klassOop k = SystemDictionary::reflect_accessible_object_klass(); 46.121 + klassOop k = SystemDictionary::reflect_AccessibleObject_klass(); 46.122 compute_offset(override_offset, k, vmSymbols::override_name(), vmSymbols::bool_signature()); 46.123 } 46.124 46.125 @@ -1502,7 +1502,7 @@ 46.126 } 46.127 46.128 void java_lang_reflect_Method::compute_offsets() { 46.129 - klassOop k = SystemDictionary::reflect_method_klass(); 46.130 + klassOop k = SystemDictionary::reflect_Method_klass(); 46.131 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature()); 46.132 compute_offset(name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); 46.133 compute_offset(returnType_offset, k, vmSymbols::returnType_name(), vmSymbols::class_signature()); 46.134 @@ -1523,7 +1523,7 @@ 46.135 46.136 Handle java_lang_reflect_Method::create(TRAPS) { 46.137 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); 46.138 - klassOop klass = SystemDictionary::reflect_method_klass(); 46.139 + klassOop klass = SystemDictionary::reflect_Method_klass(); 46.140 // This class is eagerly initialized during VM initialization, since we keep a refence 46.141 // to one of the methods 46.142 assert(instanceKlass::cast(klass)->is_initialized(), "must be initialized"); 46.143 @@ -1665,7 +1665,7 @@ 46.144 } 46.145 46.146 void java_lang_reflect_Constructor::compute_offsets() { 46.147 - klassOop k = SystemDictionary::reflect_constructor_klass(); 46.148 + klassOop k = SystemDictionary::reflect_Constructor_klass(); 46.149 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature()); 46.150 compute_offset(parameterTypes_offset, k, vmSymbols::parameterTypes_name(), vmSymbols::class_array_signature()); 46.151 compute_offset(exceptionTypes_offset, k, vmSymbols::exceptionTypes_name(), vmSymbols::class_array_signature()); 46.152 @@ -1789,7 +1789,7 @@ 46.153 } 46.154 46.155 void java_lang_reflect_Field::compute_offsets() { 46.156 - klassOop k = SystemDictionary::reflect_field_klass(); 46.157 + klassOop k = SystemDictionary::reflect_Field_klass(); 46.158 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature()); 46.159 compute_offset(name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); 46.160 compute_offset(type_offset, k, vmSymbols::type_name(), vmSymbols::class_signature()); 46.161 @@ -1896,7 +1896,7 @@ 46.162 46.163 46.164 void sun_reflect_ConstantPool::compute_offsets() { 46.165 - klassOop k = SystemDictionary::reflect_constant_pool_klass(); 46.166 + klassOop k = SystemDictionary::reflect_ConstantPool_klass(); 46.167 // This null test can be removed post beta 46.168 if (k != NULL) { 46.169 compute_offset(_cp_oop_offset, k, vmSymbols::constantPoolOop_name(), vmSymbols::object_signature()); 46.170 @@ -1906,7 +1906,7 @@ 46.171 46.172 Handle sun_reflect_ConstantPool::create(TRAPS) { 46.173 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); 46.174 - klassOop k = SystemDictionary::reflect_constant_pool_klass(); 46.175 + klassOop k = SystemDictionary::reflect_ConstantPool_klass(); 46.176 instanceKlassHandle klass (THREAD, k); 46.177 // Ensure it is initialized 46.178 klass->initialize(CHECK_NH); 46.179 @@ -1926,7 +1926,7 @@ 46.180 } 46.181 46.182 void sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() { 46.183 - klassOop k = SystemDictionary::reflect_unsafe_static_field_accessor_impl_klass(); 46.184 + klassOop k = SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(); 46.185 // This null test can be removed post beta 46.186 if (k != NULL) { 46.187 compute_offset(_base_offset, k, 46.188 @@ -2072,7 +2072,7 @@ 46.189 46.190 // Support for java_lang_ref_Reference 46.191 oop java_lang_ref_Reference::pending_list_lock() { 46.192 - instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass()); 46.193 + instanceKlass* ik = instanceKlass::cast(SystemDictionary::Reference_klass()); 46.194 char *addr = (((char *)ik->start_of_static_fields()) + static_lock_offset); 46.195 if (UseCompressedOops) { 46.196 return oopDesc::load_decode_heap_oop((narrowOop *)addr); 46.197 @@ -2082,7 +2082,7 @@ 46.198 } 46.199 46.200 HeapWord *java_lang_ref_Reference::pending_list_addr() { 46.201 - instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass()); 46.202 + instanceKlass* ik = instanceKlass::cast(SystemDictionary::Reference_klass()); 46.203 char *addr = (((char *)ik->start_of_static_fields()) + static_pending_offset); 46.204 // XXX This might not be HeapWord aligned, almost rather be char *. 46.205 return (HeapWord*)addr; 46.206 @@ -2105,17 +2105,17 @@ 46.207 } 46.208 46.209 jlong java_lang_ref_SoftReference::clock() { 46.210 - instanceKlass* ik = instanceKlass::cast(SystemDictionary::soft_reference_klass()); 46.211 + instanceKlass* ik = instanceKlass::cast(SystemDictionary::SoftReference_klass()); 46.212 int offset = ik->offset_of_static_fields() + static_clock_offset; 46.213 46.214 - return SystemDictionary::soft_reference_klass()->long_field(offset); 46.215 + return SystemDictionary::SoftReference_klass()->long_field(offset); 46.216 } 46.217 46.218 void java_lang_ref_SoftReference::set_clock(jlong value) { 46.219 - instanceKlass* ik = instanceKlass::cast(SystemDictionary::soft_reference_klass()); 46.220 + instanceKlass* ik = instanceKlass::cast(SystemDictionary::SoftReference_klass()); 46.221 int offset = ik->offset_of_static_fields() + static_clock_offset; 46.222 46.223 - SystemDictionary::soft_reference_klass()->long_field_put(offset, value); 46.224 + SystemDictionary::SoftReference_klass()->long_field_put(offset, value); 46.225 } 46.226 46.227 46.228 @@ -2403,6 +2403,10 @@ 46.229 return ptypes(mt)->obj_at(idx); 46.230 } 46.231 46.232 +int java_dyn_MethodType::ptype_count(oop mt) { 46.233 + return ptypes(mt)->length(); 46.234 +} 46.235 + 46.236 46.237 46.238 // Support for java_dyn_MethodTypeForm 46.239 @@ -2534,7 +2538,7 @@ 46.240 // the generated bytecodes for reflection, and if so, "magically" 46.241 // delegate to its parent to prevent class loading from occurring 46.242 // in places where applications using reflection didn't expect it. 46.243 - klassOop delegating_cl_class = SystemDictionary::reflect_delegating_classloader_klass(); 46.244 + klassOop delegating_cl_class = SystemDictionary::reflect_DelegatingClassLoader_klass(); 46.245 // This might be null in non-1.4 JDKs 46.246 if (delegating_cl_class != NULL && loader->is_a(delegating_cl_class)) { 46.247 return parent(loader); 46.248 @@ -2549,7 +2553,7 @@ 46.249 void java_lang_System::compute_offsets() { 46.250 assert(offset_of_static_fields == 0, "offsets should be initialized only once"); 46.251 46.252 - instanceKlass* ik = instanceKlass::cast(SystemDictionary::system_klass()); 46.253 + instanceKlass* ik = instanceKlass::cast(SystemDictionary::System_klass()); 46.254 offset_of_static_fields = ik->offset_of_static_fields(); 46.255 } 46.256
47.1 --- a/src/share/vm/classfile/javaClasses.hpp Wed Dec 23 03:12:16 2009 -0800 47.2 +++ b/src/share/vm/classfile/javaClasses.hpp Wed Jan 06 22:21:39 2010 -0800 47.3 @@ -111,7 +111,7 @@ 47.4 47.5 // Testers 47.6 static bool is_instance(oop obj) { 47.7 - return obj != NULL && obj->klass() == SystemDictionary::string_klass(); 47.8 + return obj != NULL && obj->klass() == SystemDictionary::String_klass(); 47.9 } 47.10 47.11 // Debugging 47.12 @@ -161,7 +161,7 @@ 47.13 static void print_signature(oop java_class, outputStream *st); 47.14 // Testing 47.15 static bool is_instance(oop obj) { 47.16 - return obj != NULL && obj->klass() == SystemDictionary::class_klass(); 47.17 + return obj != NULL && obj->klass() == SystemDictionary::Class_klass(); 47.18 } 47.19 static bool is_primitive(oop java_class); 47.20 static BasicType primitive_type(oop java_class); 47.21 @@ -1027,6 +1027,7 @@ 47.22 static oop form(oop mt); 47.23 47.24 static oop ptype(oop mt, int index); 47.25 + static int ptype_count(oop mt); 47.26 47.27 static symbolOop as_signature(oop mt, bool intern_if_not_found, TRAPS); 47.28 static void print_signature(oop mt, outputStream* st); 47.29 @@ -1083,6 +1084,14 @@ 47.30 static oop vmmethod(oop site); 47.31 static void set_vmmethod(oop site, oop ref); 47.32 47.33 + // Testers 47.34 + static bool is_subclass(klassOop klass) { 47.35 + return Klass::cast(klass)->is_subclass_of(SystemDictionary::CallSite_klass()); 47.36 + } 47.37 + static bool is_instance(oop obj) { 47.38 + return obj != NULL && is_subclass(obj->klass()); 47.39 + } 47.40 + 47.41 // Accessors for code generation: 47.42 static int target_offset_in_bytes() { return _target_offset; } 47.43 static int type_offset_in_bytes() { return _type_offset; }
48.1 --- a/src/share/vm/classfile/systemDictionary.cpp Wed Dec 23 03:12:16 2009 -0800 48.2 +++ b/src/share/vm/classfile/systemDictionary.cpp Wed Jan 06 22:21:39 2010 -0800 48.3 @@ -60,10 +60,10 @@ 48.4 } 48.5 48.6 void SystemDictionary::compute_java_system_loader(TRAPS) { 48.7 - KlassHandle system_klass(THREAD, WK_KLASS(classloader_klass)); 48.8 + KlassHandle system_klass(THREAD, WK_KLASS(ClassLoader_klass)); 48.9 JavaValue result(T_OBJECT); 48.10 JavaCalls::call_static(&result, 48.11 - KlassHandle(THREAD, WK_KLASS(classloader_klass)), 48.12 + KlassHandle(THREAD, WK_KLASS(ClassLoader_klass)), 48.13 vmSymbolHandles::getSystemClassLoader_name(), 48.14 vmSymbolHandles::void_classloader_signature(), 48.15 CHECK); 48.16 @@ -128,7 +128,7 @@ 48.17 // in which case we have to check whether the pending exception is a ClassNotFoundException, 48.18 // and if so convert it to a NoClassDefFoundError 48.19 // And chain the original ClassNotFoundException 48.20 - if (throw_error && PENDING_EXCEPTION->is_a(SystemDictionary::classNotFoundException_klass())) { 48.21 + if (throw_error && PENDING_EXCEPTION->is_a(SystemDictionary::ClassNotFoundException_klass())) { 48.22 ResourceMark rm(THREAD); 48.23 assert(klass_h() == NULL, "Should not have result with exception pending"); 48.24 Handle e(THREAD, PENDING_EXCEPTION); 48.25 @@ -359,7 +359,7 @@ 48.26 48.27 assert(class_loader() != NULL, "should not have non-null protection domain for null classloader"); 48.28 48.29 - KlassHandle system_loader(THREAD, SystemDictionary::classloader_klass()); 48.30 + KlassHandle system_loader(THREAD, SystemDictionary::ClassLoader_klass()); 48.31 JavaCalls::call_special(&result, 48.32 class_loader, 48.33 system_loader, 48.34 @@ -743,7 +743,7 @@ 48.35 // Bootstrap goes through here to allow for an extra guarantee check 48.36 if (UnsyncloadClass || (class_loader.is_null())) { 48.37 if (k.is_null() && HAS_PENDING_EXCEPTION 48.38 - && PENDING_EXCEPTION->is_a(SystemDictionary::linkageError_klass())) { 48.39 + && PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) { 48.40 MutexLocker mu(SystemDictionary_lock, THREAD); 48.41 klassOop check = find_class(d_index, d_hash, name, class_loader); 48.42 if (check != NULL) { 48.43 @@ -1367,7 +1367,7 @@ 48.44 48.45 JavaValue result(T_OBJECT); 48.46 48.47 - KlassHandle spec_klass (THREAD, SystemDictionary::classloader_klass()); 48.48 + KlassHandle spec_klass (THREAD, SystemDictionary::ClassLoader_klass()); 48.49 48.50 // Call public unsynchronized loadClass(String) directly for all class loaders 48.51 // for parallelCapable class loaders. JDK >=7, loadClass(String, boolean) will 48.52 @@ -1944,13 +1944,13 @@ 48.53 48.54 48.55 void SystemDictionary::initialize_preloaded_classes(TRAPS) { 48.56 - assert(WK_KLASS(object_klass) == NULL, "preloaded classes should only be initialized once"); 48.57 + assert(WK_KLASS(Object_klass) == NULL, "preloaded classes should only be initialized once"); 48.58 // Preload commonly used klasses 48.59 WKID scan = FIRST_WKID; 48.60 // first do Object, String, Class 48.61 - initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(class_klass), scan, CHECK); 48.62 + initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK); 48.63 48.64 - debug_only(instanceKlass::verify_class_klass_nonstatic_oop_maps(WK_KLASS(class_klass))); 48.65 + debug_only(instanceKlass::verify_class_klass_nonstatic_oop_maps(WK_KLASS(Class_klass))); 48.66 48.67 // Fixup mirrors for classes loaded before java.lang.Class. 48.68 // These calls iterate over the objects currently in the perm gen 48.69 @@ -1961,17 +1961,17 @@ 48.70 Universe::fixup_mirrors(CHECK); 48.71 48.72 // do a bunch more: 48.73 - initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(reference_klass), scan, CHECK); 48.74 + initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Reference_klass), scan, CHECK); 48.75 48.76 // Preload ref klasses and set reference types 48.77 - instanceKlass::cast(WK_KLASS(reference_klass))->set_reference_type(REF_OTHER); 48.78 - instanceRefKlass::update_nonstatic_oop_maps(WK_KLASS(reference_klass)); 48.79 + instanceKlass::cast(WK_KLASS(Reference_klass))->set_reference_type(REF_OTHER); 48.80 + instanceRefKlass::update_nonstatic_oop_maps(WK_KLASS(Reference_klass)); 48.81 48.82 - initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(phantom_reference_klass), scan, CHECK); 48.83 - instanceKlass::cast(WK_KLASS(soft_reference_klass))->set_reference_type(REF_SOFT); 48.84 - instanceKlass::cast(WK_KLASS(weak_reference_klass))->set_reference_type(REF_WEAK); 48.85 - instanceKlass::cast(WK_KLASS(final_reference_klass))->set_reference_type(REF_FINAL); 48.86 - instanceKlass::cast(WK_KLASS(phantom_reference_klass))->set_reference_type(REF_PHANTOM); 48.87 + initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(PhantomReference_klass), scan, CHECK); 48.88 + instanceKlass::cast(WK_KLASS(SoftReference_klass))->set_reference_type(REF_SOFT); 48.89 + instanceKlass::cast(WK_KLASS(WeakReference_klass))->set_reference_type(REF_WEAK); 48.90 + instanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL); 48.91 + instanceKlass::cast(WK_KLASS(PhantomReference_klass))->set_reference_type(REF_PHANTOM); 48.92 48.93 WKID meth_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass); 48.94 WKID meth_group_end = WK_KLASS_ENUM_NAME(WrongMethodTypeException_klass); 48.95 @@ -1984,7 +1984,7 @@ 48.96 scan = WKID(meth_group_end+1); 48.97 } 48.98 WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass); 48.99 - WKID indy_group_end = WK_KLASS_ENUM_NAME(Dynamic_klass); 48.100 + WKID indy_group_end = WK_KLASS_ENUM_NAME(InvokeDynamic_klass); 48.101 initialize_wk_klasses_until(indy_group_start, scan, CHECK); 48.102 if (EnableInvokeDynamic) { 48.103 initialize_wk_klasses_through(indy_group_end, scan, CHECK); 48.104 @@ -1996,14 +1996,14 @@ 48.105 48.106 initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK); 48.107 48.108 - _box_klasses[T_BOOLEAN] = WK_KLASS(boolean_klass); 48.109 - _box_klasses[T_CHAR] = WK_KLASS(char_klass); 48.110 - _box_klasses[T_FLOAT] = WK_KLASS(float_klass); 48.111 - _box_klasses[T_DOUBLE] = WK_KLASS(double_klass); 48.112 - _box_klasses[T_BYTE] = WK_KLASS(byte_klass); 48.113 - _box_klasses[T_SHORT] = WK_KLASS(short_klass); 48.114 - _box_klasses[T_INT] = WK_KLASS(int_klass); 48.115 - _box_klasses[T_LONG] = WK_KLASS(long_klass); 48.116 + _box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass); 48.117 + _box_klasses[T_CHAR] = WK_KLASS(Character_klass); 48.118 + _box_klasses[T_FLOAT] = WK_KLASS(Float_klass); 48.119 + _box_klasses[T_DOUBLE] = WK_KLASS(Double_klass); 48.120 + _box_klasses[T_BYTE] = WK_KLASS(Byte_klass); 48.121 + _box_klasses[T_SHORT] = WK_KLASS(Short_klass); 48.122 + _box_klasses[T_INT] = WK_KLASS(Integer_klass); 48.123 + _box_klasses[T_LONG] = WK_KLASS(Long_klass); 48.124 //_box_klasses[T_OBJECT] = WK_KLASS(object_klass); 48.125 //_box_klasses[T_ARRAY] = WK_KLASS(object_klass); 48.126 48.127 @@ -2014,11 +2014,11 @@ 48.128 #endif // KERNEL 48.129 48.130 { // Compute whether we should use loadClass or loadClassInternal when loading classes. 48.131 - methodOop method = instanceKlass::cast(classloader_klass())->find_method(vmSymbols::loadClassInternal_name(), vmSymbols::string_class_signature()); 48.132 + methodOop method = instanceKlass::cast(ClassLoader_klass())->find_method(vmSymbols::loadClassInternal_name(), vmSymbols::string_class_signature()); 48.133 _has_loadClassInternal = (method != NULL); 48.134 } 48.135 { // Compute whether we should use checkPackageAccess or NOT 48.136 - methodOop method = instanceKlass::cast(classloader_klass())->find_method(vmSymbols::checkPackageAccess_name(), vmSymbols::class_protectiondomain_signature()); 48.137 + methodOop method = instanceKlass::cast(ClassLoader_klass())->find_method(vmSymbols::checkPackageAccess_name(), vmSymbols::class_protectiondomain_signature()); 48.138 _has_checkPackageAccess = (method != NULL); 48.139 } 48.140 } 48.141 @@ -2340,6 +2340,8 @@ 48.142 SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature); 48.143 if (spe == NULL || spe->property_oop() == NULL) { 48.144 // Must create lots of stuff here, but outside of the SystemDictionary lock. 48.145 + if (THREAD->is_Compiler_thread()) 48.146 + return NULL; // do not attempt from within compiler 48.147 Handle mt = compute_method_handle_type(signature(), 48.148 class_loader, protection_domain, 48.149 CHECK_NULL); 48.150 @@ -2372,7 +2374,7 @@ 48.151 TRAPS) { 48.152 Handle empty; 48.153 int npts = ArgumentCount(signature()).size(); 48.154 - objArrayHandle pts = oopFactory::new_objArray(SystemDictionary::class_klass(), npts, CHECK_(empty)); 48.155 + objArrayHandle pts = oopFactory::new_objArray(SystemDictionary::Class_klass(), npts, CHECK_(empty)); 48.156 int arg = 0; 48.157 Handle rt; // the return type from the signature 48.158 for (SignatureStream ss(signature()); !ss.is_done(); ss.next()) {
49.1 --- a/src/share/vm/classfile/systemDictionary.hpp Wed Dec 23 03:12:16 2009 -0800 49.2 +++ b/src/share/vm/classfile/systemDictionary.hpp Wed Jan 06 22:21:39 2010 -0800 49.3 @@ -82,55 +82,55 @@ 49.4 49.5 #define WK_KLASSES_DO(template) \ 49.6 /* well-known classes */ \ 49.7 - template(object_klass, java_lang_Object, Pre) \ 49.8 - template(string_klass, java_lang_String, Pre) \ 49.9 - template(class_klass, java_lang_Class, Pre) \ 49.10 - template(cloneable_klass, java_lang_Cloneable, Pre) \ 49.11 - template(classloader_klass, java_lang_ClassLoader, Pre) \ 49.12 - template(serializable_klass, java_io_Serializable, Pre) \ 49.13 - template(system_klass, java_lang_System, Pre) \ 49.14 - template(throwable_klass, java_lang_Throwable, Pre) \ 49.15 - template(error_klass, java_lang_Error, Pre) \ 49.16 - template(threaddeath_klass, java_lang_ThreadDeath, Pre) \ 49.17 - template(exception_klass, java_lang_Exception, Pre) \ 49.18 - template(runtime_exception_klass, java_lang_RuntimeException, Pre) \ 49.19 - template(protectionDomain_klass, java_security_ProtectionDomain, Pre) \ 49.20 + template(Object_klass, java_lang_Object, Pre) \ 49.21 + template(String_klass, java_lang_String, Pre) \ 49.22 + template(Class_klass, java_lang_Class, Pre) \ 49.23 + template(Cloneable_klass, java_lang_Cloneable, Pre) \ 49.24 + template(ClassLoader_klass, java_lang_ClassLoader, Pre) \ 49.25 + template(Serializable_klass, java_io_Serializable, Pre) \ 49.26 + template(System_klass, java_lang_System, Pre) \ 49.27 + template(Throwable_klass, java_lang_Throwable, Pre) \ 49.28 + template(Error_klass, java_lang_Error, Pre) \ 49.29 + template(ThreadDeath_klass, java_lang_ThreadDeath, Pre) \ 49.30 + template(Exception_klass, java_lang_Exception, Pre) \ 49.31 + template(RuntimeException_klass, java_lang_RuntimeException, Pre) \ 49.32 + template(ProtectionDomain_klass, java_security_ProtectionDomain, Pre) \ 49.33 template(AccessControlContext_klass, java_security_AccessControlContext, Pre) \ 49.34 - template(classNotFoundException_klass, java_lang_ClassNotFoundException, Pre) \ 49.35 - template(noClassDefFoundError_klass, java_lang_NoClassDefFoundError, Pre) \ 49.36 - template(linkageError_klass, java_lang_LinkageError, Pre) \ 49.37 + template(ClassNotFoundException_klass, java_lang_ClassNotFoundException, Pre) \ 49.38 + template(NoClassDefFoundError_klass, java_lang_NoClassDefFoundError, Pre) \ 49.39 + template(LinkageError_klass, java_lang_LinkageError, Pre) \ 49.40 template(ClassCastException_klass, java_lang_ClassCastException, Pre) \ 49.41 template(ArrayStoreException_klass, java_lang_ArrayStoreException, Pre) \ 49.42 - template(virtualMachineError_klass, java_lang_VirtualMachineError, Pre) \ 49.43 + template(VirtualMachineError_klass, java_lang_VirtualMachineError, Pre) \ 49.44 template(OutOfMemoryError_klass, java_lang_OutOfMemoryError, Pre) \ 49.45 template(StackOverflowError_klass, java_lang_StackOverflowError, Pre) \ 49.46 template(IllegalMonitorStateException_klass, java_lang_IllegalMonitorStateException, Pre) \ 49.47 - template(reference_klass, java_lang_ref_Reference, Pre) \ 49.48 + template(Reference_klass, java_lang_ref_Reference, Pre) \ 49.49 \ 49.50 /* Preload ref klasses and set reference types */ \ 49.51 - template(soft_reference_klass, java_lang_ref_SoftReference, Pre) \ 49.52 - template(weak_reference_klass, java_lang_ref_WeakReference, Pre) \ 49.53 - template(final_reference_klass, java_lang_ref_FinalReference, Pre) \ 49.54 - template(phantom_reference_klass, java_lang_ref_PhantomReference, Pre) \ 49.55 - template(finalizer_klass, java_lang_ref_Finalizer, Pre) \ 49.56 + template(SoftReference_klass, java_lang_ref_SoftReference, Pre) \ 49.57 + template(WeakReference_klass, java_lang_ref_WeakReference, Pre) \ 49.58 + template(FinalReference_klass, java_lang_ref_FinalReference, Pre) \ 49.59 + template(PhantomReference_klass, java_lang_ref_PhantomReference, Pre) \ 49.60 + template(Finalizer_klass, java_lang_ref_Finalizer, Pre) \ 49.61 \ 49.62 - template(thread_klass, java_lang_Thread, Pre) \ 49.63 - template(threadGroup_klass, java_lang_ThreadGroup, Pre) \ 49.64 - template(properties_klass, java_util_Properties, Pre) \ 49.65 - template(reflect_accessible_object_klass, java_lang_reflect_AccessibleObject, Pre) \ 49.66 - template(reflect_field_klass, java_lang_reflect_Field, Pre) \ 49.67 - template(reflect_method_klass, java_lang_reflect_Method, Pre) \ 49.68 - template(reflect_constructor_klass, java_lang_reflect_Constructor, Pre) \ 49.69 + template(Thread_klass, java_lang_Thread, Pre) \ 49.70 + template(ThreadGroup_klass, java_lang_ThreadGroup, Pre) \ 49.71 + template(Properties_klass, java_util_Properties, Pre) \ 49.72 + template(reflect_AccessibleObject_klass, java_lang_reflect_AccessibleObject, Pre) \ 49.73 + template(reflect_Field_klass, java_lang_reflect_Field, Pre) \ 49.74 + template(reflect_Method_klass, java_lang_reflect_Method, Pre) \ 49.75 + template(reflect_Constructor_klass, java_lang_reflect_Constructor, Pre) \ 49.76 \ 49.77 /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */ \ 49.78 /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \ 49.79 /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ 49.80 - template(reflect_magic_klass, sun_reflect_MagicAccessorImpl, Opt) \ 49.81 - template(reflect_method_accessor_klass, sun_reflect_MethodAccessorImpl, Opt_Only_JDK14NewRef) \ 49.82 - template(reflect_constructor_accessor_klass, sun_reflect_ConstructorAccessorImpl, Opt_Only_JDK14NewRef) \ 49.83 - template(reflect_delegating_classloader_klass, sun_reflect_DelegatingClassLoader, Opt) \ 49.84 - template(reflect_constant_pool_klass, sun_reflect_ConstantPool, Opt_Only_JDK15) \ 49.85 - template(reflect_unsafe_static_field_accessor_impl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt_Only_JDK15) \ 49.86 + template(reflect_MagicAccessorImpl_klass, sun_reflect_MagicAccessorImpl, Opt) \ 49.87 + template(reflect_MethodAccessorImpl_klass, sun_reflect_MethodAccessorImpl, Opt_Only_JDK14NewRef) \ 49.88 + template(reflect_ConstructorAccessorImpl_klass, sun_reflect_ConstructorAccessorImpl, Opt_Only_JDK14NewRef) \ 49.89 + template(reflect_DelegatingClassLoader_klass, sun_reflect_DelegatingClassLoader, Opt) \ 49.90 + template(reflect_ConstantPool_klass, sun_reflect_ConstantPool, Opt_Only_JDK15) \ 49.91 + template(reflect_UnsafeStaticFieldAccessorImpl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt_Only_JDK15) \ 49.92 \ 49.93 /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \ 49.94 template(MethodHandle_klass, java_dyn_MethodHandle, Opt) \ 49.95 @@ -144,16 +144,14 @@ 49.96 template(WrongMethodTypeException_klass, java_dyn_WrongMethodTypeException, Opt) \ 49.97 template(Linkage_klass, java_dyn_Linkage, Opt) \ 49.98 template(CallSite_klass, java_dyn_CallSite, Opt) \ 49.99 - template(Dynamic_klass, java_dyn_Dynamic, Opt) \ 49.100 + template(InvokeDynamic_klass, java_dyn_InvokeDynamic, Opt) \ 49.101 /* Note: MethodHandle must be first, and Dynamic last in group */ \ 49.102 \ 49.103 - template(vector_klass, java_util_Vector, Pre) \ 49.104 - template(hashtable_klass, java_util_Hashtable, Pre) \ 49.105 - template(stringBuffer_klass, java_lang_StringBuffer, Pre) \ 49.106 + template(StringBuffer_klass, java_lang_StringBuffer, Pre) \ 49.107 template(StringBuilder_klass, java_lang_StringBuilder, Pre) \ 49.108 \ 49.109 /* It's NULL in non-1.4 JDKs. */ \ 49.110 - template(stackTraceElement_klass, java_lang_StackTraceElement, Opt) \ 49.111 + template(StackTraceElement_klass, java_lang_StackTraceElement, Opt) \ 49.112 /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \ 49.113 /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ 49.114 template(java_nio_Buffer_klass, java_nio_Buffer, Opt) \ 49.115 @@ -164,14 +162,14 @@ 49.116 template(sun_jkernel_DownloadManager_klass, sun_jkernel_DownloadManager, Opt_Kernel) \ 49.117 \ 49.118 /* Preload boxing klasses */ \ 49.119 - template(boolean_klass, java_lang_Boolean, Pre) \ 49.120 - template(char_klass, java_lang_Character, Pre) \ 49.121 - template(float_klass, java_lang_Float, Pre) \ 49.122 - template(double_klass, java_lang_Double, Pre) \ 49.123 - template(byte_klass, java_lang_Byte, Pre) \ 49.124 - template(short_klass, java_lang_Short, Pre) \ 49.125 - template(int_klass, java_lang_Integer, Pre) \ 49.126 - template(long_klass, java_lang_Long, Pre) \ 49.127 + template(Boolean_klass, java_lang_Boolean, Pre) \ 49.128 + template(Character_klass, java_lang_Character, Pre) \ 49.129 + template(Float_klass, java_lang_Float, Pre) \ 49.130 + template(Double_klass, java_lang_Double, Pre) \ 49.131 + template(Byte_klass, java_lang_Byte, Pre) \ 49.132 + template(Short_klass, java_lang_Short, Pre) \ 49.133 + template(Integer_klass, java_lang_Integer, Pre) \ 49.134 + template(Long_klass, java_lang_Long, Pre) \ 49.135 /*end*/ 49.136 49.137 49.138 @@ -438,8 +436,8 @@ 49.139 // Tells whether ClassLoader.checkPackageAccess is present 49.140 static bool has_checkPackageAccess() { return _has_checkPackageAccess; } 49.141 49.142 - static bool class_klass_loaded() { return WK_KLASS(class_klass) != NULL; } 49.143 - static bool cloneable_klass_loaded() { return WK_KLASS(cloneable_klass) != NULL; } 49.144 + static bool Class_klass_loaded() { return WK_KLASS(Class_klass) != NULL; } 49.145 + static bool Cloneable_klass_loaded() { return WK_KLASS(Cloneable_klass) != NULL; } 49.146 49.147 // Returns default system loader 49.148 static oop java_system_loader();
50.1 --- a/src/share/vm/classfile/verifier.cpp Wed Dec 23 03:12:16 2009 -0800 50.2 +++ b/src/share/vm/classfile/verifier.cpp Wed Jan 06 22:21:39 2010 -0800 50.3 @@ -143,7 +143,7 @@ 50.4 50.5 bool Verifier::is_eligible_for_verification(instanceKlassHandle klass, bool should_verify_class) { 50.6 symbolOop name = klass->name(); 50.7 - klassOop refl_magic_klass = SystemDictionary::reflect_magic_klass(); 50.8 + klassOop refl_magic_klass = SystemDictionary::reflect_MagicAccessorImpl_klass(); 50.9 50.10 return (should_verify_for(klass->class_loader(), should_verify_class) && 50.11 // return if the class is a bootstrapping class
51.1 --- a/src/share/vm/classfile/vmSymbols.cpp Wed Dec 23 03:12:16 2009 -0800 51.2 +++ b/src/share/vm/classfile/vmSymbols.cpp Wed Jan 06 22:21:39 2010 -0800 51.3 @@ -1,5 +1,5 @@ 51.4 /* 51.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 51.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 51.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 51.8 * 51.9 * This code is free software; you can redistribute it and/or modify it 51.10 @@ -70,6 +70,7 @@ 51.11 void vmSymbols::initialize(TRAPS) { 51.12 assert((int)SID_LIMIT <= (1<<log2_SID_LIMIT), "must fit in this bitfield"); 51.13 assert((int)SID_LIMIT*5 > (1<<log2_SID_LIMIT), "make the bitfield smaller, please"); 51.14 + assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield"); 51.15 51.16 if (!UseSharedSpaces) { 51.17 const char* string = &vm_symbol_bodies[0]; 51.18 @@ -271,6 +272,58 @@ 51.19 return sid; 51.20 } 51.21 51.22 +static vmIntrinsics::ID wrapper_intrinsic(BasicType type, bool unboxing) { 51.23 +#define TYPE2(type, unboxing) ((int)(type)*2 + ((unboxing) ? 1 : 0)) 51.24 + switch (TYPE2(type, unboxing)) { 51.25 +#define BASIC_TYPE_CASE(type, box, unbox) \ 51.26 + case TYPE2(type, false): return vmIntrinsics::box; \ 51.27 + case TYPE2(type, true): return vmIntrinsics::unbox 51.28 + BASIC_TYPE_CASE(T_BOOLEAN, _Boolean_valueOf, _booleanValue); 51.29 + BASIC_TYPE_CASE(T_BYTE, _Byte_valueOf, _byteValue); 51.30 + BASIC_TYPE_CASE(T_CHAR, _Character_valueOf, _charValue); 51.31 + BASIC_TYPE_CASE(T_SHORT, _Short_valueOf, _shortValue); 51.32 + BASIC_TYPE_CASE(T_INT, _Integer_valueOf, _intValue); 51.33 + BASIC_TYPE_CASE(T_LONG, _Long_valueOf, _longValue); 51.34 + BASIC_TYPE_CASE(T_FLOAT, _Float_valueOf, _floatValue); 51.35 + BASIC_TYPE_CASE(T_DOUBLE, _Double_valueOf, _doubleValue); 51.36 +#undef BASIC_TYPE_CASE 51.37 + } 51.38 +#undef TYPE2 51.39 + return vmIntrinsics::_none; 51.40 +} 51.41 + 51.42 +vmIntrinsics::ID vmIntrinsics::for_boxing(BasicType type) { 51.43 + return wrapper_intrinsic(type, false); 51.44 +} 51.45 +vmIntrinsics::ID vmIntrinsics::for_unboxing(BasicType type) { 51.46 + return wrapper_intrinsic(type, true); 51.47 +} 51.48 + 51.49 +vmIntrinsics::ID vmIntrinsics::for_raw_conversion(BasicType src, BasicType dest) { 51.50 +#define SRC_DEST(s,d) (((int)(s) << 4) + (int)(d)) 51.51 + switch (SRC_DEST(src, dest)) { 51.52 + case SRC_DEST(T_INT, T_FLOAT): return vmIntrinsics::_intBitsToFloat; 51.53 + case SRC_DEST(T_FLOAT, T_INT): return vmIntrinsics::_floatToRawIntBits; 51.54 + 51.55 + case SRC_DEST(T_LONG, T_DOUBLE): return vmIntrinsics::_longBitsToDouble; 51.56 + case SRC_DEST(T_DOUBLE, T_LONG): return vmIntrinsics::_doubleToRawLongBits; 51.57 + } 51.58 +#undef SRC_DEST 51.59 + 51.60 + return vmIntrinsics::_none; 51.61 +} 51.62 + 51.63 +methodOop vmIntrinsics::method_for(vmIntrinsics::ID id) { 51.64 + if (id == _none) return NULL; 51.65 + symbolOop cname = vmSymbols::symbol_at(class_for(id)); 51.66 + symbolOop mname = vmSymbols::symbol_at(name_for(id)); 51.67 + symbolOop msig = vmSymbols::symbol_at(signature_for(id)); 51.68 + if (cname == NULL || mname == NULL || msig == NULL) return NULL; 51.69 + klassOop k = SystemDictionary::find_well_known_klass(cname); 51.70 + if (k == NULL) return NULL; 51.71 + return instanceKlass::cast(k)->find_method(mname, msig); 51.72 +} 51.73 + 51.74 51.75 #define VM_INTRINSIC_INITIALIZE(id, klass, name, sig, flags) #id "\0" 51.76 static const char* vm_intrinsic_name_bodies = 51.77 @@ -330,15 +383,15 @@ 51.78 } 51.79 51.80 // These are for forming case labels: 51.81 -#define ID3(x, y, z) (( jint)(z) + \ 51.82 - ((jint)(y) << vmSymbols::log2_SID_LIMIT) + \ 51.83 - ((jint)(x) << (2*vmSymbols::log2_SID_LIMIT)) ) 51.84 +#define ID3(x, y, z) (( jlong)(z) + \ 51.85 + ((jlong)(y) << vmSymbols::log2_SID_LIMIT) + \ 51.86 + ((jlong)(x) << (2*vmSymbols::log2_SID_LIMIT)) ) 51.87 #define SID_ENUM(n) vmSymbols::VM_SYMBOL_ENUM_NAME(n) 51.88 51.89 -vmIntrinsics::ID vmIntrinsics::find_id(vmSymbols::SID holder, 51.90 - vmSymbols::SID name, 51.91 - vmSymbols::SID sig, 51.92 - jshort flags) { 51.93 +vmIntrinsics::ID vmIntrinsics::find_id_impl(vmSymbols::SID holder, 51.94 + vmSymbols::SID name, 51.95 + vmSymbols::SID sig, 51.96 + jshort flags) { 51.97 assert((int)vmSymbols::SID_LIMIT <= (1<<vmSymbols::log2_SID_LIMIT), "must fit"); 51.98 51.99 // Let the C compiler build the decision tree. 51.100 @@ -383,62 +436,50 @@ 51.101 } 51.102 51.103 51.104 -// These are for friendly printouts of intrinsics: 51.105 +// These are to get information about intrinsics. 51.106 + 51.107 +#define ID4(x, y, z, f) ((ID3(x, y, z) << vmIntrinsics::log2_FLAG_LIMIT) | (jlong) (f)) 51.108 + 51.109 +static const jlong intrinsic_info_array[vmIntrinsics::ID_LIMIT+1] = { 51.110 +#define VM_INTRINSIC_INFO(ignore_id, klass, name, sig, fcode) \ 51.111 + ID4(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig), vmIntrinsics::fcode), 51.112 + 51.113 + 0, VM_INTRINSICS_DO(VM_INTRINSIC_INFO, 51.114 + VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) 51.115 + 0 51.116 +#undef VM_INTRINSIC_INFO 51.117 +}; 51.118 + 51.119 +inline jlong intrinsic_info(vmIntrinsics::ID id) { 51.120 + return intrinsic_info_array[vmIntrinsics::ID_from((int)id)]; 51.121 +} 51.122 51.123 vmSymbols::SID vmIntrinsics::class_for(vmIntrinsics::ID id) { 51.124 -#ifndef PRODUCT 51.125 -#define VM_INTRINSIC_CASE(id, klass, name, sig, fcode) \ 51.126 - case id: return SID_ENUM(klass); 51.127 - 51.128 - switch (id) { 51.129 - VM_INTRINSICS_DO(VM_INTRINSIC_CASE, 51.130 - VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); 51.131 - } 51.132 -#undef VM_INTRINSIC_CASE 51.133 -#endif //PRODUCT 51.134 - return vmSymbols::NO_SID; 51.135 + jlong info = intrinsic_info(id); 51.136 + int shift = 2*vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); 51.137 + assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1021, ""); 51.138 + return vmSymbols::SID( (info >> shift) & mask ); 51.139 } 51.140 51.141 vmSymbols::SID vmIntrinsics::name_for(vmIntrinsics::ID id) { 51.142 -#ifndef PRODUCT 51.143 -#define VM_INTRINSIC_CASE(id, klass, name, sig, fcode) \ 51.144 - case id: return SID_ENUM(name); 51.145 - 51.146 - switch (id) { 51.147 - VM_INTRINSICS_DO(VM_INTRINSIC_CASE, 51.148 - VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); 51.149 - } 51.150 -#undef VM_INTRINSIC_CASE 51.151 -#endif //PRODUCT 51.152 - return vmSymbols::NO_SID; 51.153 + jlong info = intrinsic_info(id); 51.154 + int shift = vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); 51.155 + assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1022, ""); 51.156 + return vmSymbols::SID( (info >> shift) & mask ); 51.157 } 51.158 51.159 vmSymbols::SID vmIntrinsics::signature_for(vmIntrinsics::ID id) { 51.160 -#ifndef PRODUCT 51.161 -#define VM_INTRINSIC_CASE(id, klass, name, sig, fcode) \ 51.162 - case id: return SID_ENUM(sig); 51.163 - 51.164 - switch (id) { 51.165 - VM_INTRINSICS_DO(VM_INTRINSIC_CASE, 51.166 - VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); 51.167 - } 51.168 -#undef VM_INTRINSIC_CASE 51.169 -#endif //PRODUCT 51.170 - return vmSymbols::NO_SID; 51.171 + jlong info = intrinsic_info(id); 51.172 + int shift = log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); 51.173 + assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1023, ""); 51.174 + return vmSymbols::SID( (info >> shift) & mask ); 51.175 } 51.176 51.177 vmIntrinsics::Flags vmIntrinsics::flags_for(vmIntrinsics::ID id) { 51.178 -#ifndef PRODUCT 51.179 -#define VM_INTRINSIC_CASE(id, klass, name, sig, fcode) \ 51.180 - case id: return fcode; 51.181 - 51.182 - switch (id) { 51.183 - VM_INTRINSICS_DO(VM_INTRINSIC_CASE, 51.184 - VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); 51.185 - } 51.186 -#undef VM_INTRINSIC_CASE 51.187 -#endif //PRODUCT 51.188 - return F_none; 51.189 + jlong info = intrinsic_info(id); 51.190 + int shift = 0, mask = right_n_bits(log2_FLAG_LIMIT); 51.191 + assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 15, ""); 51.192 + return Flags( (info >> shift) & mask ); 51.193 } 51.194 51.195
52.1 --- a/src/share/vm/classfile/vmSymbols.hpp Wed Dec 23 03:12:16 2009 -0800 52.2 +++ b/src/share/vm/classfile/vmSymbols.hpp Wed Jan 06 22:21:39 2010 -0800 52.3 @@ -219,7 +219,7 @@ 52.4 template(base_name, "base") \ 52.5 \ 52.6 /* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */ \ 52.7 - template(java_dyn_Dynamic, "java/dyn/Dynamic") \ 52.8 + template(java_dyn_InvokeDynamic, "java/dyn/InvokeDynamic") \ 52.9 template(java_dyn_Linkage, "java/dyn/Linkage") \ 52.10 template(java_dyn_CallSite, "java/dyn/CallSite") \ 52.11 template(java_dyn_MethodHandle, "java/dyn/MethodHandle") \ 52.12 @@ -347,9 +347,14 @@ 52.13 \ 52.14 /* common signatures names */ \ 52.15 template(void_method_signature, "()V") \ 52.16 + template(void_boolean_signature, "()Z") \ 52.17 + template(void_byte_signature, "()B") \ 52.18 + template(void_char_signature, "()C") \ 52.19 + template(void_short_signature, "()S") \ 52.20 template(void_int_signature, "()I") \ 52.21 template(void_long_signature, "()J") \ 52.22 - template(void_boolean_signature, "()Z") \ 52.23 + template(void_float_signature, "()F") \ 52.24 + template(void_double_signature, "()D") \ 52.25 template(int_void_signature, "(I)V") \ 52.26 template(int_int_signature, "(I)I") \ 52.27 template(int_bool_signature, "(I)Z") \ 52.28 @@ -854,6 +859,46 @@ 52.29 \ 52.30 do_intrinsic(_invoke, java_lang_reflect_Method, invoke_name, object_array_object_object_signature, F_R) \ 52.31 /* (symbols invoke_name and invoke_signature defined above) */ \ 52.32 + do_intrinsic(_checkSpreadArgument, sun_dyn_MethodHandleImpl, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) \ 52.33 + do_name( checkSpreadArgument_name, "checkSpreadArgument") \ 52.34 + do_name( checkSpreadArgument_signature, "(Ljava/lang/Object;I)V") \ 52.35 + \ 52.36 + /* unboxing methods: */ \ 52.37 + do_intrinsic(_booleanValue, java_lang_Boolean, booleanValue_name, void_boolean_signature, F_R) \ 52.38 + do_name( booleanValue_name, "booleanValue") \ 52.39 + do_intrinsic(_byteValue, java_lang_Byte, byteValue_name, void_byte_signature, F_R) \ 52.40 + do_name( byteValue_name, "byteValue") \ 52.41 + do_intrinsic(_charValue, java_lang_Character, charValue_name, void_char_signature, F_R) \ 52.42 + do_name( charValue_name, "charValue") \ 52.43 + do_intrinsic(_shortValue, java_lang_Short, shortValue_name, void_short_signature, F_R) \ 52.44 + do_name( shortValue_name, "shortValue") \ 52.45 + do_intrinsic(_intValue, java_lang_Integer, intValue_name, void_int_signature, F_R) \ 52.46 + do_name( intValue_name, "intValue") \ 52.47 + do_intrinsic(_longValue, java_lang_Long, longValue_name, void_long_signature, F_R) \ 52.48 + do_name( longValue_name, "longValue") \ 52.49 + do_intrinsic(_floatValue, java_lang_Float, floatValue_name, void_float_signature, F_R) \ 52.50 + do_name( floatValue_name, "floatValue") \ 52.51 + do_intrinsic(_doubleValue, java_lang_Double, doubleValue_name, void_double_signature, F_R) \ 52.52 + do_name( doubleValue_name, "doubleValue") \ 52.53 + \ 52.54 + /* boxing methods: */ \ 52.55 + do_name( valueOf_name, "valueOf") \ 52.56 + do_intrinsic(_Boolean_valueOf, java_lang_Boolean, valueOf_name, Boolean_valueOf_signature, F_S) \ 52.57 + do_name( Boolean_valueOf_signature, "(Z)Ljava/lang/Boolean;") \ 52.58 + do_intrinsic(_Byte_valueOf, java_lang_Byte, valueOf_name, Byte_valueOf_signature, F_S) \ 52.59 + do_name( Byte_valueOf_signature, "(B)Ljava/lang/Byte;") \ 52.60 + do_intrinsic(_Character_valueOf, java_lang_Character, valueOf_name, Character_valueOf_signature, F_S) \ 52.61 + do_name( Character_valueOf_signature, "(C)Ljava/lang/Character;") \ 52.62 + do_intrinsic(_Short_valueOf, java_lang_Short, valueOf_name, Short_valueOf_signature, F_S) \ 52.63 + do_name( Short_valueOf_signature, "(S)Ljava/lang/Short;") \ 52.64 + do_intrinsic(_Integer_valueOf, java_lang_Integer, valueOf_name, Integer_valueOf_signature, F_S) \ 52.65 + do_name( Integer_valueOf_signature, "(I)Ljava/lang/Integer;") \ 52.66 + do_intrinsic(_Long_valueOf, java_lang_Long, valueOf_name, Long_valueOf_signature, F_S) \ 52.67 + do_name( Long_valueOf_signature, "(J)Ljava/lang/Long;") \ 52.68 + do_intrinsic(_Float_valueOf, java_lang_Float, valueOf_name, Float_valueOf_signature, F_S) \ 52.69 + do_name( Float_valueOf_signature, "(F)Ljava/lang/Float;") \ 52.70 + do_intrinsic(_Double_valueOf, java_lang_Double, valueOf_name, Double_valueOf_signature, F_S) \ 52.71 + do_name( Double_valueOf_signature, "(D)Ljava/lang/Double;") \ 52.72 \ 52.73 /*end*/ 52.74 52.75 @@ -984,7 +1029,12 @@ 52.76 F_Y, // !static ?native synchronized 52.77 F_RN, // !static native !synchronized 52.78 F_SN, // static native !synchronized 52.79 - F_RNY // !static native synchronized 52.80 + F_RNY, // !static native synchronized 52.81 + 52.82 + FLAG_LIMIT 52.83 + }; 52.84 + enum { 52.85 + log2_FLAG_LIMIT = 4 // checked by an assert at start-up 52.86 }; 52.87 52.88 public: 52.89 @@ -996,15 +1046,32 @@ 52.90 52.91 static const char* name_at(ID id); 52.92 52.93 +private: 52.94 + static ID find_id_impl(vmSymbols::SID holder, 52.95 + vmSymbols::SID name, 52.96 + vmSymbols::SID sig, 52.97 + jshort flags); 52.98 + 52.99 +public: 52.100 // Given a method's class, name, signature, and access flags, report its ID. 52.101 static ID find_id(vmSymbols::SID holder, 52.102 vmSymbols::SID name, 52.103 vmSymbols::SID sig, 52.104 - jshort flags); 52.105 + jshort flags) { 52.106 + ID id = find_id_impl(holder, name, sig, flags); 52.107 +#ifdef ASSERT 52.108 + // ID _none does not hold the following asserts. 52.109 + if (id == _none) return id; 52.110 +#endif 52.111 + assert( class_for(id) == holder, "correct id"); 52.112 + assert( name_for(id) == name, "correct id"); 52.113 + assert(signature_for(id) == sig, "correct id"); 52.114 + return id; 52.115 + } 52.116 52.117 static void verify_method(ID actual_id, methodOop m) PRODUCT_RETURN; 52.118 52.119 - // No need for these in the product: 52.120 + // Find out the symbols behind an intrinsic: 52.121 static vmSymbols::SID class_for(ID id); 52.122 static vmSymbols::SID name_for(ID id); 52.123 static vmSymbols::SID signature_for(ID id); 52.124 @@ -1014,4 +1081,11 @@ 52.125 52.126 // Access to intrinsic methods: 52.127 static methodOop method_for(ID id); 52.128 + 52.129 + // Wrapper object methods: 52.130 + static ID for_boxing(BasicType type); 52.131 + static ID for_unboxing(BasicType type); 52.132 + 52.133 + // Raw conversion: 52.134 + static ID for_raw_conversion(BasicType src, BasicType dest); 52.135 };
53.1 --- a/src/share/vm/code/codeBlob.hpp Wed Dec 23 03:12:16 2009 -0800 53.2 +++ b/src/share/vm/code/codeBlob.hpp Wed Jan 06 22:21:39 2010 -0800 53.3 @@ -1,5 +1,5 @@ 53.4 /* 53.5 - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. 53.6 + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. 53.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.8 * 53.9 * This code is free software; you can redistribute it and/or modify it 53.10 @@ -102,6 +102,9 @@ 53.11 virtual bool is_compiled_by_c2() const { return false; } 53.12 virtual bool is_compiled_by_c1() const { return false; } 53.13 53.14 + // Casting 53.15 + nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; } 53.16 + 53.17 // Boundaries 53.18 address header_begin() const { return (address) this; } 53.19 address header_end() const { return ((address) this) + _header_size; };
54.1 --- a/src/share/vm/code/debugInfoRec.cpp Wed Dec 23 03:12:16 2009 -0800 54.2 +++ b/src/share/vm/code/debugInfoRec.cpp Wed Jan 06 22:21:39 2010 -0800 54.3 @@ -281,6 +281,7 @@ 54.4 ciMethod* method, 54.5 int bci, 54.6 bool reexecute, 54.7 + bool is_method_handle_invoke, 54.8 DebugToken* locals, 54.9 DebugToken* expressions, 54.10 DebugToken* monitors) { 54.11 @@ -292,8 +293,9 @@ 54.12 int stream_offset = stream()->position(); 54.13 last_pd->set_scope_decode_offset(stream_offset); 54.14 54.15 - // Record reexecute bit into pcDesc 54.16 + // Record flags into pcDesc. 54.17 last_pd->set_should_reexecute(reexecute); 54.18 + last_pd->set_is_method_handle_invoke(is_method_handle_invoke); 54.19 54.20 // serialize sender stream offest 54.21 stream()->write_int(sender_stream_offset);
55.1 --- a/src/share/vm/code/debugInfoRec.hpp Wed Dec 23 03:12:16 2009 -0800 55.2 +++ b/src/share/vm/code/debugInfoRec.hpp Wed Jan 06 22:21:39 2010 -0800 55.3 @@ -88,6 +88,7 @@ 55.4 ciMethod* method, 55.5 int bci, 55.6 bool reexecute, 55.7 + bool is_method_handle_invoke = false, 55.8 DebugToken* locals = NULL, 55.9 DebugToken* expressions = NULL, 55.10 DebugToken* monitors = NULL);
56.1 --- a/src/share/vm/code/nmethod.cpp Wed Dec 23 03:12:16 2009 -0800 56.2 +++ b/src/share/vm/code/nmethod.cpp Wed Jan 06 22:21:39 2010 -0800 56.3 @@ -1170,7 +1170,7 @@ 56.4 } 56.5 56.6 // Common functionality for both make_not_entrant and make_zombie 56.7 -bool nmethod::make_not_entrant_or_zombie(int state) { 56.8 +bool nmethod::make_not_entrant_or_zombie(unsigned int state) { 56.9 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); 56.10 56.11 // If the method is already zombie there is nothing to do 56.12 @@ -1724,9 +1724,9 @@ 56.13 if (!method()->is_native()) { 56.14 SimpleScopeDesc ssd(this, fr.pc()); 56.15 Bytecode_invoke* call = Bytecode_invoke_at(ssd.method(), ssd.bci()); 56.16 - bool is_static = call->is_invokestatic(); 56.17 + bool has_receiver = call->has_receiver(); 56.18 symbolOop signature = call->signature(); 56.19 - fr.oops_compiled_arguments_do(signature, is_static, reg_map, f); 56.20 + fr.oops_compiled_arguments_do(signature, has_receiver, reg_map, f); 56.21 } 56.22 } 56.23 56.24 @@ -1763,6 +1763,14 @@ 56.25 "must end with a sentinel"); 56.26 #endif //ASSERT 56.27 56.28 + // Search for MethodHandle invokes and tag the nmethod. 56.29 + for (int i = 0; i < count; i++) { 56.30 + if (pcs[i].is_method_handle_invoke()) { 56.31 + set_has_method_handle_invokes(true); 56.32 + break; 56.33 + } 56.34 + } 56.35 + 56.36 int size = count * sizeof(PcDesc); 56.37 assert(scopes_pcs_size() >= size, "oob"); 56.38 memcpy(scopes_pcs_begin(), pcs, size); 56.39 @@ -2030,6 +2038,18 @@ 56.40 56.41 56.42 // ----------------------------------------------------------------------------- 56.43 +// MethodHandle 56.44 + 56.45 +bool nmethod::is_method_handle_return(address return_pc) { 56.46 + if (!has_method_handle_invokes()) return false; 56.47 + PcDesc* pd = pc_desc_at(return_pc); 56.48 + if (pd == NULL) 56.49 + return false; 56.50 + return pd->is_method_handle_invoke(); 56.51 +} 56.52 + 56.53 + 56.54 +// ----------------------------------------------------------------------------- 56.55 // Verification 56.56 56.57 class VerifyOopsClosure: public OopClosure {
57.1 --- a/src/share/vm/code/nmethod.hpp Wed Dec 23 03:12:16 2009 -0800 57.2 +++ b/src/share/vm/code/nmethod.hpp Wed Jan 06 22:21:39 2010 -0800 57.3 @@ -81,18 +81,19 @@ 57.4 57.5 struct nmFlags { 57.6 friend class VMStructs; 57.7 - unsigned int version:8; // version number (0 = first version) 57.8 - unsigned int level:4; // optimization level 57.9 - unsigned int age:4; // age (in # of sweep steps) 57.10 + unsigned int version:8; // version number (0 = first version) 57.11 + unsigned int level:4; // optimization level 57.12 + unsigned int age:4; // age (in # of sweep steps) 57.13 57.14 - unsigned int state:2; // {alive, zombie, unloaded) 57.15 + unsigned int state:2; // {alive, zombie, unloaded) 57.16 57.17 - unsigned int isUncommonRecompiled:1; // recompiled because of uncommon trap? 57.18 - unsigned int isToBeRecompiled:1; // to be recompiled as soon as it matures 57.19 - unsigned int hasFlushedDependencies:1; // Used for maintenance of dependencies 57.20 - unsigned int markedForReclamation:1; // Used by NMethodSweeper 57.21 + unsigned int isUncommonRecompiled:1; // recompiled because of uncommon trap? 57.22 + unsigned int isToBeRecompiled:1; // to be recompiled as soon as it matures 57.23 + unsigned int hasFlushedDependencies:1; // Used for maintenance of dependencies 57.24 + unsigned int markedForReclamation:1; // Used by NMethodSweeper 57.25 57.26 - unsigned int has_unsafe_access:1; // May fault due to unsafe access. 57.27 + unsigned int has_unsafe_access:1; // May fault due to unsafe access. 57.28 + unsigned int has_method_handle_invokes:1; // Has this method MethodHandle invokes? 57.29 57.30 void clear(); 57.31 }; 57.32 @@ -254,7 +255,7 @@ 57.33 const char* reloc_string_for(u_char* begin, u_char* end); 57.34 // Returns true if this thread changed the state of the nmethod or 57.35 // false if another thread performed the transition. 57.36 - bool make_not_entrant_or_zombie(int state); 57.37 + bool make_not_entrant_or_zombie(unsigned int state); 57.38 void inc_decompile_count(); 57.39 57.40 // used to check that writes to nmFlags are done consistently. 57.41 @@ -409,6 +410,9 @@ 57.42 bool has_unsafe_access() const { return flags.has_unsafe_access; } 57.43 void set_has_unsafe_access(bool z) { flags.has_unsafe_access = z; } 57.44 57.45 + bool has_method_handle_invokes() const { return flags.has_method_handle_invokes; } 57.46 + void set_has_method_handle_invokes(bool z) { flags.has_method_handle_invokes = z; } 57.47 + 57.48 int level() const { return flags.level; } 57.49 void set_level(int newLevel) { check_safepoint(); flags.level = newLevel; } 57.50 57.51 @@ -541,6 +545,9 @@ 57.52 address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); } 57.53 void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; } 57.54 57.55 + // MethodHandle 57.56 + bool is_method_handle_return(address return_pc); 57.57 + 57.58 // jvmti support: 57.59 void post_compiled_method_load_event(); 57.60
58.1 --- a/src/share/vm/code/pcDesc.hpp Wed Dec 23 03:12:16 2009 -0800 58.2 +++ b/src/share/vm/code/pcDesc.hpp Wed Jan 06 22:21:39 2010 -0800 58.3 @@ -38,6 +38,7 @@ 58.4 int word; 58.5 struct { 58.6 unsigned int reexecute: 1; 58.7 + unsigned int is_method_handle_invoke: 1; 58.8 } bits; 58.9 bool operator ==(const PcDescFlags& other) { return word == other.word; } 58.10 } _flags; 58.11 @@ -72,6 +73,9 @@ 58.12 _flags == pd->_flags; 58.13 } 58.14 58.15 + bool is_method_handle_invoke() const { return _flags.bits.is_method_handle_invoke; } 58.16 + void set_is_method_handle_invoke(bool z) { _flags.bits.is_method_handle_invoke = z; } 58.17 + 58.18 // Returns the real pc 58.19 address real_pc(const nmethod* code) const; 58.20
59.1 --- a/src/share/vm/compiler/compileBroker.cpp Wed Dec 23 03:12:16 2009 -0800 59.2 +++ b/src/share/vm/compiler/compileBroker.cpp Wed Jan 06 22:21:39 2010 -0800 59.3 @@ -1820,9 +1820,11 @@ 59.4 CompileBroker::_t_standard_compilation.seconds(), 59.5 CompileBroker::_t_standard_compilation.seconds() / CompileBroker::_total_standard_compile_count); 59.6 tty->print_cr(" On stack replacement : %6.3f s, Average : %2.3f", CompileBroker::_t_osr_compilation.seconds(), CompileBroker::_t_osr_compilation.seconds() / CompileBroker::_total_osr_compile_count); 59.7 - compiler(CompLevel_fast_compile)->print_timers(); 59.8 - if (compiler(CompLevel_fast_compile) != compiler(CompLevel_highest_tier)) { 59.9 - compiler(CompLevel_highest_tier)->print_timers(); 59.10 + 59.11 + if (compiler(CompLevel_fast_compile)) { 59.12 + compiler(CompLevel_fast_compile)->print_timers(); 59.13 + if (compiler(CompLevel_fast_compile) != compiler(CompLevel_highest_tier)) 59.14 + compiler(CompLevel_highest_tier)->print_timers(); 59.15 } 59.16 59.17 tty->cr();
60.1 --- a/src/share/vm/compiler/methodLiveness.cpp Wed Dec 23 03:12:16 2009 -0800 60.2 +++ b/src/share/vm/compiler/methodLiveness.cpp Wed Jan 06 22:21:39 2010 -0800 60.3 @@ -782,6 +782,7 @@ 60.4 case Bytecodes::_invokespecial: 60.5 case Bytecodes::_invokestatic: 60.6 case Bytecodes::_invokeinterface: 60.7 + case Bytecodes::_invokedynamic: 60.8 case Bytecodes::_newarray: 60.9 case Bytecodes::_anewarray: 60.10 case Bytecodes::_checkcast:
61.1 --- a/src/share/vm/gc_interface/collectedHeap.cpp Wed Dec 23 03:12:16 2009 -0800 61.2 +++ b/src/share/vm/gc_interface/collectedHeap.cpp Wed Jan 06 22:21:39 2010 -0800 61.3 @@ -274,7 +274,7 @@ 61.4 fill_with_array(start, words); 61.5 } else if (words > 0) { 61.6 assert(words == min_fill_size(), "unaligned size"); 61.7 - post_allocation_setup_common(SystemDictionary::object_klass(), start, 61.8 + post_allocation_setup_common(SystemDictionary::Object_klass(), start, 61.9 words); 61.10 } 61.11 }
62.1 --- a/src/share/vm/includeDB_compiler2 Wed Dec 23 03:12:16 2009 -0800 62.2 +++ b/src/share/vm/includeDB_compiler2 Wed Jan 06 22:21:39 2010 -0800 62.3 @@ -155,6 +155,9 @@ 62.4 callGenerator.cpp cfgnode.hpp 62.5 callGenerator.cpp compileLog.hpp 62.6 callGenerator.cpp connode.hpp 62.7 +callGenerator.cpp ciCPCache.hpp 62.8 +callGenerator.cpp ciMethodHandle.hpp 62.9 +callGenerator.cpp javaClasses.hpp 62.10 callGenerator.cpp parse.hpp 62.11 callGenerator.cpp rootnode.hpp 62.12 callGenerator.cpp runtime.hpp 62.13 @@ -391,6 +394,9 @@ 62.14 62.15 doCall.cpp addnode.hpp 62.16 doCall.cpp callGenerator.hpp 62.17 +doCall.cpp ciCallSite.hpp 62.18 +doCall.cpp ciCPCache.hpp 62.19 +doCall.cpp ciMethodHandle.hpp 62.20 doCall.cpp cfgnode.hpp 62.21 doCall.cpp compileLog.hpp 62.22 doCall.cpp linkResolver.hpp
63.1 --- a/src/share/vm/includeDB_core Wed Dec 23 03:12:16 2009 -0800 63.2 +++ b/src/share/vm/includeDB_core Wed Jan 06 22:21:39 2010 -0800 63.3 @@ -516,6 +516,11 @@ 63.4 63.5 ciCallProfile.hpp ciClassList.hpp 63.6 63.7 +ciCallSite.cpp ciCallSite.hpp 63.8 +ciCallSite.cpp ciUtilities.hpp 63.9 + 63.10 +ciCallSite.hpp ciInstance.hpp 63.11 + 63.12 ciConstant.cpp allocation.hpp 63.13 ciConstant.cpp allocation.inline.hpp 63.14 ciConstant.cpp ciConstant.hpp 63.15 @@ -532,6 +537,12 @@ 63.16 ciConstantPoolCache.hpp growableArray.hpp 63.17 ciConstantPoolCache.hpp resourceArea.hpp 63.18 63.19 +ciCPCache.cpp cpCacheOop.hpp 63.20 +ciCPCache.cpp ciCPCache.hpp 63.21 + 63.22 +ciCPCache.hpp ciClassList.hpp 63.23 +ciCPCache.hpp ciObject.hpp 63.24 + 63.25 ciEnv.cpp allocation.inline.hpp 63.26 ciEnv.cpp ciConstant.hpp 63.27 ciEnv.cpp ciEnv.hpp 63.28 @@ -593,6 +604,7 @@ 63.29 ciField.hpp ciClassList.hpp 63.30 ciField.hpp ciConstant.hpp 63.31 ciField.hpp ciFlags.hpp 63.32 +ciField.hpp ciInstance.hpp 63.33 63.34 ciFlags.cpp ciFlags.hpp 63.35 63.36 @@ -679,6 +691,7 @@ 63.37 ciMethod.hpp ciInstanceKlass.hpp 63.38 ciMethod.hpp ciObject.hpp 63.39 ciMethod.hpp ciSignature.hpp 63.40 +ciMethod.hpp methodHandles.hpp 63.41 ciMethod.hpp methodLiveness.hpp 63.42 63.43 ciMethodBlocks.cpp bytecode.hpp 63.44 @@ -710,6 +723,15 @@ 63.45 ciMethodKlass.hpp ciKlass.hpp 63.46 ciMethodKlass.hpp ciSymbol.hpp 63.47 63.48 +ciMethodHandle.cpp ciClassList.hpp 63.49 +ciMethodHandle.cpp ciInstance.hpp 63.50 +ciMethodHandle.cpp ciMethodHandle.hpp 63.51 +ciMethodHandle.cpp ciUtilities.hpp 63.52 +ciMethodHandle.cpp methodHandles.hpp 63.53 +ciMethodHandle.cpp methodHandleWalk.hpp 63.54 + 63.55 +ciMethodHandle.hpp methodHandles.hpp 63.56 + 63.57 ciNullObject.cpp ciNullObject.hpp 63.58 63.59 ciNullObject.hpp ciClassList.hpp 63.60 @@ -755,11 +777,14 @@ 63.61 ciObject.hpp jniHandles.hpp 63.62 63.63 ciObjectFactory.cpp allocation.inline.hpp 63.64 +ciObjectFactory.cpp ciCallSite.hpp 63.65 +ciObjectFactory.cpp ciCPCache.hpp 63.66 ciObjectFactory.cpp ciInstance.hpp 63.67 ciObjectFactory.cpp ciInstanceKlass.hpp 63.68 ciObjectFactory.cpp ciInstanceKlassKlass.hpp 63.69 ciObjectFactory.cpp ciMethod.hpp 63.70 ciObjectFactory.cpp ciMethodData.hpp 63.71 +ciObjectFactory.cpp ciMethodHandle.hpp 63.72 ciObjectFactory.cpp ciMethodKlass.hpp 63.73 ciObjectFactory.cpp ciNullObject.hpp 63.74 ciObjectFactory.cpp ciObjArray.hpp 63.75 @@ -793,6 +818,7 @@ 63.76 ciSignature.hpp globalDefinitions.hpp 63.77 ciSignature.hpp growableArray.hpp 63.78 63.79 +ciStreams.cpp ciCallSite.hpp 63.80 ciStreams.cpp ciConstant.hpp 63.81 ciStreams.cpp ciField.hpp 63.82 ciStreams.cpp ciStreams.hpp 63.83 @@ -2814,6 +2840,12 @@ 63.84 methodDataOop.hpp orderAccess.hpp 63.85 methodDataOop.hpp universe.hpp 63.86 63.87 +methodHandleWalk.hpp methodHandles.hpp 63.88 + 63.89 +methodHandleWalk.cpp methodHandleWalk.hpp 63.90 +methodHandleWalk.cpp oopFactory.hpp 63.91 +methodHandleWalk.cpp rewriter.hpp 63.92 + 63.93 methodHandles.hpp frame.inline.hpp 63.94 methodHandles.hpp globals.hpp 63.95 methodHandles.hpp interfaceSupport.hpp
64.1 --- a/src/share/vm/interpreter/bytecode.cpp Wed Dec 23 03:12:16 2009 -0800 64.2 +++ b/src/share/vm/interpreter/bytecode.cpp Wed Jan 06 22:21:39 2010 -0800 64.3 @@ -102,7 +102,9 @@ 64.4 KlassHandle resolved_klass; 64.5 constantPoolHandle constants(THREAD, _method->constants()); 64.6 64.7 - if (adjusted_invoke_code() != Bytecodes::_invokeinterface) { 64.8 + if (adjusted_invoke_code() == Bytecodes::_invokedynamic) { 64.9 + LinkResolver::resolve_dynamic_method(m, resolved_klass, constants, index(), CHECK_(methodHandle())); 64.10 + } else if (adjusted_invoke_code() != Bytecodes::_invokeinterface) { 64.11 LinkResolver::resolve_method(m, resolved_klass, constants, index(), CHECK_(methodHandle())); 64.12 } else { 64.13 LinkResolver::resolve_interface_method(m, resolved_klass, constants, index(), CHECK_(methodHandle()));
65.1 --- a/src/share/vm/interpreter/bytecode.hpp Wed Dec 23 03:12:16 2009 -0800 65.2 +++ b/src/share/vm/interpreter/bytecode.hpp Wed Jan 06 22:21:39 2010 -0800 65.3 @@ -205,12 +205,14 @@ 65.4 bool is_invokespecial() const { return adjusted_invoke_code() == Bytecodes::_invokespecial; } 65.5 bool is_invokedynamic() const { return adjusted_invoke_code() == Bytecodes::_invokedynamic; } 65.6 65.7 + bool has_receiver() const { return !is_invokestatic() && !is_invokedynamic(); } 65.8 bool has_giant_index() const { return is_invokedynamic(); } 65.9 65.10 bool is_valid() const { return is_invokeinterface() || 65.11 is_invokevirtual() || 65.12 is_invokestatic() || 65.13 - is_invokespecial(); } 65.14 + is_invokespecial() || 65.15 + is_invokedynamic(); } 65.16 65.17 // Creation 65.18 inline friend Bytecode_invoke* Bytecode_invoke_at(methodHandle method, int bci);
66.1 --- a/src/share/vm/interpreter/bytecodeTracer.cpp Wed Dec 23 03:12:16 2009 -0800 66.2 +++ b/src/share/vm/interpreter/bytecodeTracer.cpp Wed Jan 06 22:21:39 2010 -0800 66.3 @@ -270,6 +270,8 @@ 66.4 st->print_cr(" %s", constants->resolved_klass_at(i)->klass_part()->external_name()); 66.5 } else if (tag.is_unresolved_klass()) { 66.6 st->print_cr(" <unresolved klass at %d>", i); 66.7 + } else if (tag.is_object()) { 66.8 + st->print_cr(" " PTR_FORMAT, constants->object_at(i)); 66.9 } else { 66.10 st->print_cr(" bad tag=%d at %d", tag.value(), i); 66.11 }
67.1 --- a/src/share/vm/interpreter/bytecodes.cpp Wed Dec 23 03:12:16 2009 -0800 67.2 +++ b/src/share/vm/interpreter/bytecodes.cpp Wed Jan 06 22:21:39 2010 -0800 67.3 @@ -357,7 +357,7 @@ 67.4 def(_invokespecial , "invokespecial" , "bjj" , NULL , T_ILLEGAL, -1, true); 67.5 def(_invokestatic , "invokestatic" , "bjj" , NULL , T_ILLEGAL, 0, true); 67.6 def(_invokeinterface , "invokeinterface" , "bjj__", NULL , T_ILLEGAL, -1, true); 67.7 - def(_invokedynamic , "invokedynamic" , "bjjjj", NULL , T_ILLEGAL, -1, true ); 67.8 + def(_invokedynamic , "invokedynamic" , "bjjjj", NULL , T_ILLEGAL, 0, true ); 67.9 def(_new , "new" , "bii" , NULL , T_OBJECT , 1, true ); 67.10 def(_newarray , "newarray" , "bc" , NULL , T_OBJECT , 0, true ); 67.11 def(_anewarray , "anewarray" , "bii" , NULL , T_OBJECT , 0, true );
68.1 --- a/src/share/vm/interpreter/interpreter.cpp Wed Dec 23 03:12:16 2009 -0800 68.2 +++ b/src/share/vm/interpreter/interpreter.cpp Wed Jan 06 22:21:39 2010 -0800 68.3 @@ -323,7 +323,7 @@ 68.4 // (NOT needed for the old calling convension) 68.5 if (!is_top_frame) { 68.6 int index = Bytes::get_native_u4(bcp+1); 68.7 - method->constants()->cache()->entry_at(index)->set_parameter_size(callee_parameters); 68.8 + method->constants()->cache()->secondary_entry_at(index)->set_parameter_size(callee_parameters); 68.9 } 68.10 break; 68.11 }
69.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp Wed Dec 23 03:12:16 2009 -0800 69.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp Wed Jan 06 22:21:39 2010 -0800 69.3 @@ -353,7 +353,7 @@ 69.4 assert(h_exception.not_null(), "NULL exceptions should be handled by athrow"); 69.5 assert(h_exception->is_oop(), "just checking"); 69.6 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError 69.7 - if (!(h_exception->is_a(SystemDictionary::throwable_klass()))) { 69.8 + if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) { 69.9 if (ExitVMOnVerifyError) vm_exit(-1); 69.10 ShouldNotReachHere(); 69.11 } 69.12 @@ -585,7 +585,7 @@ 69.13 Handle exception(thread, thread->vm_result()); 69.14 assert(exception() != NULL, "vm result should be set"); 69.15 thread->set_vm_result(NULL); // clear vm result before continuing (may cause memory leaks and assert failures) 69.16 - if (!exception->is_a(SystemDictionary::threaddeath_klass())) { 69.17 + if (!exception->is_a(SystemDictionary::ThreadDeath_klass())) { 69.18 exception = get_preinitialized_exception( 69.19 SystemDictionary::IllegalMonitorStateException_klass(), 69.20 CATCH); 69.21 @@ -660,7 +660,7 @@ 69.22 tty->print_cr("Resolving: klass: %s to method: %s", info.resolved_klass()->name()->as_C_string(), info.resolved_method()->name()->as_C_string()); 69.23 } 69.24 if (info.resolved_method()->method_holder() == 69.25 - SystemDictionary::object_klass()) { 69.26 + SystemDictionary::Object_klass()) { 69.27 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec 69.28 // (see also cpCacheOop.cpp for details) 69.29 methodHandle rm = info.resolved_method(); 69.30 @@ -1250,7 +1250,7 @@ 69.31 methodHandle mh(thread, fr.interpreter_frame_method()); 69.32 Bytecode_invoke* invoke = Bytecode_invoke_at(mh, bci); 69.33 ArgumentSizeComputer asc(invoke->signature()); 69.34 - int size_of_arguments = (asc.size() + (invoke->is_invokestatic() ? 0 : 1)); // receiver 69.35 + int size_of_arguments = (asc.size() + (invoke->has_receiver() ? 1 : 0)); // receiver 69.36 Copy::conjoint_bytes(src_address, dest_address, 69.37 size_of_arguments * Interpreter::stackElementSize()); 69.38 IRT_END
70.1 --- a/src/share/vm/interpreter/linkResolver.cpp Wed Dec 23 03:12:16 2009 -0800 70.2 +++ b/src/share/vm/interpreter/linkResolver.cpp Wed Jan 06 22:21:39 2010 -0800 70.3 @@ -55,7 +55,7 @@ 70.4 // we should pick the vtable index from the resolved method. 70.5 // Other than that case, there is no valid vtable index to specify. 70.6 int vtable_index = methodOopDesc::invalid_vtable_index; 70.7 - if (resolved_method->method_holder() == SystemDictionary::object_klass()) { 70.8 + if (resolved_method->method_holder() == SystemDictionary::Object_klass()) { 70.9 assert(resolved_method->vtable_index() == selected_method->vtable_index(), "sanity check"); 70.10 vtable_index = resolved_method->vtable_index(); 70.11 } 70.12 @@ -75,6 +75,8 @@ 70.13 _selected_method = selected_method; 70.14 _vtable_index = vtable_index; 70.15 if (CompilationPolicy::mustBeCompiled(selected_method)) { 70.16 + // This path is unusual, mostly used by the '-Xcomp' stress test mode. 70.17 + 70.18 // Note: with several active threads, the mustBeCompiled may be true 70.19 // while canBeCompiled is false; remove assert 70.20 // assert(CompilationPolicy::canBeCompiled(selected_method), "cannot compile"); 70.21 @@ -82,6 +84,16 @@ 70.22 // don't force compilation, resolve was on behalf of compiler 70.23 return; 70.24 } 70.25 + if (instanceKlass::cast(selected_method->method_holder())->is_not_initialized()) { 70.26 + // 'is_not_initialized' means not only '!is_initialized', but also that 70.27 + // initialization has not been started yet ('!being_initialized') 70.28 + // Do not force compilation of methods in uninitialized classes. 70.29 + // Note that doing this would throw an assert later, 70.30 + // in CompileBroker::compile_method. 70.31 + // We sometimes use the link resolver to do reflective lookups 70.32 + // even before classes are initialized. 70.33 + return; 70.34 + } 70.35 CompileBroker::compile_method(selected_method, InvocationEntryBci, 70.36 methodHandle(), 0, "mustBeCompiled", CHECK); 70.37 } 70.38 @@ -181,7 +193,7 @@ 70.39 // We'll check for the method name first, as that's most likely 70.40 // to be false (so we'll short-circuit out of these tests). 70.41 if (sel_method->name() == vmSymbols::clone_name() && 70.42 - sel_klass() == SystemDictionary::object_klass() && 70.43 + sel_klass() == SystemDictionary::Object_klass() && 70.44 resolved_klass->oop_is_array()) { 70.45 // We need to change "protected" to "public". 70.46 assert(flags.is_protected(), "clone not protected?"); 70.47 @@ -223,6 +235,18 @@ 70.48 resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK); 70.49 } 70.50 70.51 +void LinkResolver::resolve_dynamic_method(methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS) { 70.52 + // The class is java.dyn.MethodHandle 70.53 + resolved_klass = SystemDictionaryHandles::MethodHandle_klass(); 70.54 + 70.55 + symbolHandle method_name = vmSymbolHandles::invoke_name(); 70.56 + 70.57 + symbolHandle method_signature(THREAD, pool->signature_ref_at(index)); 70.58 + KlassHandle current_klass (THREAD, pool->pool_holder()); 70.59 + 70.60 + resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK); 70.61 +} 70.62 + 70.63 void LinkResolver::resolve_interface_method(methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS) { 70.64 70.65 // resolve klass
71.1 --- a/src/share/vm/interpreter/linkResolver.hpp Wed Dec 23 03:12:16 2009 -0800 71.2 +++ b/src/share/vm/interpreter/linkResolver.hpp Wed Jan 06 22:21:39 2010 -0800 71.3 @@ -133,6 +133,7 @@ 71.4 71.5 // static resolving for all calls except interface calls 71.6 static void resolve_method (methodHandle& method_result, KlassHandle& klass_result, constantPoolHandle pool, int index, TRAPS); 71.7 + static void resolve_dynamic_method (methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS); 71.8 static void resolve_interface_method(methodHandle& method_result, KlassHandle& klass_result, constantPoolHandle pool, int index, TRAPS); 71.9 71.10 // runtime/static resolving for fields
72.1 --- a/src/share/vm/interpreter/rewriter.cpp Wed Dec 23 03:12:16 2009 -0800 72.2 +++ b/src/share/vm/interpreter/rewriter.cpp Wed Jan 06 22:21:39 2010 -0800 72.3 @@ -247,15 +247,22 @@ 72.4 72.5 void Rewriter::rewrite(instanceKlassHandle klass, TRAPS) { 72.6 ResourceMark rm(THREAD); 72.7 - Rewriter rw(klass, CHECK); 72.8 + Rewriter rw(klass, klass->constants(), klass->methods(), CHECK); 72.9 // (That's all, folks.) 72.10 } 72.11 72.12 -Rewriter::Rewriter(instanceKlassHandle klass, TRAPS) 72.13 + 72.14 +void Rewriter::rewrite(instanceKlassHandle klass, constantPoolHandle cpool, objArrayHandle methods, TRAPS) { 72.15 + ResourceMark rm(THREAD); 72.16 + Rewriter rw(klass, cpool, methods, CHECK); 72.17 + // (That's all, folks.) 72.18 +} 72.19 + 72.20 + 72.21 +Rewriter::Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, objArrayHandle methods, TRAPS) 72.22 : _klass(klass), 72.23 - // gather starting points 72.24 - _pool( THREAD, klass->constants()), 72.25 - _methods(THREAD, klass->methods()) 72.26 + _pool(cpool), 72.27 + _methods(methods) 72.28 { 72.29 assert(_pool->cache() == NULL, "constant pool cache must not be set yet"); 72.30
73.1 --- a/src/share/vm/interpreter/rewriter.hpp Wed Dec 23 03:12:16 2009 -0800 73.2 +++ b/src/share/vm/interpreter/rewriter.hpp Wed Jan 06 22:21:39 2010 -0800 73.3 @@ -57,7 +57,7 @@ 73.4 } 73.5 73.6 // All the work goes in here: 73.7 - Rewriter(instanceKlassHandle klass, TRAPS); 73.8 + Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, objArrayHandle methods, TRAPS); 73.9 73.10 void compute_index_maps(); 73.11 void make_constant_pool_cache(TRAPS); 73.12 @@ -70,6 +70,7 @@ 73.13 public: 73.14 // Driver routine: 73.15 static void rewrite(instanceKlassHandle klass, TRAPS); 73.16 + static void rewrite(instanceKlassHandle klass, constantPoolHandle cpool, objArrayHandle methods, TRAPS); 73.17 73.18 enum { 73.19 _secondary_entry_tag = nth_bit(30)
74.1 --- a/src/share/vm/memory/classify.cpp Wed Dec 23 03:12:16 2009 -0800 74.2 +++ b/src/share/vm/memory/classify.cpp Wed Jan 06 22:21:39 2010 -0800 74.3 @@ -49,7 +49,7 @@ 74.4 74.5 Klass* k = obj->blueprint(); 74.6 74.7 - if (k->as_klassOop() == SystemDictionary::object_klass()) { 74.8 + if (k->as_klassOop() == SystemDictionary::Object_klass()) { 74.9 tty->print_cr("Found the class!"); 74.10 } 74.11
75.1 --- a/src/share/vm/memory/dump.cpp Wed Dec 23 03:12:16 2009 -0800 75.2 +++ b/src/share/vm/memory/dump.cpp Wed Jan 06 22:21:39 2010 -0800 75.3 @@ -63,7 +63,7 @@ 75.4 void do_oop(oop* p) { 75.5 if (p != NULL) { 75.6 oop obj = *p; 75.7 - if (obj->klass() == SystemDictionary::string_klass()) { 75.8 + if (obj->klass() == SystemDictionary::String_klass()) { 75.9 75.10 int hash; 75.11 typeArrayOop value = java_lang_String::value(obj); 75.12 @@ -625,11 +625,11 @@ 75.13 75.14 if (obj->is_klass() || obj->is_instance()) { 75.15 if (obj->is_klass() || 75.16 - obj->is_a(SystemDictionary::class_klass()) || 75.17 - obj->is_a(SystemDictionary::throwable_klass())) { 75.18 + obj->is_a(SystemDictionary::Class_klass()) || 75.19 + obj->is_a(SystemDictionary::Throwable_klass())) { 75.20 // Do nothing 75.21 } 75.22 - else if (obj->is_a(SystemDictionary::string_klass())) { 75.23 + else if (obj->is_a(SystemDictionary::String_klass())) { 75.24 // immutable objects. 75.25 } else { 75.26 // someone added an object we hadn't accounted for.
76.1 --- a/src/share/vm/memory/referenceProcessor.cpp Wed Dec 23 03:12:16 2009 -0800 76.2 +++ b/src/share/vm/memory/referenceProcessor.cpp Wed Jan 06 22:21:39 2010 -0800 76.3 @@ -71,7 +71,7 @@ 76.4 assert(_sentinelRef == NULL, "should be initialized precisely once"); 76.5 EXCEPTION_MARK; 76.6 _sentinelRef = instanceKlass::cast( 76.7 - SystemDictionary::reference_klass())-> 76.8 + SystemDictionary::Reference_klass())-> 76.9 allocate_permanent_instance(THREAD); 76.10 76.11 // Initialize the master soft ref clock.
77.1 --- a/src/share/vm/memory/space.cpp Wed Dec 23 03:12:16 2009 -0800 77.2 +++ b/src/share/vm/memory/space.cpp Wed Jan 06 22:21:39 2010 -0800 77.3 @@ -876,7 +876,7 @@ 77.4 instanceOop obj = (instanceOop) allocate(size); 77.5 obj->set_mark(markOopDesc::prototype()); 77.6 obj->set_klass_gap(0); 77.7 - obj->set_klass(SystemDictionary::object_klass()); 77.8 + obj->set_klass(SystemDictionary::Object_klass()); 77.9 } 77.10 } 77.11
78.1 --- a/src/share/vm/memory/universe.cpp Wed Dec 23 03:12:16 2009 -0800 78.2 +++ b/src/share/vm/memory/universe.cpp Wed Jan 06 22:21:39 2010 -0800 78.3 @@ -291,7 +291,7 @@ 78.4 78.5 SystemDictionary::initialize(CHECK); 78.6 78.7 - klassOop ok = SystemDictionary::object_klass(); 78.8 + klassOop ok = SystemDictionary::Object_klass(); 78.9 78.10 _the_null_string = StringTable::intern("null", CHECK); 78.11 _the_min_jint_string = StringTable::intern("-2147483648", CHECK); 78.12 @@ -299,9 +299,9 @@ 78.13 if (UseSharedSpaces) { 78.14 // Verify shared interfaces array. 78.15 assert(_the_array_interfaces_array->obj_at(0) == 78.16 - SystemDictionary::cloneable_klass(), "u3"); 78.17 + SystemDictionary::Cloneable_klass(), "u3"); 78.18 assert(_the_array_interfaces_array->obj_at(1) == 78.19 - SystemDictionary::serializable_klass(), "u3"); 78.20 + SystemDictionary::Serializable_klass(), "u3"); 78.21 78.22 // Verify element klass for system obj array klass 78.23 assert(objArrayKlass::cast(_systemObjArrayKlassObj)->element_klass() == ok, "u1"); 78.24 @@ -320,8 +320,8 @@ 78.25 assert(Klass::cast(systemObjArrayKlassObj())->super() == ok, "u3"); 78.26 } else { 78.27 // Set up shared interfaces array. (Do this before supers are set up.) 78.28 - _the_array_interfaces_array->obj_at_put(0, SystemDictionary::cloneable_klass()); 78.29 - _the_array_interfaces_array->obj_at_put(1, SystemDictionary::serializable_klass()); 78.30 + _the_array_interfaces_array->obj_at_put(0, SystemDictionary::Cloneable_klass()); 78.31 + _the_array_interfaces_array->obj_at_put(1, SystemDictionary::Serializable_klass()); 78.32 78.33 // Set element klass for system obj array klass 78.34 objArrayKlass::cast(_systemObjArrayKlassObj)->set_element_klass(ok); 78.35 @@ -365,7 +365,7 @@ 78.36 // Initialize _objectArrayKlass after core bootstraping to make 78.37 // sure the super class is set up properly for _objectArrayKlass. 78.38 _objectArrayKlassObj = instanceKlass:: 78.39 - cast(SystemDictionary::object_klass())->array_klass(1, CHECK); 78.40 + cast(SystemDictionary::Object_klass())->array_klass(1, CHECK); 78.41 // Add the class to the class hierarchy manually to make sure that 78.42 // its vtable is initialized after core bootstrapping is completed. 78.43 Klass::cast(_objectArrayKlassObj)->append_to_sibling_list(); 78.44 @@ -426,11 +426,11 @@ 78.45 while (i < size) { 78.46 if (!UseConcMarkSweepGC) { 78.47 // Allocate dummy in old generation 78.48 - oop dummy = instanceKlass::cast(SystemDictionary::object_klass())->allocate_instance(CHECK); 78.49 + oop dummy = instanceKlass::cast(SystemDictionary::Object_klass())->allocate_instance(CHECK); 78.50 dummy_array->obj_at_put(i++, dummy); 78.51 } 78.52 // Allocate dummy in permanent generation 78.53 - oop dummy = instanceKlass::cast(SystemDictionary::object_klass())->allocate_permanent_instance(CHECK); 78.54 + oop dummy = instanceKlass::cast(SystemDictionary::Object_klass())->allocate_permanent_instance(CHECK); 78.55 dummy_array->obj_at_put(i++, dummy); 78.56 } 78.57 { 78.58 @@ -540,7 +540,7 @@ 78.59 // but we cannot do that for classes created before java.lang.Class is loaded. Here we simply 78.60 // walk over permanent objects created so far (mostly classes) and fixup their mirrors. Note 78.61 // that the number of objects allocated at this point is very small. 78.62 - assert(SystemDictionary::class_klass_loaded(), "java.lang.Class should be loaded"); 78.63 + assert(SystemDictionary::Class_klass_loaded(), "java.lang.Class should be loaded"); 78.64 FixupMirrorClosure blk; 78.65 Universe::heap()->permanent_object_iterate(&blk); 78.66 } 78.67 @@ -556,7 +556,7 @@ 78.68 if (TraceReferenceGC) tty->print_cr("Callback to run finalizers on exit"); 78.69 { 78.70 PRESERVE_EXCEPTION_MARK; 78.71 - KlassHandle finalizer_klass(THREAD, SystemDictionary::finalizer_klass()); 78.72 + KlassHandle finalizer_klass(THREAD, SystemDictionary::Finalizer_klass()); 78.73 JavaValue result(T_VOID); 78.74 JavaCalls::call_static( 78.75 &result, 78.76 @@ -950,7 +950,7 @@ 78.77 { ResourceMark rm; 78.78 Interpreter::initialize(); // needed for interpreter entry points 78.79 if (!UseSharedSpaces) { 78.80 - KlassHandle ok_h(THREAD, SystemDictionary::object_klass()); 78.81 + KlassHandle ok_h(THREAD, SystemDictionary::Object_klass()); 78.82 Universe::reinitialize_vtable_of(ok_h, CHECK_false); 78.83 Universe::reinitialize_itables(CHECK_false); 78.84 } 78.85 @@ -960,7 +960,7 @@ 78.86 instanceKlassHandle k_h; 78.87 if (!UseSharedSpaces) { 78.88 // Setup preallocated empty java.lang.Class array 78.89 - Universe::_the_empty_class_klass_array = oopFactory::new_objArray(SystemDictionary::class_klass(), 0, CHECK_false); 78.90 + Universe::_the_empty_class_klass_array = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_false); 78.91 // Setup preallocated OutOfMemoryError errors 78.92 k = SystemDictionary::resolve_or_fail(vmSymbolHandles::java_lang_OutOfMemoryError(), true, CHECK_false); 78.93 k_h = instanceKlassHandle(THREAD, k); 78.94 @@ -1027,8 +1027,8 @@ 78.95 // Setup static method for registering finalizers 78.96 // The finalizer klass must be linked before looking up the method, in 78.97 // case it needs to get rewritten. 78.98 - instanceKlass::cast(SystemDictionary::finalizer_klass())->link_class(CHECK_false); 78.99 - methodOop m = instanceKlass::cast(SystemDictionary::finalizer_klass())->find_method( 78.100 + instanceKlass::cast(SystemDictionary::Finalizer_klass())->link_class(CHECK_false); 78.101 + methodOop m = instanceKlass::cast(SystemDictionary::Finalizer_klass())->find_method( 78.102 vmSymbols::register_method_name(), 78.103 vmSymbols::register_method_signature()); 78.104 if (m == NULL || !m->is_static()) { 78.105 @@ -1036,7 +1036,7 @@ 78.106 "java.lang.ref.Finalizer.register", false); 78.107 } 78.108 Universe::_finalizer_register_cache->init( 78.109 - SystemDictionary::finalizer_klass(), m, CHECK_false); 78.110 + SystemDictionary::Finalizer_klass(), m, CHECK_false); 78.111 78.112 // Resolve on first use and initialize class. 78.113 // Note: No race-condition here, since a resolve will always return the same result 78.114 @@ -1053,14 +1053,14 @@ 78.115 Universe::_reflect_invoke_cache->init(k_h(), m, CHECK_false); 78.116 78.117 // Setup method for registering loaded classes in class loader vector 78.118 - instanceKlass::cast(SystemDictionary::classloader_klass())->link_class(CHECK_false); 78.119 - m = instanceKlass::cast(SystemDictionary::classloader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature()); 78.120 + instanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false); 78.121 + m = instanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature()); 78.122 if (m == NULL || m->is_static()) { 78.123 THROW_MSG_(vmSymbols::java_lang_NoSuchMethodException(), 78.124 "java.lang.ClassLoader.addClass", false); 78.125 } 78.126 Universe::_loader_addClass_cache->init( 78.127 - SystemDictionary::classloader_klass(), m, CHECK_false); 78.128 + SystemDictionary::ClassLoader_klass(), m, CHECK_false); 78.129 78.130 // The folowing is initializing converter functions for serialization in 78.131 // JVM.cpp. If we clean up the StrictMath code above we may want to find
79.1 --- a/src/share/vm/oops/arrayKlass.cpp Wed Dec 23 03:12:16 2009 -0800 79.2 +++ b/src/share/vm/oops/arrayKlass.cpp Wed Jan 06 22:21:39 2010 -0800 79.3 @@ -43,7 +43,7 @@ 79.4 if (super() == NULL) return NULL; // bootstrap case 79.5 // Array klasses have primary supertypes which are not reported to Java. 79.6 // Example super chain: String[][] -> Object[][] -> Object[] -> Object 79.7 - return SystemDictionary::object_klass(); 79.8 + return SystemDictionary::Object_klass(); 79.9 } 79.10 79.11 79.12 @@ -82,7 +82,7 @@ 79.13 k = arrayKlassHandle(THREAD, base_klass()); 79.14 79.15 assert(!k()->is_parsable(), "not expecting parsability yet."); 79.16 - k->set_super(Universe::is_bootstrapping() ? (klassOop)NULL : SystemDictionary::object_klass()); 79.17 + k->set_super(Universe::is_bootstrapping() ? (klassOop)NULL : SystemDictionary::Object_klass()); 79.18 k->set_layout_helper(Klass::_lh_neutral_value); 79.19 k->set_dimension(1); 79.20 k->set_higher_dimension(NULL); 79.21 @@ -117,9 +117,9 @@ 79.22 79.23 bool arrayKlass::compute_is_subtype_of(klassOop k) { 79.24 // An array is a subtype of Serializable, Clonable, and Object 79.25 - return k == SystemDictionary::object_klass() 79.26 - || k == SystemDictionary::cloneable_klass() 79.27 - || k == SystemDictionary::serializable_klass(); 79.28 + return k == SystemDictionary::Object_klass() 79.29 + || k == SystemDictionary::Cloneable_klass() 79.30 + || k == SystemDictionary::Serializable_klass(); 79.31 } 79.32 79.33
80.1 --- a/src/share/vm/oops/arrayKlass.hpp Wed Dec 23 03:12:16 2009 -0800 80.2 +++ b/src/share/vm/oops/arrayKlass.hpp Wed Jan 06 22:21:39 2010 -0800 80.3 @@ -67,7 +67,7 @@ 80.4 // Compiler/Interpreter offset 80.5 static ByteSize component_mirror_offset() { return byte_offset_of(arrayKlass, _component_mirror); } 80.6 80.7 - virtual klassOop java_super() const;//{ return SystemDictionary::object_klass(); } 80.8 + virtual klassOop java_super() const;//{ return SystemDictionary::Object_klass(); } 80.9 80.10 // Allocation 80.11 // Sizes points to the first dimension of the array, subsequent dimensions
81.1 --- a/src/share/vm/oops/constMethodOop.hpp Wed Dec 23 03:12:16 2009 -0800 81.2 +++ b/src/share/vm/oops/constMethodOop.hpp Wed Jan 06 22:21:39 2010 -0800 81.3 @@ -258,6 +258,11 @@ 81.4 LocalVariableTableElement* localvariable_table_start() const; 81.5 81.6 // byte codes 81.7 + void set_code(address code) { 81.8 + if (code_size() > 0) { 81.9 + memcpy(code_base(), code, code_size()); 81.10 + } 81.11 + } 81.12 address code_base() const { return (address) (this+1); } 81.13 address code_end() const { return code_base() + code_size(); } 81.14 bool contains(address bcp) const { return code_base() <= bcp
82.1 --- a/src/share/vm/oops/constantPoolOop.cpp Wed Dec 23 03:12:16 2009 -0800 82.2 +++ b/src/share/vm/oops/constantPoolOop.cpp Wed Jan 06 22:21:39 2010 -0800 82.3 @@ -110,7 +110,7 @@ 82.4 } 82.5 82.6 if (!PENDING_EXCEPTION-> 82.7 - is_a(SystemDictionary::linkageError_klass())) { 82.8 + is_a(SystemDictionary::LinkageError_klass())) { 82.9 // Just throw the exception and don't prevent these classes from 82.10 // being loaded due to virtual machine errors like StackOverflow 82.11 // and OutOfMemoryError, etc, or if the thread was hit by stop()
83.1 --- a/src/share/vm/oops/constantPoolOop.hpp Wed Dec 23 03:12:16 2009 -0800 83.2 +++ b/src/share/vm/oops/constantPoolOop.hpp Wed Jan 06 22:21:39 2010 -0800 83.3 @@ -191,6 +191,16 @@ 83.4 } 83.5 } 83.6 83.7 + void object_at_put(int which, oop str) { 83.8 + oop_store((volatile oop*) obj_at_addr(which), str); 83.9 + release_tag_at_put(which, JVM_CONSTANT_Object); 83.10 + if (UseConcMarkSweepGC) { 83.11 + // In case the earlier card-mark was consumed by a concurrent 83.12 + // marking thread before the tag was updated, redirty the card. 83.13 + oop_store_without_check((volatile oop*) obj_at_addr(which), str); 83.14 + } 83.15 + } 83.16 + 83.17 // For temporary use while constructing constant pool 83.18 void string_index_at_put(int which, int string_index) { 83.19 tag_at_put(which, JVM_CONSTANT_StringIndex); 83.20 @@ -228,7 +238,8 @@ 83.21 tag.is_unresolved_klass() || 83.22 tag.is_symbol() || 83.23 tag.is_unresolved_string() || 83.24 - tag.is_string(); 83.25 + tag.is_string() || 83.26 + tag.is_object(); 83.27 } 83.28 83.29 // Fetching constants 83.30 @@ -291,6 +302,11 @@ 83.31 return string_at_impl(h_this, which, CHECK_NULL); 83.32 } 83.33 83.34 + oop object_at(int which) { 83.35 + assert(tag_at(which).is_object(), "Corrupted constant pool"); 83.36 + return *obj_at_addr(which); 83.37 + } 83.38 + 83.39 // A "pseudo-string" is an non-string oop that has found is way into 83.40 // a String entry. 83.41 // Under AnonymousClasses this can happen if the user patches a live
84.1 --- a/src/share/vm/oops/generateOopMap.cpp Wed Dec 23 03:12:16 2009 -0800 84.2 +++ b/src/share/vm/oops/generateOopMap.cpp Wed Jan 06 22:21:39 2010 -0800 84.3 @@ -1556,13 +1556,13 @@ 84.4 case Bytecodes::_getfield: do_field(true, false, itr->get_index_big(), itr->bci()); break; 84.5 case Bytecodes::_putfield: do_field(false, false, itr->get_index_big(), itr->bci()); break; 84.6 84.7 - case Bytecodes::_invokevirtual: 84.8 - case Bytecodes::_invokespecial: do_method(false, false, itr->get_index_big(), itr->bci()); break; 84.9 - case Bytecodes::_invokestatic: do_method(true, false, itr->get_index_big(), itr->bci()); break; 84.10 + case Bytecodes::_invokevirtual: 84.11 + case Bytecodes::_invokespecial: do_method(false, false, itr->get_index_big(), itr->bci()); break; 84.12 + case Bytecodes::_invokestatic: do_method(true, false, itr->get_index_big(), itr->bci()); break; 84.13 case Bytecodes::_invokedynamic: do_method(true, false, itr->get_index_int(), itr->bci()); break; 84.14 - case Bytecodes::_invokeinterface: do_method(false, true, itr->get_index_big(), itr->bci()); break; 84.15 - case Bytecodes::_newarray: 84.16 - case Bytecodes::_anewarray: pp_new_ref(vCTS, itr->bci()); break; 84.17 + case Bytecodes::_invokeinterface: do_method(false, true, itr->get_index_big(), itr->bci()); break; 84.18 + case Bytecodes::_newarray: 84.19 + case Bytecodes::_anewarray: pp_new_ref(vCTS, itr->bci()); break; 84.20 case Bytecodes::_checkcast: do_checkcast(); break; 84.21 case Bytecodes::_arraylength: 84.22 case Bytecodes::_instanceof: pp(rCTS, vCTS); break; 84.23 @@ -1830,12 +1830,8 @@ 84.24 84.25 84.26 void GenerateOopMap::do_ldc(int idx, int bci) { 84.27 - constantPoolOop cp = method()->constants(); 84.28 - constantTag tag = cp->tag_at(idx); 84.29 - 84.30 - CellTypeState cts = (tag.is_string() || tag.is_unresolved_string() || 84.31 - tag.is_klass() || tag.is_unresolved_klass()) 84.32 - ? CellTypeState::make_line_ref(bci) : valCTS; 84.33 + constantPoolOop cp = method()->constants(); 84.34 + CellTypeState cts = cp->is_pointer_entry(idx) ? CellTypeState::make_line_ref(bci) : valCTS; 84.35 ppush1(cts); 84.36 } 84.37
85.1 --- a/src/share/vm/oops/instanceKlass.cpp Wed Dec 23 03:12:16 2009 -0800 85.2 +++ b/src/share/vm/oops/instanceKlass.cpp Wed Jan 06 22:21:39 2010 -0800 85.3 @@ -383,7 +383,7 @@ 85.4 this_oop->set_initialization_state_and_notify(initialization_error, THREAD); 85.5 CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, class initialization error is thrown below 85.6 } 85.7 - if (e->is_a(SystemDictionary::error_klass())) { 85.8 + if (e->is_a(SystemDictionary::Error_klass())) { 85.9 THROW_OOP(e()); 85.10 } else { 85.11 JavaCallArguments args(e); 85.12 @@ -568,7 +568,7 @@ 85.13 THROW_MSG(throwError ? vmSymbols::java_lang_InstantiationError() 85.14 : vmSymbols::java_lang_InstantiationException(), external_name()); 85.15 } 85.16 - if (as_klassOop() == SystemDictionary::class_klass()) { 85.17 + if (as_klassOop() == SystemDictionary::Class_klass()) { 85.18 ResourceMark rm(THREAD); 85.19 THROW_MSG(throwError ? vmSymbols::java_lang_IllegalAccessError() 85.20 : vmSymbols::java_lang_IllegalAccessException(), external_name()); 85.21 @@ -2225,7 +2225,7 @@ 85.22 void instanceKlass::oop_print_on(oop obj, outputStream* st) { 85.23 Klass::oop_print_on(obj, st); 85.24 85.25 - if (as_klassOop() == SystemDictionary::string_klass()) { 85.26 + if (as_klassOop() == SystemDictionary::String_klass()) { 85.27 typeArrayOop value = java_lang_String::value(obj); 85.28 juint offset = java_lang_String::offset(obj); 85.29 juint length = java_lang_String::length(obj); 85.30 @@ -2245,7 +2245,7 @@ 85.31 FieldPrinter print_nonstatic_field(st, obj); 85.32 do_nonstatic_fields(&print_nonstatic_field); 85.33 85.34 - if (as_klassOop() == SystemDictionary::class_klass()) { 85.35 + if (as_klassOop() == SystemDictionary::Class_klass()) { 85.36 st->print(BULLET"signature: "); 85.37 java_lang_Class::print_signature(obj, st); 85.38 st->cr(); 85.39 @@ -2272,7 +2272,7 @@ 85.40 st->print("a "); 85.41 name()->print_value_on(st); 85.42 obj->print_address_on(st); 85.43 - if (as_klassOop() == SystemDictionary::string_klass() 85.44 + if (as_klassOop() == SystemDictionary::String_klass() 85.45 && java_lang_String::value(obj) != NULL) { 85.46 ResourceMark rm; 85.47 int len = java_lang_String::length(obj); 85.48 @@ -2281,7 +2281,7 @@ 85.49 st->print(" = \"%s\"", str); 85.50 if (len > plen) 85.51 st->print("...[%d]", len); 85.52 - } else if (as_klassOop() == SystemDictionary::class_klass()) { 85.53 + } else if (as_klassOop() == SystemDictionary::Class_klass()) { 85.54 klassOop k = java_lang_Class::as_klassOop(obj); 85.55 st->print(" = "); 85.56 if (k != NULL) { 85.57 @@ -2348,7 +2348,7 @@ 85.58 85.59 // Check that we have the right class 85.60 static bool first_time = true; 85.61 - guarantee(k == SystemDictionary::class_klass() && first_time, "Invalid verify of maps"); 85.62 + guarantee(k == SystemDictionary::Class_klass() && first_time, "Invalid verify of maps"); 85.63 first_time = false; 85.64 const int extra = java_lang_Class::number_of_fake_oop_fields; 85.65 guarantee(ik->nonstatic_field_size() == extra, "just checking");
86.1 --- a/src/share/vm/oops/instanceRefKlass.cpp Wed Dec 23 03:12:16 2009 -0800 86.2 +++ b/src/share/vm/oops/instanceRefKlass.cpp Wed Jan 06 22:21:39 2010 -0800 86.3 @@ -397,7 +397,7 @@ 86.4 86.5 // Check that we have the right class 86.6 debug_only(static bool first_time = true); 86.7 - assert(k == SystemDictionary::reference_klass() && first_time, 86.8 + assert(k == SystemDictionary::Reference_klass() && first_time, 86.9 "Invalid update of maps"); 86.10 debug_only(first_time = false); 86.11 assert(ik->nonstatic_oop_map_count() == 1, "just checking");
87.1 --- a/src/share/vm/oops/klass.cpp Wed Dec 23 03:12:16 2009 -0800 87.2 +++ b/src/share/vm/oops/klass.cpp Wed Jan 06 22:21:39 2010 -0800 87.3 @@ -217,8 +217,8 @@ 87.4 set_super(NULL); 87.5 oop_store_without_check((oop*) &_primary_supers[0], (oop) this->as_klassOop()); 87.6 assert(super_depth() == 0, "Object must already be initialized properly"); 87.7 - } else if (k != super() || k == SystemDictionary::object_klass()) { 87.8 - assert(super() == NULL || super() == SystemDictionary::object_klass(), 87.9 + } else if (k != super() || k == SystemDictionary::Object_klass()) { 87.10 + assert(super() == NULL || super() == SystemDictionary::Object_klass(), 87.11 "initialize this only once to a non-trivial value"); 87.12 set_super(k); 87.13 Klass* sup = k->klass_part(); 87.14 @@ -370,7 +370,7 @@ 87.15 void Klass::remove_from_sibling_list() { 87.16 // remove receiver from sibling list 87.17 instanceKlass* super = superklass(); 87.18 - assert(super != NULL || as_klassOop() == SystemDictionary::object_klass(), "should have super"); 87.19 + assert(super != NULL || as_klassOop() == SystemDictionary::Object_klass(), "should have super"); 87.20 if (super == NULL) return; // special case: class Object 87.21 if (super->subklass() == this) { 87.22 // first subklass
88.1 --- a/src/share/vm/oops/methodOop.cpp Wed Dec 23 03:12:16 2009 -0800 88.2 +++ b/src/share/vm/oops/methodOop.cpp Wed Jan 06 22:21:39 2010 -0800 88.3 @@ -456,12 +456,12 @@ 88.4 return objArrayHandle(THREAD, Universe::the_empty_class_klass_array()); 88.5 } else { 88.6 methodHandle h_this(THREAD, this_oop); 88.7 - objArrayOop m_oop = oopFactory::new_objArray(SystemDictionary::class_klass(), length, CHECK_(objArrayHandle())); 88.8 + objArrayOop m_oop = oopFactory::new_objArray(SystemDictionary::Class_klass(), length, CHECK_(objArrayHandle())); 88.9 objArrayHandle mirrors (THREAD, m_oop); 88.10 for (int i = 0; i < length; i++) { 88.11 CheckedExceptionElement* table = h_this->checked_exceptions_start(); // recompute on each iteration, not gc safe 88.12 klassOop k = h_this->constants()->klass_at(table[i].class_cp_index, CHECK_(objArrayHandle())); 88.13 - assert(Klass::cast(k)->is_subclass_of(SystemDictionary::throwable_klass()), "invalid exception class"); 88.14 + assert(Klass::cast(k)->is_subclass_of(SystemDictionary::Throwable_klass()), "invalid exception class"); 88.15 mirrors->obj_at_put(i, Klass::cast(k)->java_mirror()); 88.16 } 88.17 return mirrors; 88.18 @@ -1032,8 +1032,8 @@ 88.19 // We are loading classes eagerly. If a ClassNotFoundException or 88.20 // a LinkageError was generated, be sure to ignore it. 88.21 if (HAS_PENDING_EXCEPTION) { 88.22 - if (PENDING_EXCEPTION->is_a(SystemDictionary::classNotFoundException_klass()) || 88.23 - PENDING_EXCEPTION->is_a(SystemDictionary::linkageError_klass())) { 88.24 + if (PENDING_EXCEPTION->is_a(SystemDictionary::ClassNotFoundException_klass()) || 88.25 + PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) { 88.26 CLEAR_PENDING_EXCEPTION; 88.27 } else { 88.28 return false;
89.1 --- a/src/share/vm/oops/methodOop.hpp Wed Dec 23 03:12:16 2009 -0800 89.2 +++ b/src/share/vm/oops/methodOop.hpp Wed Jan 06 22:21:39 2010 -0800 89.3 @@ -365,6 +365,7 @@ 89.4 #endif 89.5 89.6 // byte codes 89.7 + void set_code(address code) { return constMethod()->set_code(code); } 89.8 address code_base() const { return constMethod()->code_base(); } 89.9 bool contains(address bcp) const { return constMethod()->contains(bcp); } 89.10
90.1 --- a/src/share/vm/oops/objArrayKlass.cpp Wed Dec 23 03:12:16 2009 -0800 90.2 +++ b/src/share/vm/oops/objArrayKlass.cpp Wed Jan 06 22:21:39 2010 -0800 90.3 @@ -246,8 +246,8 @@ 90.4 } else { 90.5 objArrayOop sec_oop = oopFactory::new_system_objArray(num_secondaries, CHECK_NULL); 90.6 objArrayHandle secondaries(THREAD, sec_oop); 90.7 - secondaries->obj_at_put(num_extra_slots+0, SystemDictionary::cloneable_klass()); 90.8 - secondaries->obj_at_put(num_extra_slots+1, SystemDictionary::serializable_klass()); 90.9 + secondaries->obj_at_put(num_extra_slots+0, SystemDictionary::Cloneable_klass()); 90.10 + secondaries->obj_at_put(num_extra_slots+1, SystemDictionary::Serializable_klass()); 90.11 for (int i = 0; i < num_elem_supers; i++) { 90.12 klassOop elem_super = (klassOop) elem_supers->obj_at(i); 90.13 klassOop array_super = elem_super->klass_part()->array_klass_or_null();
91.1 --- a/src/share/vm/oops/objArrayKlassKlass.cpp Wed Dec 23 03:12:16 2009 -0800 91.2 +++ b/src/share/vm/oops/objArrayKlassKlass.cpp Wed Jan 06 22:21:39 2010 -0800 91.3 @@ -99,7 +99,7 @@ 91.4 } 91.5 } else { 91.6 // The element type is already Object. Object[] has direct super of Object. 91.7 - super_klass = KlassHandle(THREAD, SystemDictionary::object_klass()); 91.8 + super_klass = KlassHandle(THREAD, SystemDictionary::Object_klass()); 91.9 } 91.10 } 91.11
92.1 --- a/src/share/vm/oops/symbolOop.cpp Wed Dec 23 03:12:16 2009 -0800 92.2 +++ b/src/share/vm/oops/symbolOop.cpp Wed Jan 06 22:21:39 2010 -0800 92.3 @@ -1,5 +1,5 @@ 92.4 /* 92.5 - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. 92.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 92.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 92.8 * 92.9 * This code is free software; you can redistribute it and/or modify it 92.10 @@ -25,6 +25,11 @@ 92.11 # include "incls/_precompiled.incl" 92.12 # include "incls/_symbolOop.cpp.incl" 92.13 92.14 + 92.15 +// ------------------------------------------------------------------ 92.16 +// symbolOopDesc::equals 92.17 +// 92.18 +// Compares the symbol with a string of the given length. 92.19 bool symbolOopDesc::equals(const char* str, int len) const { 92.20 int l = utf8_length(); 92.21 if (l != len) return false; 92.22 @@ -36,6 +41,48 @@ 92.23 return true; 92.24 } 92.25 92.26 + 92.27 +// ------------------------------------------------------------------ 92.28 +// symbolOopDesc::starts_with 92.29 +// 92.30 +// Tests if the symbol starts with the specified prefix of the given 92.31 +// length. 92.32 +bool symbolOopDesc::starts_with(const char* prefix, int len) const { 92.33 + if (len > utf8_length()) return false; 92.34 + while (len-- > 0) { 92.35 + if (prefix[len] != (char) byte_at(len)) 92.36 + return false; 92.37 + } 92.38 + assert(len == -1, "we should be at the beginning"); 92.39 + return true; 92.40 +} 92.41 + 92.42 + 92.43 +// ------------------------------------------------------------------ 92.44 +// symbolOopDesc::index_of 92.45 +// 92.46 +// Finds if the given string is a substring of this symbol's utf8 bytes. 92.47 +// Return -1 on failure. Otherwise return the first index where str occurs. 92.48 +int symbolOopDesc::index_of_at(int i, const char* str, int len) const { 92.49 + assert(i >= 0 && i <= utf8_length(), "oob"); 92.50 + if (len <= 0) return 0; 92.51 + char first_char = str[0]; 92.52 + address bytes = (address) ((symbolOopDesc*)this)->base(); 92.53 + address limit = bytes + utf8_length() - len; // inclusive limit 92.54 + address scan = bytes + i; 92.55 + if (scan > limit) 92.56 + return -1; 92.57 + for (;;) { 92.58 + scan = (address) memchr(scan, first_char, (limit + 1 - scan)); 92.59 + if (scan == NULL) 92.60 + return -1; // not found 92.61 + assert(scan >= bytes+i && scan <= limit, "scan oob"); 92.62 + if (memcmp(scan, str, len) == 0) 92.63 + return (int)(scan - bytes); 92.64 + } 92.65 +} 92.66 + 92.67 + 92.68 char* symbolOopDesc::as_C_string(char* buf, int size) const { 92.69 if (size > 0) { 92.70 int len = MIN2(size - 1, utf8_length());
93.1 --- a/src/share/vm/oops/symbolOop.hpp Wed Dec 23 03:12:16 2009 -0800 93.2 +++ b/src/share/vm/oops/symbolOop.hpp Wed Jan 06 22:21:39 2010 -0800 93.3 @@ -1,5 +1,5 @@ 93.4 /* 93.5 - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. 93.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 93.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 93.8 * 93.9 * This code is free software; you can redistribute it and/or modify it 93.10 @@ -70,8 +70,21 @@ 93.11 93.12 void set_utf8_length(int len) { _length = len; } 93.13 93.14 - // Compares the symbol with a string 93.15 + // Compares the symbol with a string. 93.16 bool equals(const char* str, int len) const; 93.17 + bool equals(const char* str) const { return equals(str, (int) strlen(str)); } 93.18 + 93.19 + // Tests if the symbol starts with the given prefix. 93.20 + bool starts_with(const char* prefix, int len) const; 93.21 + bool starts_with(const char* prefix) const { 93.22 + return starts_with(prefix, (int) strlen(prefix)); 93.23 + } 93.24 + 93.25 + // Tests if the symbol starts with the given prefix. 93.26 + int index_of_at(int i, const char* str, int len) const; 93.27 + int index_of_at(int i, const char* str) const { 93.28 + return index_of_at(i, str, (int) strlen(str)); 93.29 + } 93.30 93.31 // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg 93.32 // note that the ordering is not alfabetical
94.1 --- a/src/share/vm/opto/bytecodeInfo.cpp Wed Dec 23 03:12:16 2009 -0800 94.2 +++ b/src/share/vm/opto/bytecodeInfo.cpp Wed Jan 06 22:21:39 2010 -0800 94.3 @@ -180,6 +180,10 @@ 94.4 return NULL; 94.5 } 94.6 94.7 + // Always inline MethodHandle methods. 94.8 + if (callee_method->is_method_handle_invoke()) 94.9 + return NULL; 94.10 + 94.11 // First check all inlining restrictions which are required for correctness 94.12 if (callee_method->is_abstract()) return "abstract method"; 94.13 // note: we allow ik->is_abstract() 94.14 @@ -322,14 +326,17 @@ 94.15 // stricter than callee_holder->is_initialized() 94.16 ciBytecodeStream iter(caller_method); 94.17 iter.force_bci(caller_bci); 94.18 - int index = iter.get_index_int(); 94.19 - if( !caller_method->is_klass_loaded(index, true) ) { 94.20 - return false; 94.21 - } 94.22 - // Try to do constant pool resolution if running Xcomp 94.23 Bytecodes::Code call_bc = iter.cur_bc(); 94.24 - if( !caller_method->check_call(index, call_bc == Bytecodes::_invokestatic) ) { 94.25 - return false; 94.26 + // An invokedynamic instruction does not have a klass. 94.27 + if (call_bc != Bytecodes::_invokedynamic) { 94.28 + int index = iter.get_index_int(); 94.29 + if (!caller_method->is_klass_loaded(index, true)) { 94.30 + return false; 94.31 + } 94.32 + // Try to do constant pool resolution if running Xcomp 94.33 + if( !caller_method->check_call(index, call_bc == Bytecodes::_invokestatic) ) { 94.34 + return false; 94.35 + } 94.36 } 94.37 } 94.38 // We will attempt to see if a class/field/etc got properly loaded. If it
95.1 --- a/src/share/vm/opto/callGenerator.cpp Wed Dec 23 03:12:16 2009 -0800 95.2 +++ b/src/share/vm/opto/callGenerator.cpp Wed Jan 06 22:21:39 2010 -0800 95.3 @@ -1,5 +1,5 @@ 95.4 /* 95.5 - * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. 95.6 + * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. 95.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 95.8 * 95.9 * This code is free software; you can redistribute it and/or modify it 95.10 @@ -136,6 +136,8 @@ 95.11 } 95.12 // Mark the call node as virtual, sort of: 95.13 call->set_optimized_virtual(true); 95.14 + if (method()->is_method_handle_invoke()) 95.15 + call->set_method_handle_invoke(true); 95.16 } 95.17 kit.set_arguments_for_java_call(call); 95.18 kit.set_edges_for_java_call(call, false, _separate_io_proj); 95.19 @@ -145,6 +147,71 @@ 95.20 return kit.transfer_exceptions_into_jvms(); 95.21 } 95.22 95.23 +//---------------------------DynamicCallGenerator----------------------------- 95.24 +// Internal class which handles all out-of-line invokedynamic calls. 95.25 +class DynamicCallGenerator : public CallGenerator { 95.26 +public: 95.27 + DynamicCallGenerator(ciMethod* method) 95.28 + : CallGenerator(method) 95.29 + { 95.30 + } 95.31 + virtual JVMState* generate(JVMState* jvms); 95.32 +}; 95.33 + 95.34 +JVMState* DynamicCallGenerator::generate(JVMState* jvms) { 95.35 + GraphKit kit(jvms); 95.36 + 95.37 + if (kit.C->log() != NULL) { 95.38 + kit.C->log()->elem("dynamic_call bci='%d'", jvms->bci()); 95.39 + } 95.40 + 95.41 + // Get the constant pool cache from the caller class. 95.42 + ciMethod* caller_method = jvms->method(); 95.43 + ciBytecodeStream str(caller_method); 95.44 + str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci. 95.45 + assert(str.cur_bc() == Bytecodes::_invokedynamic, "wrong place to issue a dynamic call!"); 95.46 + ciCPCache* cpcache = str.get_cpcache(); 95.47 + 95.48 + // Get the offset of the CallSite from the constant pool cache 95.49 + // pointer. 95.50 + int index = str.get_method_index(); 95.51 + size_t call_site_offset = cpcache->get_f1_offset(index); 95.52 + 95.53 + // Load the CallSite object from the constant pool cache. 95.54 + const TypeOopPtr* cpcache_ptr = TypeOopPtr::make_from_constant(cpcache); 95.55 + Node* cpcache_adr = kit.makecon(cpcache_ptr); 95.56 + Node* call_site_adr = kit.basic_plus_adr(cpcache_adr, cpcache_adr, call_site_offset); 95.57 + Node* call_site = kit.make_load(kit.control(), call_site_adr, TypeInstPtr::BOTTOM, T_OBJECT, Compile::AliasIdxRaw); 95.58 + 95.59 + // Load the target MethodHandle from the CallSite object. 95.60 + Node* target_mh_adr = kit.basic_plus_adr(call_site, call_site, java_dyn_CallSite::target_offset_in_bytes()); 95.61 + Node* target_mh = kit.make_load(kit.control(), target_mh_adr, TypeInstPtr::BOTTOM, T_OBJECT); 95.62 + 95.63 + address resolve_stub = SharedRuntime::get_resolve_opt_virtual_call_stub(); 95.64 + 95.65 + CallStaticJavaNode *call = new (kit.C, tf()->domain()->cnt()) CallStaticJavaNode(tf(), resolve_stub, method(), kit.bci()); 95.66 + // invokedynamic is treated as an optimized invokevirtual. 95.67 + call->set_optimized_virtual(true); 95.68 + // Take extra care (in the presence of argument motion) not to trash the SP: 95.69 + call->set_method_handle_invoke(true); 95.70 + 95.71 + // Pass the target MethodHandle as first argument and shift the 95.72 + // other arguments. 95.73 + call->init_req(0 + TypeFunc::Parms, target_mh); 95.74 + uint nargs = call->method()->arg_size(); 95.75 + for (uint i = 1; i < nargs; i++) { 95.76 + Node* arg = kit.argument(i - 1); 95.77 + call->init_req(i + TypeFunc::Parms, arg); 95.78 + } 95.79 + 95.80 + kit.set_edges_for_java_call(call); 95.81 + Node* ret = kit.set_results_for_java_call(call); 95.82 + kit.push_node(method()->return_type()->basic_type(), ret); 95.83 + return kit.transfer_exceptions_into_jvms(); 95.84 +} 95.85 + 95.86 +//--------------------------VirtualCallGenerator------------------------------ 95.87 +// Internal class which handles all out-of-line calls checking receiver type. 95.88 class VirtualCallGenerator : public CallGenerator { 95.89 private: 95.90 int _vtable_index; 95.91 @@ -159,8 +226,6 @@ 95.92 virtual JVMState* generate(JVMState* jvms); 95.93 }; 95.94 95.95 -//--------------------------VirtualCallGenerator------------------------------ 95.96 -// Internal class which handles all out-of-line calls checking receiver type. 95.97 JVMState* VirtualCallGenerator::generate(JVMState* jvms) { 95.98 GraphKit kit(jvms); 95.99 Node* receiver = kit.argument(0); 95.100 @@ -253,8 +318,14 @@ 95.101 return new DirectCallGenerator(m, separate_io_proj); 95.102 } 95.103 95.104 +CallGenerator* CallGenerator::for_dynamic_call(ciMethod* m) { 95.105 + assert(m->is_method_handle_invoke(), "for_dynamic_call mismatch"); 95.106 + return new DynamicCallGenerator(m); 95.107 +} 95.108 + 95.109 CallGenerator* CallGenerator::for_virtual_call(ciMethod* m, int vtable_index) { 95.110 assert(!m->is_static(), "for_virtual_call mismatch"); 95.111 + assert(!m->is_method_handle_invoke(), "should be a direct call"); 95.112 return new VirtualCallGenerator(m, vtable_index); 95.113 } 95.114 95.115 @@ -576,6 +647,155 @@ 95.116 } 95.117 95.118 95.119 +//------------------------PredictedDynamicCallGenerator----------------------- 95.120 +// Internal class which handles all out-of-line calls checking receiver type. 95.121 +class PredictedDynamicCallGenerator : public CallGenerator { 95.122 + ciMethodHandle* _predicted_method_handle; 95.123 + CallGenerator* _if_missed; 95.124 + CallGenerator* _if_hit; 95.125 + float _hit_prob; 95.126 + 95.127 +public: 95.128 + PredictedDynamicCallGenerator(ciMethodHandle* predicted_method_handle, 95.129 + CallGenerator* if_missed, 95.130 + CallGenerator* if_hit, 95.131 + float hit_prob) 95.132 + : CallGenerator(if_missed->method()), 95.133 + _predicted_method_handle(predicted_method_handle), 95.134 + _if_missed(if_missed), 95.135 + _if_hit(if_hit), 95.136 + _hit_prob(hit_prob) 95.137 + {} 95.138 + 95.139 + virtual bool is_inline() const { return _if_hit->is_inline(); } 95.140 + virtual bool is_deferred() const { return _if_hit->is_deferred(); } 95.141 + 95.142 + virtual JVMState* generate(JVMState* jvms); 95.143 +}; 95.144 + 95.145 + 95.146 +CallGenerator* CallGenerator::for_predicted_dynamic_call(ciMethodHandle* predicted_method_handle, 95.147 + CallGenerator* if_missed, 95.148 + CallGenerator* if_hit, 95.149 + float hit_prob) { 95.150 + return new PredictedDynamicCallGenerator(predicted_method_handle, if_missed, if_hit, hit_prob); 95.151 +} 95.152 + 95.153 + 95.154 +JVMState* PredictedDynamicCallGenerator::generate(JVMState* jvms) { 95.155 + GraphKit kit(jvms); 95.156 + PhaseGVN& gvn = kit.gvn(); 95.157 + 95.158 + CompileLog* log = kit.C->log(); 95.159 + if (log != NULL) { 95.160 + log->elem("predicted_dynamic_call bci='%d'", jvms->bci()); 95.161 + } 95.162 + 95.163 + // Get the constant pool cache from the caller class. 95.164 + ciMethod* caller_method = jvms->method(); 95.165 + ciBytecodeStream str(caller_method); 95.166 + str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci. 95.167 + ciCPCache* cpcache = str.get_cpcache(); 95.168 + 95.169 + // Get the offset of the CallSite from the constant pool cache 95.170 + // pointer. 95.171 + int index = str.get_method_index(); 95.172 + size_t call_site_offset = cpcache->get_f1_offset(index); 95.173 + 95.174 + // Load the CallSite object from the constant pool cache. 95.175 + const TypeOopPtr* cpcache_ptr = TypeOopPtr::make_from_constant(cpcache); 95.176 + Node* cpcache_adr = kit.makecon(cpcache_ptr); 95.177 + Node* call_site_adr = kit.basic_plus_adr(cpcache_adr, cpcache_adr, call_site_offset); 95.178 + Node* call_site = kit.make_load(kit.control(), call_site_adr, TypeInstPtr::BOTTOM, T_OBJECT, Compile::AliasIdxRaw); 95.179 + 95.180 + // Load the target MethodHandle from the CallSite object. 95.181 + Node* target_adr = kit.basic_plus_adr(call_site, call_site, java_dyn_CallSite::target_offset_in_bytes()); 95.182 + Node* target_mh = kit.make_load(kit.control(), target_adr, TypeInstPtr::BOTTOM, T_OBJECT); 95.183 + 95.184 + // Check if the MethodHandle is still the same. 95.185 + const TypeOopPtr* predicted_mh_ptr = TypeOopPtr::make_from_constant(_predicted_method_handle, true); 95.186 + Node* predicted_mh = kit.makecon(predicted_mh_ptr); 95.187 + 95.188 + Node* cmp = gvn.transform(new(kit.C, 3) CmpPNode(target_mh, predicted_mh)); 95.189 + Node* bol = gvn.transform(new(kit.C, 2) BoolNode(cmp, BoolTest::eq) ); 95.190 + IfNode* iff = kit.create_and_xform_if(kit.control(), bol, _hit_prob, COUNT_UNKNOWN); 95.191 + kit.set_control( gvn.transform(new(kit.C, 1) IfTrueNode (iff))); 95.192 + Node* slow_ctl = gvn.transform(new(kit.C, 1) IfFalseNode(iff)); 95.193 + 95.194 + SafePointNode* slow_map = NULL; 95.195 + JVMState* slow_jvms; 95.196 + { PreserveJVMState pjvms(&kit); 95.197 + kit.set_control(slow_ctl); 95.198 + if (!kit.stopped()) { 95.199 + slow_jvms = _if_missed->generate(kit.sync_jvms()); 95.200 + assert(slow_jvms != NULL, "miss path must not fail to generate"); 95.201 + kit.add_exception_states_from(slow_jvms); 95.202 + kit.set_map(slow_jvms->map()); 95.203 + if (!kit.stopped()) 95.204 + slow_map = kit.stop(); 95.205 + } 95.206 + } 95.207 + 95.208 + if (kit.stopped()) { 95.209 + // Instance exactly does not matches the desired type. 95.210 + kit.set_jvms(slow_jvms); 95.211 + return kit.transfer_exceptions_into_jvms(); 95.212 + } 95.213 + 95.214 + // Make the hot call: 95.215 + JVMState* new_jvms = _if_hit->generate(kit.sync_jvms()); 95.216 + if (new_jvms == NULL) { 95.217 + // Inline failed, so make a direct call. 95.218 + assert(_if_hit->is_inline(), "must have been a failed inline"); 95.219 + CallGenerator* cg = CallGenerator::for_direct_call(_if_hit->method()); 95.220 + new_jvms = cg->generate(kit.sync_jvms()); 95.221 + } 95.222 + kit.add_exception_states_from(new_jvms); 95.223 + kit.set_jvms(new_jvms); 95.224 + 95.225 + // Need to merge slow and fast? 95.226 + if (slow_map == NULL) { 95.227 + // The fast path is the only path remaining. 95.228 + return kit.transfer_exceptions_into_jvms(); 95.229 + } 95.230 + 95.231 + if (kit.stopped()) { 95.232 + // Inlined method threw an exception, so it's just the slow path after all. 95.233 + kit.set_jvms(slow_jvms); 95.234 + return kit.transfer_exceptions_into_jvms(); 95.235 + } 95.236 + 95.237 + // Finish the diamond. 95.238 + kit.C->set_has_split_ifs(true); // Has chance for split-if optimization 95.239 + RegionNode* region = new (kit.C, 3) RegionNode(3); 95.240 + region->init_req(1, kit.control()); 95.241 + region->init_req(2, slow_map->control()); 95.242 + kit.set_control(gvn.transform(region)); 95.243 + Node* iophi = PhiNode::make(region, kit.i_o(), Type::ABIO); 95.244 + iophi->set_req(2, slow_map->i_o()); 95.245 + kit.set_i_o(gvn.transform(iophi)); 95.246 + kit.merge_memory(slow_map->merged_memory(), region, 2); 95.247 + uint tos = kit.jvms()->stkoff() + kit.sp(); 95.248 + uint limit = slow_map->req(); 95.249 + for (uint i = TypeFunc::Parms; i < limit; i++) { 95.250 + // Skip unused stack slots; fast forward to monoff(); 95.251 + if (i == tos) { 95.252 + i = kit.jvms()->monoff(); 95.253 + if( i >= limit ) break; 95.254 + } 95.255 + Node* m = kit.map()->in(i); 95.256 + Node* n = slow_map->in(i); 95.257 + if (m != n) { 95.258 + const Type* t = gvn.type(m)->meet(gvn.type(n)); 95.259 + Node* phi = PhiNode::make(region, m, t); 95.260 + phi->set_req(2, n); 95.261 + kit.map()->set_req(i, gvn.transform(phi)); 95.262 + } 95.263 + } 95.264 + return kit.transfer_exceptions_into_jvms(); 95.265 +} 95.266 + 95.267 + 95.268 //-------------------------UncommonTrapCallGenerator----------------------------- 95.269 // Internal class which handles all out-of-line calls checking receiver type. 95.270 class UncommonTrapCallGenerator : public CallGenerator {
96.1 --- a/src/share/vm/opto/callGenerator.hpp Wed Dec 23 03:12:16 2009 -0800 96.2 +++ b/src/share/vm/opto/callGenerator.hpp Wed Jan 06 22:21:39 2010 -0800 96.3 @@ -100,6 +100,7 @@ 96.4 96.5 // How to generate vanilla out-of-line call sites: 96.6 static CallGenerator* for_direct_call(ciMethod* m, bool separate_io_projs = false); // static, special 96.7 + static CallGenerator* for_dynamic_call(ciMethod* m); // invokedynamic 96.8 static CallGenerator* for_virtual_call(ciMethod* m, int vtable_index); // virtual, interface 96.9 96.10 // How to generate a replace a direct call with an inline version 96.11 @@ -116,6 +117,12 @@ 96.12 CallGenerator* if_hit, 96.13 float hit_prob); 96.14 96.15 + // How to make a call that optimistically assumes a MethodHandle target: 96.16 + static CallGenerator* for_predicted_dynamic_call(ciMethodHandle* predicted_method_handle, 96.17 + CallGenerator* if_missed, 96.18 + CallGenerator* if_hit, 96.19 + float hit_prob); 96.20 + 96.21 // How to make a call that gives up and goes back to the interpreter: 96.22 static CallGenerator* for_uncommon_trap(ciMethod* m, 96.23 Deoptimization::DeoptReason reason,
97.1 --- a/src/share/vm/opto/callnode.hpp Wed Dec 23 03:12:16 2009 -0800 97.2 +++ b/src/share/vm/opto/callnode.hpp Wed Jan 06 22:21:39 2010 -0800 97.3 @@ -562,12 +562,15 @@ 97.4 virtual uint size_of() const; // Size is bigger 97.5 97.6 bool _optimized_virtual; 97.7 + bool _method_handle_invoke; 97.8 ciMethod* _method; // Method being direct called 97.9 public: 97.10 const int _bci; // Byte Code Index of call byte code 97.11 CallJavaNode(const TypeFunc* tf , address addr, ciMethod* method, int bci) 97.12 : CallNode(tf, addr, TypePtr::BOTTOM), 97.13 - _method(method), _bci(bci), _optimized_virtual(false) 97.14 + _method(method), _bci(bci), 97.15 + _optimized_virtual(false), 97.16 + _method_handle_invoke(false) 97.17 { 97.18 init_class_id(Class_CallJava); 97.19 } 97.20 @@ -577,6 +580,8 @@ 97.21 void set_method(ciMethod *m) { _method = m; } 97.22 void set_optimized_virtual(bool f) { _optimized_virtual = f; } 97.23 bool is_optimized_virtual() const { return _optimized_virtual; } 97.24 + void set_method_handle_invoke(bool f) { _method_handle_invoke = f; } 97.25 + bool is_method_handle_invoke() const { return _method_handle_invoke; } 97.26 97.27 #ifndef PRODUCT 97.28 virtual void dump_spec(outputStream *st) const;
98.1 --- a/src/share/vm/opto/doCall.cpp Wed Dec 23 03:12:16 2009 -0800 98.2 +++ b/src/share/vm/opto/doCall.cpp Wed Jan 06 22:21:39 2010 -0800 98.3 @@ -224,6 +224,57 @@ 98.4 } 98.5 } 98.6 98.7 + // Do MethodHandle calls. 98.8 + if (call_method->is_method_handle_invoke()) { 98.9 + if (jvms->method()->java_code_at_bci(jvms->bci()) != Bytecodes::_invokedynamic) { 98.10 + GraphKit kit(jvms); 98.11 + Node* n = kit.argument(0); 98.12 + 98.13 + if (n->Opcode() == Op_ConP) { 98.14 + const TypeOopPtr* oop_ptr = n->bottom_type()->is_oopptr(); 98.15 + ciObject* const_oop = oop_ptr->const_oop(); 98.16 + ciMethodHandle* method_handle = const_oop->as_method_handle(); 98.17 + 98.18 + // Set the actually called method to have access to the class 98.19 + // and signature in the MethodHandleCompiler. 98.20 + method_handle->set_callee(call_method); 98.21 + 98.22 + // Get an adapter for the MethodHandle. 98.23 + ciMethod* target_method = method_handle->get_method_handle_adapter(); 98.24 + 98.25 + CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 98.26 + if (hit_cg != NULL && hit_cg->is_inline()) 98.27 + return hit_cg; 98.28 + } 98.29 + 98.30 + return CallGenerator::for_direct_call(call_method); 98.31 + } 98.32 + else { 98.33 + // Get the MethodHandle from the CallSite. 98.34 + ciMethod* caller_method = jvms->method(); 98.35 + ciBytecodeStream str(caller_method); 98.36 + str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci. 98.37 + ciCallSite* call_site = str.get_call_site(); 98.38 + ciMethodHandle* method_handle = call_site->get_target(); 98.39 + 98.40 + // Set the actually called method to have access to the class 98.41 + // and signature in the MethodHandleCompiler. 98.42 + method_handle->set_callee(call_method); 98.43 + 98.44 + // Get an adapter for the MethodHandle. 98.45 + ciMethod* target_method = method_handle->get_invokedynamic_adapter(); 98.46 + 98.47 + CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); 98.48 + if (hit_cg != NULL && hit_cg->is_inline()) { 98.49 + CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method); 98.50 + return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor); 98.51 + } 98.52 + 98.53 + // If something failed, generate a normal dynamic call. 98.54 + return CallGenerator::for_dynamic_call(call_method); 98.55 + } 98.56 + } 98.57 + 98.58 // There was no special inlining tactic, or it bailed out. 98.59 // Use a more generic tactic, like a simple call. 98.60 if (call_is_virtual) { 98.61 @@ -299,7 +350,7 @@ 98.62 // Interface classes can be loaded & linked and never get around to 98.63 // being initialized. Uncommon-trap for not-initialized static or 98.64 // v-calls. Let interface calls happen. 98.65 - ciInstanceKlass* holder_klass = dest_method->holder(); 98.66 + ciInstanceKlass* holder_klass = dest_method->holder(); 98.67 if (!holder_klass->is_initialized() && 98.68 !holder_klass->is_interface()) { 98.69 uncommon_trap(Deoptimization::Reason_uninitialized, 98.70 @@ -307,14 +358,6 @@ 98.71 holder_klass); 98.72 return true; 98.73 } 98.74 - if (dest_method->is_method_handle_invoke() 98.75 - && holder_klass->name() == ciSymbol::java_dyn_Dynamic()) { 98.76 - // FIXME: NYI 98.77 - uncommon_trap(Deoptimization::Reason_unhandled, 98.78 - Deoptimization::Action_none, 98.79 - holder_klass); 98.80 - return true; 98.81 - } 98.82 98.83 assert(dest_method->will_link(method()->holder(), klass, bc()), "dest_method: typeflow responsibility"); 98.84 return false; 98.85 @@ -333,6 +376,7 @@ 98.86 bool is_virtual = bc() == Bytecodes::_invokevirtual; 98.87 bool is_virtual_or_interface = is_virtual || bc() == Bytecodes::_invokeinterface; 98.88 bool has_receiver = is_virtual_or_interface || bc() == Bytecodes::_invokespecial; 98.89 + bool is_invokedynamic = bc() == Bytecodes::_invokedynamic; 98.90 98.91 // Find target being called 98.92 bool will_link; 98.93 @@ -341,7 +385,8 @@ 98.94 ciKlass* holder = iter().get_declared_method_holder(); 98.95 ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder); 98.96 98.97 - int nargs = dest_method->arg_size(); 98.98 + int nargs = dest_method->arg_size(); 98.99 + if (is_invokedynamic) nargs -= 1; 98.100 98.101 // uncommon-trap when callee is unloaded, uninitialized or will not link 98.102 // bailout when too many arguments for register representation 98.103 @@ -355,7 +400,7 @@ 98.104 return; 98.105 } 98.106 assert(holder_klass->is_loaded(), ""); 98.107 - assert(dest_method->is_static() == !has_receiver, "must match bc"); 98.108 + assert((dest_method->is_static() || is_invokedynamic) == !has_receiver , "must match bc"); 98.109 // Note: this takes into account invokeinterface of methods declared in java/lang/Object, 98.110 // which should be invokevirtuals but according to the VM spec may be invokeinterfaces 98.111 assert(holder_klass->is_interface() || holder_klass->super() == NULL || (bc() != Bytecodes::_invokeinterface), "must match bc");
99.1 --- a/src/share/vm/opto/escape.cpp Wed Dec 23 03:12:16 2009 -0800 99.2 +++ b/src/share/vm/opto/escape.cpp Wed Jan 06 22:21:39 2010 -0800 99.3 @@ -1916,7 +1916,7 @@ 99.4 Node *arg = call->in(i)->uncast(); 99.5 99.6 if (at->isa_oopptr() != NULL && 99.7 - ptnode_adr(arg->_idx)->escape_state() < PointsToNode::ArgEscape) { 99.8 + ptnode_adr(arg->_idx)->escape_state() < PointsToNode::GlobalEscape) { 99.9 99.10 bool global_escapes = false; 99.11 bool fields_escapes = false;
100.1 --- a/src/share/vm/opto/graphKit.cpp Wed Dec 23 03:12:16 2009 -0800 100.2 +++ b/src/share/vm/opto/graphKit.cpp Wed Jan 06 22:21:39 2010 -0800 100.3 @@ -981,14 +981,19 @@ 100.4 case Bytecodes::_invokedynamic: 100.5 case Bytecodes::_invokeinterface: 100.6 { 100.7 - bool is_static = (depth == 0); 100.8 bool ignore; 100.9 ciBytecodeStream iter(method()); 100.10 iter.reset_to_bci(bci()); 100.11 iter.next(); 100.12 ciMethod* method = iter.get_method(ignore); 100.13 inputs = method->arg_size_no_receiver(); 100.14 - if (!is_static) inputs += 1; 100.15 + // Add a receiver argument, maybe: 100.16 + if (code != Bytecodes::_invokestatic && 100.17 + code != Bytecodes::_invokedynamic) 100.18 + inputs += 1; 100.19 + // (Do not use ciMethod::arg_size(), because 100.20 + // it might be an unloaded method, which doesn't 100.21 + // know whether it is static or not.) 100.22 int size = method->return_type()->size(); 100.23 depth = size - inputs; 100.24 }
101.1 --- a/src/share/vm/opto/lcm.cpp Wed Dec 23 03:12:16 2009 -0800 101.2 +++ b/src/share/vm/opto/lcm.cpp Wed Jan 06 22:21:39 2010 -0800 101.3 @@ -542,6 +542,16 @@ 101.4 // pointers as far as the kill mask goes. 101.5 bool exclude_soe = op == Op_CallRuntime; 101.6 101.7 + // If the call is a MethodHandle invoke, we need to exclude the 101.8 + // register which is used to save the SP value over MH invokes from 101.9 + // the mask. Otherwise this register could be used for 101.10 + // deoptimization information. 101.11 + if (op == Op_CallStaticJava) { 101.12 + MachCallStaticJavaNode* mcallstaticjava = (MachCallStaticJavaNode*) mcall; 101.13 + if (mcallstaticjava->_method_handle_invoke) 101.14 + proj->_rout.OR(Matcher::method_handle_invoke_SP_save_mask()); 101.15 + } 101.16 + 101.17 // Fill in the kill mask for the call 101.18 for( OptoReg::Name r = OptoReg::Name(0); r < _last_Mach_Reg; r=OptoReg::add(r,1) ) { 101.19 if( !regs.Member(r) ) { // Not already defined by the call
102.1 --- a/src/share/vm/opto/machnode.cpp Wed Dec 23 03:12:16 2009 -0800 102.2 +++ b/src/share/vm/opto/machnode.cpp Wed Jan 06 22:21:39 2010 -0800 102.3 @@ -636,7 +636,9 @@ 102.4 } 102.5 #ifndef PRODUCT 102.6 void MachCallJavaNode::dump_spec(outputStream *st) const { 102.7 - if( _method ) { 102.8 + if (_method_handle_invoke) 102.9 + st->print("MethodHandle "); 102.10 + if (_method) { 102.11 _method->print_short_name(st); 102.12 st->print(" "); 102.13 } 102.14 @@ -644,6 +646,20 @@ 102.15 } 102.16 #endif 102.17 102.18 +//------------------------------Registers-------------------------------------- 102.19 +const RegMask &MachCallJavaNode::in_RegMask(uint idx) const { 102.20 + // Values in the domain use the users calling convention, embodied in the 102.21 + // _in_rms array of RegMasks. 102.22 + if (idx < tf()->domain()->cnt()) return _in_rms[idx]; 102.23 + // Values outside the domain represent debug info 102.24 + Matcher* m = Compile::current()->matcher(); 102.25 + // If this call is a MethodHandle invoke we have to use a different 102.26 + // debugmask which does not include the register we use to save the 102.27 + // SP over MH invokes. 102.28 + RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask; 102.29 + return *debugmask[in(idx)->ideal_reg()]; 102.30 +} 102.31 + 102.32 //============================================================================= 102.33 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); } 102.34 uint MachCallStaticJavaNode::cmp( const Node &n ) const {
103.1 --- a/src/share/vm/opto/machnode.hpp Wed Dec 23 03:12:16 2009 -0800 103.2 +++ b/src/share/vm/opto/machnode.hpp Wed Jan 06 22:21:39 2010 -0800 103.3 @@ -662,9 +662,13 @@ 103.4 ciMethod* _method; // Method being direct called 103.5 int _bci; // Byte Code index of call byte code 103.6 bool _optimized_virtual; // Tells if node is a static call or an optimized virtual 103.7 + bool _method_handle_invoke; // Tells if the call has to preserve SP 103.8 MachCallJavaNode() : MachCallNode() { 103.9 init_class_id(Class_MachCallJava); 103.10 } 103.11 + 103.12 + virtual const RegMask &in_RegMask(uint) const; 103.13 + 103.14 #ifndef PRODUCT 103.15 virtual void dump_spec(outputStream *st) const; 103.16 #endif
104.1 --- a/src/share/vm/opto/matcher.cpp Wed Dec 23 03:12:16 2009 -0800 104.2 +++ b/src/share/vm/opto/matcher.cpp Wed Jan 06 22:21:39 2010 -0800 104.3 @@ -70,19 +70,27 @@ 104.4 _dontcare(&_states_arena) { 104.5 C->set_matcher(this); 104.6 104.7 - idealreg2spillmask[Op_RegI] = NULL; 104.8 - idealreg2spillmask[Op_RegN] = NULL; 104.9 - idealreg2spillmask[Op_RegL] = NULL; 104.10 - idealreg2spillmask[Op_RegF] = NULL; 104.11 - idealreg2spillmask[Op_RegD] = NULL; 104.12 - idealreg2spillmask[Op_RegP] = NULL; 104.13 + idealreg2spillmask [Op_RegI] = NULL; 104.14 + idealreg2spillmask [Op_RegN] = NULL; 104.15 + idealreg2spillmask [Op_RegL] = NULL; 104.16 + idealreg2spillmask [Op_RegF] = NULL; 104.17 + idealreg2spillmask [Op_RegD] = NULL; 104.18 + idealreg2spillmask [Op_RegP] = NULL; 104.19 104.20 - idealreg2debugmask[Op_RegI] = NULL; 104.21 - idealreg2debugmask[Op_RegN] = NULL; 104.22 - idealreg2debugmask[Op_RegL] = NULL; 104.23 - idealreg2debugmask[Op_RegF] = NULL; 104.24 - idealreg2debugmask[Op_RegD] = NULL; 104.25 - idealreg2debugmask[Op_RegP] = NULL; 104.26 + idealreg2debugmask [Op_RegI] = NULL; 104.27 + idealreg2debugmask [Op_RegN] = NULL; 104.28 + idealreg2debugmask [Op_RegL] = NULL; 104.29 + idealreg2debugmask [Op_RegF] = NULL; 104.30 + idealreg2debugmask [Op_RegD] = NULL; 104.31 + idealreg2debugmask [Op_RegP] = NULL; 104.32 + 104.33 + idealreg2mhdebugmask[Op_RegI] = NULL; 104.34 + idealreg2mhdebugmask[Op_RegN] = NULL; 104.35 + idealreg2mhdebugmask[Op_RegL] = NULL; 104.36 + idealreg2mhdebugmask[Op_RegF] = NULL; 104.37 + idealreg2mhdebugmask[Op_RegD] = NULL; 104.38 + idealreg2mhdebugmask[Op_RegP] = NULL; 104.39 + 104.40 debug_only(_mem_node = NULL;) // Ideal memory node consumed by mach node 104.41 } 104.42 104.43 @@ -389,19 +397,28 @@ 104.44 void Matcher::init_first_stack_mask() { 104.45 104.46 // Allocate storage for spill masks as masks for the appropriate load type. 104.47 - RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask)*12); 104.48 - idealreg2spillmask[Op_RegN] = &rms[0]; 104.49 - idealreg2spillmask[Op_RegI] = &rms[1]; 104.50 - idealreg2spillmask[Op_RegL] = &rms[2]; 104.51 - idealreg2spillmask[Op_RegF] = &rms[3]; 104.52 - idealreg2spillmask[Op_RegD] = &rms[4]; 104.53 - idealreg2spillmask[Op_RegP] = &rms[5]; 104.54 - idealreg2debugmask[Op_RegN] = &rms[6]; 104.55 - idealreg2debugmask[Op_RegI] = &rms[7]; 104.56 - idealreg2debugmask[Op_RegL] = &rms[8]; 104.57 - idealreg2debugmask[Op_RegF] = &rms[9]; 104.58 - idealreg2debugmask[Op_RegD] = &rms[10]; 104.59 - idealreg2debugmask[Op_RegP] = &rms[11]; 104.60 + RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask) * 3*6); 104.61 + 104.62 + idealreg2spillmask [Op_RegN] = &rms[0]; 104.63 + idealreg2spillmask [Op_RegI] = &rms[1]; 104.64 + idealreg2spillmask [Op_RegL] = &rms[2]; 104.65 + idealreg2spillmask [Op_RegF] = &rms[3]; 104.66 + idealreg2spillmask [Op_RegD] = &rms[4]; 104.67 + idealreg2spillmask [Op_RegP] = &rms[5]; 104.68 + 104.69 + idealreg2debugmask [Op_RegN] = &rms[6]; 104.70 + idealreg2debugmask [Op_RegI] = &rms[7]; 104.71 + idealreg2debugmask [Op_RegL] = &rms[8]; 104.72 + idealreg2debugmask [Op_RegF] = &rms[9]; 104.73 + idealreg2debugmask [Op_RegD] = &rms[10]; 104.74 + idealreg2debugmask [Op_RegP] = &rms[11]; 104.75 + 104.76 + idealreg2mhdebugmask[Op_RegN] = &rms[12]; 104.77 + idealreg2mhdebugmask[Op_RegI] = &rms[13]; 104.78 + idealreg2mhdebugmask[Op_RegL] = &rms[14]; 104.79 + idealreg2mhdebugmask[Op_RegF] = &rms[15]; 104.80 + idealreg2mhdebugmask[Op_RegD] = &rms[16]; 104.81 + idealreg2mhdebugmask[Op_RegP] = &rms[17]; 104.82 104.83 OptoReg::Name i; 104.84 104.85 @@ -442,12 +459,19 @@ 104.86 // Make up debug masks. Any spill slot plus callee-save registers. 104.87 // Caller-save registers are assumed to be trashable by the various 104.88 // inline-cache fixup routines. 104.89 - *idealreg2debugmask[Op_RegN]= *idealreg2spillmask[Op_RegN]; 104.90 - *idealreg2debugmask[Op_RegI]= *idealreg2spillmask[Op_RegI]; 104.91 - *idealreg2debugmask[Op_RegL]= *idealreg2spillmask[Op_RegL]; 104.92 - *idealreg2debugmask[Op_RegF]= *idealreg2spillmask[Op_RegF]; 104.93 - *idealreg2debugmask[Op_RegD]= *idealreg2spillmask[Op_RegD]; 104.94 - *idealreg2debugmask[Op_RegP]= *idealreg2spillmask[Op_RegP]; 104.95 + *idealreg2debugmask [Op_RegN]= *idealreg2spillmask[Op_RegN]; 104.96 + *idealreg2debugmask [Op_RegI]= *idealreg2spillmask[Op_RegI]; 104.97 + *idealreg2debugmask [Op_RegL]= *idealreg2spillmask[Op_RegL]; 104.98 + *idealreg2debugmask [Op_RegF]= *idealreg2spillmask[Op_RegF]; 104.99 + *idealreg2debugmask [Op_RegD]= *idealreg2spillmask[Op_RegD]; 104.100 + *idealreg2debugmask [Op_RegP]= *idealreg2spillmask[Op_RegP]; 104.101 + 104.102 + *idealreg2mhdebugmask[Op_RegN]= *idealreg2spillmask[Op_RegN]; 104.103 + *idealreg2mhdebugmask[Op_RegI]= *idealreg2spillmask[Op_RegI]; 104.104 + *idealreg2mhdebugmask[Op_RegL]= *idealreg2spillmask[Op_RegL]; 104.105 + *idealreg2mhdebugmask[Op_RegF]= *idealreg2spillmask[Op_RegF]; 104.106 + *idealreg2mhdebugmask[Op_RegD]= *idealreg2spillmask[Op_RegD]; 104.107 + *idealreg2mhdebugmask[Op_RegP]= *idealreg2spillmask[Op_RegP]; 104.108 104.109 // Prevent stub compilations from attempting to reference 104.110 // callee-saved registers from debug info 104.111 @@ -458,14 +482,31 @@ 104.112 if( _register_save_policy[i] == 'C' || 104.113 _register_save_policy[i] == 'A' || 104.114 (_register_save_policy[i] == 'E' && exclude_soe) ) { 104.115 - idealreg2debugmask[Op_RegN]->Remove(i); 104.116 - idealreg2debugmask[Op_RegI]->Remove(i); // Exclude save-on-call 104.117 - idealreg2debugmask[Op_RegL]->Remove(i); // registers from debug 104.118 - idealreg2debugmask[Op_RegF]->Remove(i); // masks 104.119 - idealreg2debugmask[Op_RegD]->Remove(i); 104.120 - idealreg2debugmask[Op_RegP]->Remove(i); 104.121 + idealreg2debugmask [Op_RegN]->Remove(i); 104.122 + idealreg2debugmask [Op_RegI]->Remove(i); // Exclude save-on-call 104.123 + idealreg2debugmask [Op_RegL]->Remove(i); // registers from debug 104.124 + idealreg2debugmask [Op_RegF]->Remove(i); // masks 104.125 + idealreg2debugmask [Op_RegD]->Remove(i); 104.126 + idealreg2debugmask [Op_RegP]->Remove(i); 104.127 + 104.128 + idealreg2mhdebugmask[Op_RegN]->Remove(i); 104.129 + idealreg2mhdebugmask[Op_RegI]->Remove(i); 104.130 + idealreg2mhdebugmask[Op_RegL]->Remove(i); 104.131 + idealreg2mhdebugmask[Op_RegF]->Remove(i); 104.132 + idealreg2mhdebugmask[Op_RegD]->Remove(i); 104.133 + idealreg2mhdebugmask[Op_RegP]->Remove(i); 104.134 } 104.135 } 104.136 + 104.137 + // Subtract the register we use to save the SP for MethodHandle 104.138 + // invokes to from the debug mask. 104.139 + const RegMask save_mask = method_handle_invoke_SP_save_mask(); 104.140 + idealreg2mhdebugmask[Op_RegN]->SUBTRACT(save_mask); 104.141 + idealreg2mhdebugmask[Op_RegI]->SUBTRACT(save_mask); 104.142 + idealreg2mhdebugmask[Op_RegL]->SUBTRACT(save_mask); 104.143 + idealreg2mhdebugmask[Op_RegF]->SUBTRACT(save_mask); 104.144 + idealreg2mhdebugmask[Op_RegD]->SUBTRACT(save_mask); 104.145 + idealreg2mhdebugmask[Op_RegP]->SUBTRACT(save_mask); 104.146 } 104.147 104.148 //---------------------------is_save_on_entry---------------------------------- 104.149 @@ -989,6 +1030,7 @@ 104.150 CallNode *call; 104.151 const TypeTuple *domain; 104.152 ciMethod* method = NULL; 104.153 + bool is_method_handle_invoke = false; // for special kill effects 104.154 if( sfpt->is_Call() ) { 104.155 call = sfpt->as_Call(); 104.156 domain = call->tf()->domain(); 104.157 @@ -1013,6 +1055,8 @@ 104.158 mcall_java->_method = method; 104.159 mcall_java->_bci = call_java->_bci; 104.160 mcall_java->_optimized_virtual = call_java->is_optimized_virtual(); 104.161 + is_method_handle_invoke = call_java->is_method_handle_invoke(); 104.162 + mcall_java->_method_handle_invoke = is_method_handle_invoke; 104.163 if( mcall_java->is_MachCallStaticJava() ) 104.164 mcall_java->as_MachCallStaticJava()->_name = 104.165 call_java->as_CallStaticJava()->_name; 104.166 @@ -1126,6 +1170,15 @@ 104.167 mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area; 104.168 } 104.169 104.170 + if (is_method_handle_invoke) { 104.171 + // Kill some extra stack space in case method handles want to do 104.172 + // a little in-place argument insertion. 104.173 + int regs_per_word = NOT_LP64(1) LP64_ONLY(2); // %%% make a global const! 104.174 + out_arg_limit_per_call += MethodHandlePushLimit * regs_per_word; 104.175 + // Do not update mcall->_argsize because (a) the extra space is not 104.176 + // pushed as arguments and (b) _argsize is dead (not used anywhere). 104.177 + } 104.178 + 104.179 // Compute the max stack slot killed by any call. These will not be 104.180 // available for debug info, and will be used to adjust FIRST_STACK_mask 104.181 // after all call sites have been visited.
105.1 --- a/src/share/vm/opto/matcher.hpp Wed Dec 23 03:12:16 2009 -0800 105.2 +++ b/src/share/vm/opto/matcher.hpp Wed Jan 06 22:21:39 2010 -0800 105.3 @@ -117,8 +117,9 @@ 105.4 static const int base2reg[]; // Map Types to machine register types 105.5 // Convert ideal machine register to a register mask for spill-loads 105.6 static const RegMask *idealreg2regmask[]; 105.7 - RegMask *idealreg2spillmask[_last_machine_leaf]; 105.8 - RegMask *idealreg2debugmask[_last_machine_leaf]; 105.9 + RegMask *idealreg2spillmask [_last_machine_leaf]; 105.10 + RegMask *idealreg2debugmask [_last_machine_leaf]; 105.11 + RegMask *idealreg2mhdebugmask[_last_machine_leaf]; 105.12 void init_spill_mask( Node *ret ); 105.13 // Convert machine register number to register mask 105.14 static uint mreg2regmask_max; 105.15 @@ -297,6 +298,8 @@ 105.16 // Register for MODL projection of divmodL 105.17 static RegMask modL_proj_mask(); 105.18 105.19 + static const RegMask method_handle_invoke_SP_save_mask(); 105.20 + 105.21 // Java-Interpreter calling convention 105.22 // (what you use when calling between compiled-Java and Interpreted-Java 105.23
106.1 --- a/src/share/vm/opto/output.cpp Wed Dec 23 03:12:16 2009 -0800 106.2 +++ b/src/share/vm/opto/output.cpp Wed Jan 06 22:21:39 2010 -0800 106.3 @@ -794,6 +794,7 @@ 106.4 #endif 106.5 106.6 int safepoint_pc_offset = current_offset; 106.7 + bool is_method_handle_invoke = false; 106.8 106.9 // Add the safepoint in the DebugInfoRecorder 106.10 if( !mach->is_MachCall() ) { 106.11 @@ -801,6 +802,11 @@ 106.12 debug_info()->add_safepoint(safepoint_pc_offset, sfn->_oop_map); 106.13 } else { 106.14 mcall = mach->as_MachCall(); 106.15 + 106.16 + // Is the call a MethodHandle call? 106.17 + if (mcall->is_MachCallJava()) 106.18 + is_method_handle_invoke = mcall->as_MachCallJava()->_method_handle_invoke; 106.19 + 106.20 safepoint_pc_offset += mcall->ret_addr_offset(); 106.21 debug_info()->add_safepoint(safepoint_pc_offset, mcall->_oop_map); 106.22 } 106.23 @@ -911,9 +917,9 @@ 106.24 ciMethod* scope_method = method ? method : _method; 106.25 // Describe the scope here 106.26 assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI"); 106.27 - assert(!jvms->should_reexecute() || depth==max_depth, "reexecute allowed only for the youngest"); 106.28 + assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest"); 106.29 // Now we can describe the scope. 106.30 - debug_info()->describe_scope(safepoint_pc_offset,scope_method,jvms->bci(),jvms->should_reexecute(),locvals,expvals,monvals); 106.31 + debug_info()->describe_scope(safepoint_pc_offset, scope_method, jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, locvals, expvals, monvals); 106.32 } // End jvms loop 106.33 106.34 // Mark the end of the scope set.
107.1 --- a/src/share/vm/opto/parse3.cpp Wed Dec 23 03:12:16 2009 -0800 107.2 +++ b/src/share/vm/opto/parse3.cpp Wed Jan 06 22:21:39 2010 -0800 107.3 @@ -125,7 +125,25 @@ 107.4 107.5 void Parse::do_get_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field) { 107.6 // Does this field have a constant value? If so, just push the value. 107.7 - if (field->is_constant() && push_constant(field->constant_value())) return; 107.8 + if (field->is_constant()) { 107.9 + if (field->is_static()) { 107.10 + // final static field 107.11 + if (push_constant(field->constant_value())) 107.12 + return; 107.13 + } 107.14 + else { 107.15 + // final non-static field of a trusted class ({java,sun}.dyn 107.16 + // classes). 107.17 + if (obj->is_Con()) { 107.18 + const TypeOopPtr* oop_ptr = obj->bottom_type()->isa_oopptr(); 107.19 + ciObject* constant_oop = oop_ptr->const_oop(); 107.20 + ciConstant constant = field->constant_value_of(constant_oop); 107.21 + 107.22 + if (push_constant(constant, true)) 107.23 + return; 107.24 + } 107.25 + } 107.26 + } 107.27 107.28 ciType* field_klass = field->type(); 107.29 bool is_vol = field->is_volatile(); 107.30 @@ -145,7 +163,7 @@ 107.31 if (!field->type()->is_loaded()) { 107.32 type = TypeInstPtr::BOTTOM; 107.33 must_assert_null = true; 107.34 - } else if (field->is_constant()) { 107.35 + } else if (field->is_constant() && field->is_static()) { 107.36 // This can happen if the constant oop is non-perm. 107.37 ciObject* con = field->constant_value().as_object(); 107.38 // Do not "join" in the previous type; it doesn't add value,
108.1 --- a/src/share/vm/opto/runtime.cpp Wed Dec 23 03:12:16 2009 -0800 108.2 +++ b/src/share/vm/opto/runtime.cpp Wed Jan 06 22:21:39 2010 -0800 108.3 @@ -1,5 +1,5 @@ 108.4 /* 108.5 - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. 108.6 + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. 108.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 108.8 * 108.9 * This code is free software; you can redistribute it and/or modify it 108.10 @@ -790,7 +790,7 @@ 108.11 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); 108.12 108.13 #ifdef ASSERT 108.14 - if (!(exception->is_a(SystemDictionary::throwable_klass()))) { 108.15 + if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { 108.16 // should throw an exception here 108.17 ShouldNotReachHere(); 108.18 } 108.19 @@ -858,6 +858,9 @@ 108.20 thread->set_exception_pc(pc); 108.21 thread->set_exception_handler_pc(handler_address); 108.22 thread->set_exception_stack_size(0); 108.23 + 108.24 + // Check if the exception PC is a MethodHandle call. 108.25 + thread->set_is_method_handle_exception(nm->is_method_handle_return(pc)); 108.26 } 108.27 108.28 // Restore correct return pc. Was saved above. 108.29 @@ -936,7 +939,7 @@ 108.30 #endif 108.31 assert (exception != NULL, "should have thrown a NULLPointerException"); 108.32 #ifdef ASSERT 108.33 - if (!(exception->is_a(SystemDictionary::throwable_klass()))) { 108.34 + if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { 108.35 // should throw an exception here 108.36 ShouldNotReachHere(); 108.37 }
109.1 --- a/src/share/vm/opto/type.cpp Wed Dec 23 03:12:16 2009 -0800 109.2 +++ b/src/share/vm/opto/type.cpp Wed Jan 06 22:21:39 2010 -0800 109.3 @@ -2431,7 +2431,7 @@ 109.4 //------------------------------make_from_constant----------------------------- 109.5 // Make a java pointer from an oop constant 109.6 const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) { 109.7 - if (o->is_method_data() || o->is_method()) { 109.8 + if (o->is_method_data() || o->is_method() || o->is_cpcache()) { 109.9 // Treat much like a typeArray of bytes, like below, but fake the type... 109.10 const Type* etype = (Type*)get_const_basic_type(T_BYTE); 109.11 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS); 109.12 @@ -3966,7 +3966,7 @@ 109.13 const TypeFunc* tf = C->last_tf(method); // check cache 109.14 if (tf != NULL) return tf; // The hit rate here is almost 50%. 109.15 const TypeTuple *domain; 109.16 - if (method->flags().is_static()) { 109.17 + if (method->is_static()) { 109.18 domain = TypeTuple::make_domain(NULL, method->signature()); 109.19 } else { 109.20 domain = TypeTuple::make_domain(method->holder(), method->signature());
110.1 --- a/src/share/vm/prims/jni.cpp Wed Dec 23 03:12:16 2009 -0800 110.2 +++ b/src/share/vm/prims/jni.cpp Wed Jan 06 22:21:39 2010 -0800 110.3 @@ -396,11 +396,11 @@ 110.4 oop mirror = NULL; 110.5 int slot = 0; 110.6 110.7 - if (reflected->klass() == SystemDictionary::reflect_constructor_klass()) { 110.8 + if (reflected->klass() == SystemDictionary::reflect_Constructor_klass()) { 110.9 mirror = java_lang_reflect_Constructor::clazz(reflected); 110.10 slot = java_lang_reflect_Constructor::slot(reflected); 110.11 } else { 110.12 - assert(reflected->klass() == SystemDictionary::reflect_method_klass(), "wrong type"); 110.13 + assert(reflected->klass() == SystemDictionary::reflect_Method_klass(), "wrong type"); 110.14 mirror = java_lang_reflect_Method::clazz(reflected); 110.15 slot = java_lang_reflect_Method::slot(reflected); 110.16 } 110.17 @@ -496,7 +496,7 @@ 110.18 klassOop super = Klass::cast(k)->java_super(); 110.19 // super2 is the value computed by the compiler's getSuperClass intrinsic: 110.20 debug_only(klassOop super2 = ( Klass::cast(k)->oop_is_javaArray() 110.21 - ? SystemDictionary::object_klass() 110.22 + ? SystemDictionary::Object_klass() 110.23 : Klass::cast(k)->super() ) ); 110.24 assert(super == super2, 110.25 "java_super computation depends on interface, array, other super"); 110.26 @@ -584,7 +584,7 @@ 110.27 if (thread->has_pending_exception()) { 110.28 Handle ex(thread, thread->pending_exception()); 110.29 thread->clear_pending_exception(); 110.30 - if (ex->is_a(SystemDictionary::threaddeath_klass())) { 110.31 + if (ex->is_a(SystemDictionary::ThreadDeath_klass())) { 110.32 // Don't print anything if we are being killed. 110.33 } else { 110.34 jio_fprintf(defaultStream::error_stream(), "Exception "); 110.35 @@ -593,12 +593,12 @@ 110.36 jio_fprintf(defaultStream::error_stream(), 110.37 "in thread \"%s\" ", thread->get_thread_name()); 110.38 } 110.39 - if (ex->is_a(SystemDictionary::throwable_klass())) { 110.40 + if (ex->is_a(SystemDictionary::Throwable_klass())) { 110.41 JavaValue result(T_VOID); 110.42 JavaCalls::call_virtual(&result, 110.43 ex, 110.44 KlassHandle(THREAD, 110.45 - SystemDictionary::throwable_klass()), 110.46 + SystemDictionary::Throwable_klass()), 110.47 vmSymbolHandles::printStackTrace_name(), 110.48 vmSymbolHandles::void_method_signature(), 110.49 THREAD); 110.50 @@ -3241,7 +3241,7 @@ 110.51 jint b = Atomic::xchg(0xdeadbeef, &a); 110.52 void *c = &a; 110.53 void *d = Atomic::xchg_ptr(&b, &c); 110.54 - assert(a == 0xdeadbeef && b == (jint) 0xcafebabe, "Atomic::xchg() works"); 110.55 + assert(a == (jint) 0xdeadbeef && b == (jint) 0xcafebabe, "Atomic::xchg() works"); 110.56 assert(c == &b && d == &a, "Atomic::xchg_ptr() works"); 110.57 } 110.58 #endif // ZERO && ASSERT
111.1 --- a/src/share/vm/prims/jniCheck.cpp Wed Dec 23 03:12:16 2009 -0800 111.2 +++ b/src/share/vm/prims/jniCheck.cpp Wed Jan 06 22:21:39 2010 -0800 111.3 @@ -341,7 +341,7 @@ 111.4 ReportJNIFatalError(thr, fatal_received_null_class); 111.5 } 111.6 111.7 - if (mirror->klass() != SystemDictionary::class_klass()) { 111.8 + if (mirror->klass() != SystemDictionary::Class_klass()) { 111.9 ReportJNIFatalError(thr, fatal_class_not_a_class); 111.10 } 111.11 111.12 @@ -358,7 +358,7 @@ 111.13 assert(klass != NULL, "klass argument must have a value"); 111.14 111.15 if (!Klass::cast(klass)->oop_is_instance() || 111.16 - !instanceKlass::cast(klass)->is_subclass_of(SystemDictionary::throwable_klass())) { 111.17 + !instanceKlass::cast(klass)->is_subclass_of(SystemDictionary::Throwable_klass())) { 111.18 ReportJNIFatalError(thr, fatal_class_not_a_throwable_class); 111.19 } 111.20 }
112.1 --- a/src/share/vm/prims/jvm.cpp Wed Dec 23 03:12:16 2009 -0800 112.2 +++ b/src/share/vm/prims/jvm.cpp Wed Jan 06 22:21:39 2010 -0800 112.3 @@ -80,7 +80,7 @@ 112.4 112.5 while (!vfst.at_end()) { 112.6 methodOop m = vfst.method(); 112.7 - if (!vfst.method()->method_holder()->klass_part()->is_subclass_of(SystemDictionary::classloader_klass())&& 112.8 + if (!vfst.method()->method_holder()->klass_part()->is_subclass_of(SystemDictionary::ClassLoader_klass())&& 112.9 !vfst.method()->method_holder()->klass_part()->is_subclass_of(access_controller_klass) && 112.10 !vfst.method()->method_holder()->klass_part()->is_subclass_of(privileged_action_klass)) { 112.11 break; 112.12 @@ -257,7 +257,7 @@ 112.13 Handle value_str = java_lang_String::create_from_platform_dependent_str((value != NULL ? value : ""), CHECK); 112.14 JavaCalls::call_virtual(&r, 112.15 props, 112.16 - KlassHandle(THREAD, SystemDictionary::properties_klass()), 112.17 + KlassHandle(THREAD, SystemDictionary::Properties_klass()), 112.18 vmSymbolHandles::put_name(), 112.19 vmSymbolHandles::object_object_object_signature(), 112.20 key_str, 112.21 @@ -495,7 +495,7 @@ 112.22 guarantee(klass->is_cloneable(), "all arrays are cloneable"); 112.23 } else { 112.24 guarantee(obj->is_instance(), "should be instanceOop"); 112.25 - bool cloneable = klass->is_subtype_of(SystemDictionary::cloneable_klass()); 112.26 + bool cloneable = klass->is_subtype_of(SystemDictionary::Cloneable_klass()); 112.27 guarantee(cloneable == klass->is_cloneable(), "incorrect cloneable flag"); 112.28 } 112.29 #endif 112.30 @@ -908,7 +908,7 @@ 112.31 // Special handling for primitive objects 112.32 if (java_lang_Class::is_primitive(mirror)) { 112.33 // Primitive objects does not have any interfaces 112.34 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::class_klass(), 0, CHECK_NULL); 112.35 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_NULL); 112.36 return (jobjectArray) JNIHandles::make_local(env, r); 112.37 } 112.38 112.39 @@ -923,7 +923,7 @@ 112.40 } 112.41 112.42 // Allocate result array 112.43 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::class_klass(), size, CHECK_NULL); 112.44 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), size, CHECK_NULL); 112.45 objArrayHandle result (THREAD, r); 112.46 // Fill in result 112.47 if (klass->oop_is_instance()) { 112.48 @@ -934,8 +934,8 @@ 112.49 } 112.50 } else { 112.51 // All arrays implement java.lang.Cloneable and java.io.Serializable 112.52 - result->obj_at_put(0, Klass::cast(SystemDictionary::cloneable_klass())->java_mirror()); 112.53 - result->obj_at_put(1, Klass::cast(SystemDictionary::serializable_klass())->java_mirror()); 112.54 + result->obj_at_put(0, Klass::cast(SystemDictionary::Cloneable_klass())->java_mirror()); 112.55 + result->obj_at_put(1, Klass::cast(SystemDictionary::Serializable_klass())->java_mirror()); 112.56 } 112.57 return (jobjectArray) JNIHandles::make_local(env, result()); 112.58 JVM_END 112.59 @@ -1098,8 +1098,8 @@ 112.60 pending_exception = Handle(THREAD, PENDING_EXCEPTION); 112.61 CLEAR_PENDING_EXCEPTION; 112.62 112.63 - if ( pending_exception->is_a(SystemDictionary::exception_klass()) && 112.64 - !pending_exception->is_a(SystemDictionary::runtime_exception_klass())) { 112.65 + if ( pending_exception->is_a(SystemDictionary::Exception_klass()) && 112.66 + !pending_exception->is_a(SystemDictionary::RuntimeException_klass())) { 112.67 // Throw a java.security.PrivilegedActionException(Exception e) exception 112.68 JavaCallArguments args(pending_exception); 112.69 THROW_ARG_0(vmSymbolHandles::java_security_PrivilegedActionException(), 112.70 @@ -1190,7 +1190,7 @@ 112.71 112.72 // the resource area must be registered in case of a gc 112.73 RegisterArrayForGC ragc(thread, local_array); 112.74 - objArrayOop context = oopFactory::new_objArray(SystemDictionary::protectionDomain_klass(), 112.75 + objArrayOop context = oopFactory::new_objArray(SystemDictionary::ProtectionDomain_klass(), 112.76 local_array->length(), CHECK_NULL); 112.77 objArrayHandle h_context(thread, context); 112.78 for (int index = 0; index < local_array->length(); index++) { 112.79 @@ -1251,7 +1251,7 @@ 112.80 112.81 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) || 112.82 ! Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) { 112.83 - oop result = oopFactory::new_objArray(SystemDictionary::class_klass(), 0, CHECK_NULL); 112.84 + oop result = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_NULL); 112.85 return (jobjectArray)JNIHandles::make_local(env, result); 112.86 } 112.87 112.88 @@ -1259,7 +1259,7 @@ 112.89 112.90 if (k->inner_classes()->length() == 0) { 112.91 // Neither an inner nor outer class 112.92 - oop result = oopFactory::new_objArray(SystemDictionary::class_klass(), 0, CHECK_NULL); 112.93 + oop result = oopFactory::new_objArray(SystemDictionary::Class_klass(), 0, CHECK_NULL); 112.94 return (jobjectArray)JNIHandles::make_local(env, result); 112.95 } 112.96 112.97 @@ -1269,7 +1269,7 @@ 112.98 int length = icls->length(); 112.99 112.100 // Allocate temp. result array 112.101 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::class_klass(), length/4, CHECK_NULL); 112.102 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), length/4, CHECK_NULL); 112.103 objArrayHandle result (THREAD, r); 112.104 int members = 0; 112.105 112.106 @@ -1299,7 +1299,7 @@ 112.107 112.108 if (members != length) { 112.109 // Return array of right length 112.110 - objArrayOop res = oopFactory::new_objArray(SystemDictionary::class_klass(), members, CHECK_NULL); 112.111 + objArrayOop res = oopFactory::new_objArray(SystemDictionary::Class_klass(), members, CHECK_NULL); 112.112 for(int i = 0; i < members; i++) { 112.113 res->obj_at_put(i, result->obj_at(i)); 112.114 } 112.115 @@ -1470,11 +1470,11 @@ 112.116 oop mirror = NULL; 112.117 int slot = 0; 112.118 112.119 - if (reflected->klass() == SystemDictionary::reflect_constructor_klass()) { 112.120 + if (reflected->klass() == SystemDictionary::reflect_Constructor_klass()) { 112.121 mirror = java_lang_reflect_Constructor::clazz(reflected); 112.122 slot = java_lang_reflect_Constructor::slot(reflected); 112.123 } else { 112.124 - assert(reflected->klass() == SystemDictionary::reflect_method_klass(), 112.125 + assert(reflected->klass() == SystemDictionary::reflect_Method_klass(), 112.126 "wrong type"); 112.127 mirror = java_lang_reflect_Method::clazz(reflected); 112.128 slot = java_lang_reflect_Method::slot(reflected); 112.129 @@ -1530,7 +1530,7 @@ 112.130 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) || 112.131 Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) { 112.132 // Return empty array 112.133 - oop res = oopFactory::new_objArray(SystemDictionary::reflect_field_klass(), 0, CHECK_NULL); 112.134 + oop res = oopFactory::new_objArray(SystemDictionary::reflect_Field_klass(), 0, CHECK_NULL); 112.135 return (jobjectArray) JNIHandles::make_local(env, res); 112.136 } 112.137 112.138 @@ -1558,13 +1558,13 @@ 112.139 } else { 112.140 num_fields = fields_len / instanceKlass::next_offset; 112.141 112.142 - if (k() == SystemDictionary::throwable_klass()) { 112.143 + if (k() == SystemDictionary::Throwable_klass()) { 112.144 num_fields--; 112.145 skip_backtrace = true; 112.146 } 112.147 } 112.148 112.149 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_field_klass(), num_fields, CHECK_NULL); 112.150 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Field_klass(), num_fields, CHECK_NULL); 112.151 objArrayHandle result (THREAD, r); 112.152 112.153 int out_idx = 0; 112.154 @@ -1598,7 +1598,7 @@ 112.155 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) 112.156 || Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) { 112.157 // Return empty array 112.158 - oop res = oopFactory::new_objArray(SystemDictionary::reflect_method_klass(), 0, CHECK_NULL); 112.159 + oop res = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), 0, CHECK_NULL); 112.160 return (jobjectArray) JNIHandles::make_local(env, res); 112.161 } 112.162 112.163 @@ -1622,7 +1622,7 @@ 112.164 } 112.165 112.166 // Allocate result 112.167 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_method_klass(), num_methods, CHECK_NULL); 112.168 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), num_methods, CHECK_NULL); 112.169 objArrayHandle result (THREAD, r); 112.170 112.171 int out_idx = 0; 112.172 @@ -1650,7 +1650,7 @@ 112.173 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) 112.174 || Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) { 112.175 // Return empty array 112.176 - oop res = oopFactory::new_objArray(SystemDictionary::reflect_constructor_klass(), 0 , CHECK_NULL); 112.177 + oop res = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), 0 , CHECK_NULL); 112.178 return (jobjectArray) JNIHandles::make_local(env, res); 112.179 } 112.180 112.181 @@ -1674,7 +1674,7 @@ 112.182 } 112.183 112.184 // Allocate result 112.185 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_constructor_klass(), num_constructors, CHECK_NULL); 112.186 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), num_constructors, CHECK_NULL); 112.187 objArrayHandle result(THREAD, r); 112.188 112.189 int out_idx = 0; 112.190 @@ -1887,7 +1887,7 @@ 112.191 symbolHandle klass_name (THREAD, cp->klass_name_at(klass_ref)); 112.192 symbolHandle member_name(THREAD, cp->uncached_name_ref_at(index)); 112.193 symbolHandle member_sig (THREAD, cp->uncached_signature_ref_at(index)); 112.194 - objArrayOop dest_o = oopFactory::new_objArray(SystemDictionary::string_klass(), 3, CHECK_NULL); 112.195 + objArrayOop dest_o = oopFactory::new_objArray(SystemDictionary::String_klass(), 3, CHECK_NULL); 112.196 objArrayHandle dest(THREAD, dest_o); 112.197 Handle str = java_lang_String::create_from_symbol(klass_name, CHECK_NULL); 112.198 dest->obj_at_put(0, str()); 112.199 @@ -2575,7 +2575,7 @@ 112.200 JavaValue result(T_VOID); 112.201 JavaCalls::call_virtual(&result, 112.202 obj, 112.203 - KlassHandle(THREAD, SystemDictionary::thread_klass()), 112.204 + KlassHandle(THREAD, SystemDictionary::Thread_klass()), 112.205 vmSymbolHandles::run_method_name(), 112.206 vmSymbolHandles::void_method_signature(), 112.207 THREAD); 112.208 @@ -2673,7 +2673,7 @@ 112.209 // Fix for 4314342, 4145910, perhaps others: it now doesn't have 112.210 // any effect on the "liveness" of a thread; see 112.211 // JVM_IsThreadAlive, below. 112.212 - if (java_throwable->is_a(SystemDictionary::threaddeath_klass())) { 112.213 + if (java_throwable->is_a(SystemDictionary::ThreadDeath_klass())) { 112.214 java_lang_Thread::set_stillborn(java_thread); 112.215 } 112.216 THROW_OOP(java_throwable); 112.217 @@ -3028,7 +3028,7 @@ 112.218 } 112.219 112.220 // Create result array of type [Ljava/lang/Class; 112.221 - objArrayOop result = oopFactory::new_objArray(SystemDictionary::class_klass(), depth, CHECK_NULL); 112.222 + objArrayOop result = oopFactory::new_objArray(SystemDictionary::Class_klass(), depth, CHECK_NULL); 112.223 // Fill in mirrors corresponding to method holders 112.224 int index = 0; 112.225 while (first != NULL) { 112.226 @@ -4324,7 +4324,7 @@ 112.227 JvmtiVMObjectAllocEventCollector oam; 112.228 112.229 int num_threads = tle.num_threads(); 112.230 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::thread_klass(), num_threads, CHECK_NULL); 112.231 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::Thread_klass(), num_threads, CHECK_NULL); 112.232 objArrayHandle threads_ah(THREAD, r); 112.233 112.234 for (int i = 0; i < num_threads; i++) { 112.235 @@ -4358,7 +4358,7 @@ 112.236 112.237 // check if threads is not an array of objects of Thread class 112.238 klassOop k = objArrayKlass::cast(ah->klass())->element_klass(); 112.239 - if (k != SystemDictionary::thread_klass()) { 112.240 + if (k != SystemDictionary::Thread_klass()) { 112.241 THROW_(vmSymbols::java_lang_IllegalArgumentException(), 0); 112.242 } 112.243 112.244 @@ -4418,7 +4418,7 @@ 112.245 if (encl_method_class_idx == 0) { 112.246 return NULL; 112.247 } 112.248 - objArrayOop dest_o = oopFactory::new_objArray(SystemDictionary::object_klass(), 3, CHECK_NULL); 112.249 + objArrayOop dest_o = oopFactory::new_objArray(SystemDictionary::Object_klass(), 3, CHECK_NULL); 112.250 objArrayHandle dest(THREAD, dest_o); 112.251 klassOop enc_k = ik_h->constants()->klass_at(encl_method_class_idx, CHECK_NULL); 112.252 dest->obj_at_put(0, Klass::cast(enc_k)->java_mirror()); 112.253 @@ -4532,7 +4532,7 @@ 112.254 values_h->int_at(0) == java_lang_Thread::NEW, 112.255 "Invalid threadStatus value"); 112.256 112.257 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::string_klass(), 112.258 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), 112.259 1, /* only 1 substate */ 112.260 CHECK_NULL); 112.261 names_h = objArrayHandle(THREAD, r); 112.262 @@ -4545,7 +4545,7 @@ 112.263 values_h->int_at(0) == java_lang_Thread::RUNNABLE, 112.264 "Invalid threadStatus value"); 112.265 112.266 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::string_klass(), 112.267 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), 112.268 1, /* only 1 substate */ 112.269 CHECK_NULL); 112.270 names_h = objArrayHandle(THREAD, r); 112.271 @@ -4558,7 +4558,7 @@ 112.272 values_h->int_at(0) == java_lang_Thread::BLOCKED_ON_MONITOR_ENTER, 112.273 "Invalid threadStatus value"); 112.274 112.275 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::string_klass(), 112.276 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), 112.277 1, /* only 1 substate */ 112.278 CHECK_NULL); 112.279 names_h = objArrayHandle(THREAD, r); 112.280 @@ -4571,7 +4571,7 @@ 112.281 values_h->int_at(0) == java_lang_Thread::IN_OBJECT_WAIT && 112.282 values_h->int_at(1) == java_lang_Thread::PARKED, 112.283 "Invalid threadStatus value"); 112.284 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::string_klass(), 112.285 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), 112.286 2, /* number of substates */ 112.287 CHECK_NULL); 112.288 names_h = objArrayHandle(THREAD, r); 112.289 @@ -4589,7 +4589,7 @@ 112.290 values_h->int_at(1) == java_lang_Thread::IN_OBJECT_WAIT_TIMED && 112.291 values_h->int_at(2) == java_lang_Thread::PARKED_TIMED, 112.292 "Invalid threadStatus value"); 112.293 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::string_klass(), 112.294 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), 112.295 3, /* number of substates */ 112.296 CHECK_NULL); 112.297 names_h = objArrayHandle(THREAD, r); 112.298 @@ -4608,7 +4608,7 @@ 112.299 assert(values_h->length() == 1 && 112.300 values_h->int_at(0) == java_lang_Thread::TERMINATED, 112.301 "Invalid threadStatus value"); 112.302 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::string_klass(), 112.303 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), 112.304 1, /* only 1 substate */ 112.305 CHECK_NULL); 112.306 names_h = objArrayHandle(THREAD, r); 112.307 @@ -4643,4 +4643,3 @@ 112.308 #endif // KERNEL 112.309 } 112.310 JVM_END 112.311 -
113.1 --- a/src/share/vm/prims/jvmtiEnter.xsl Wed Dec 23 03:12:16 2009 -0800 113.2 +++ b/src/share/vm/prims/jvmtiEnter.xsl Wed Jan 06 22:21:39 2010 -0800 113.3 @@ -773,7 +773,7 @@ 113.4 </xsl:apply-templates> 113.5 <xsl:text> 113.6 } 113.7 - if (!thread_oop->is_a(SystemDictionary::thread_klass())) { 113.8 + if (!thread_oop->is_a(SystemDictionary::Thread_klass())) { 113.9 </xsl:text> 113.10 <xsl:apply-templates select=".." mode="traceError"> 113.11 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param> 113.12 @@ -857,7 +857,7 @@ 113.13 </xsl:apply-templates> 113.14 <xsl:text> 113.15 } 113.16 - if (!k_mirror->is_a(SystemDictionary::class_klass())) { 113.17 + if (!k_mirror->is_a(SystemDictionary::Class_klass())) { 113.18 </xsl:text> 113.19 <xsl:apply-templates select=".." mode="traceError"> 113.20 <xsl:with-param name="err">JVMTI_ERROR_INVALID_CLASS</xsl:with-param>
114.1 --- a/src/share/vm/prims/jvmtiEnv.cpp Wed Dec 23 03:12:16 2009 -0800 114.2 +++ b/src/share/vm/prims/jvmtiEnv.cpp Wed Jan 06 22:21:39 2010 -0800 114.3 @@ -133,7 +133,7 @@ 114.4 if (thread_oop == NULL) { 114.5 return JVMTI_ERROR_INVALID_THREAD; 114.6 } 114.7 - if (!thread_oop->is_a(SystemDictionary::thread_klass())) { 114.8 + if (!thread_oop->is_a(SystemDictionary::Thread_klass())) { 114.9 return JVMTI_ERROR_INVALID_THREAD; 114.10 } 114.11 JavaThread* java_thread = java_lang_Thread::thread(thread_oop); 114.12 @@ -199,7 +199,7 @@ 114.13 if (k_mirror == NULL) { 114.14 return JVMTI_ERROR_INVALID_CLASS; 114.15 } 114.16 - if (!k_mirror->is_a(SystemDictionary::class_klass())) { 114.17 + if (!k_mirror->is_a(SystemDictionary::Class_klass())) { 114.18 return JVMTI_ERROR_INVALID_CLASS; 114.19 } 114.20 114.21 @@ -266,7 +266,7 @@ 114.22 oop mirror = JNIHandles::resolve_external_guard(object); 114.23 NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT); 114.24 114.25 - if (mirror->klass() == SystemDictionary::class_klass()) { 114.26 + if (mirror->klass() == SystemDictionary::Class_klass()) { 114.27 if (!java_lang_Class::is_primitive(mirror)) { 114.28 mirror = java_lang_Class::as_klassOop(mirror); 114.29 assert(mirror != NULL, "class for non-primitive mirror must exist"); 114.30 @@ -327,7 +327,7 @@ 114.31 if (thread_oop == NULL) { 114.32 return JVMTI_ERROR_INVALID_THREAD; 114.33 } 114.34 - if (!thread_oop->is_a(SystemDictionary::thread_klass())) { 114.35 + if (!thread_oop->is_a(SystemDictionary::Thread_klass())) { 114.36 return JVMTI_ERROR_INVALID_THREAD; 114.37 } 114.38 java_thread = java_lang_Thread::thread(thread_oop); 114.39 @@ -632,7 +632,7 @@ 114.40 thread_oop = JNIHandles::resolve_external_guard(thread); 114.41 } 114.42 114.43 - if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::thread_klass())) { 114.44 + if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::Thread_klass())) { 114.45 return JVMTI_ERROR_INVALID_THREAD; 114.46 } 114.47 114.48 @@ -870,7 +870,7 @@ 114.49 jvmtiError 114.50 JvmtiEnv::InterruptThread(jthread thread) { 114.51 oop thread_oop = JNIHandles::resolve_external_guard(thread); 114.52 - if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::thread_klass())) 114.53 + if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::Thread_klass())) 114.54 return JVMTI_ERROR_INVALID_THREAD; 114.55 114.56 JavaThread* current_thread = JavaThread::current(); 114.57 @@ -907,7 +907,7 @@ 114.58 } else { 114.59 thread_oop = JNIHandles::resolve_external_guard(thread); 114.60 } 114.61 - if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::thread_klass())) 114.62 + if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::Thread_klass())) 114.63 return JVMTI_ERROR_INVALID_THREAD; 114.64 114.65 Handle thread_obj(current_thread, thread_oop); 114.66 @@ -1073,7 +1073,7 @@ 114.67 jvmtiError 114.68 JvmtiEnv::RunAgentThread(jthread thread, jvmtiStartFunction proc, const void* arg, jint priority) { 114.69 oop thread_oop = JNIHandles::resolve_external_guard(thread); 114.70 - if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::thread_klass())) { 114.71 + if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::Thread_klass())) { 114.72 return JVMTI_ERROR_INVALID_THREAD; 114.73 } 114.74 if (priority < JVMTI_THREAD_MIN_PRIORITY || priority > JVMTI_THREAD_MAX_PRIORITY) {
115.1 --- a/src/share/vm/prims/jvmtiEnvBase.cpp Wed Dec 23 03:12:16 2009 -0800 115.2 +++ b/src/share/vm/prims/jvmtiEnvBase.cpp Wed Jan 06 22:21:39 2010 -0800 115.3 @@ -527,7 +527,7 @@ 115.4 JavaThread * 115.5 JvmtiEnvBase::get_JavaThread(jthread jni_thread) { 115.6 oop t = JNIHandles::resolve_external_guard(jni_thread); 115.7 - if (t == NULL || !t->is_a(SystemDictionary::thread_klass())) { 115.8 + if (t == NULL || !t->is_a(SystemDictionary::Thread_klass())) { 115.9 return NULL; 115.10 } 115.11 // The following returns NULL if the thread has not yet run or is in 115.12 @@ -1269,7 +1269,7 @@ 115.13 for (int i = 0; i < _thread_count; ++i) { 115.14 jthread jt = _thread_list[i]; 115.15 oop thread_oop = JNIHandles::resolve_external_guard(jt); 115.16 - if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::thread_klass())) { 115.17 + if (thread_oop == NULL || !thread_oop->is_a(SystemDictionary::Thread_klass())) { 115.18 set_result(JVMTI_ERROR_INVALID_THREAD); 115.19 return; 115.20 }
116.1 --- a/src/share/vm/prims/jvmtiExport.cpp Wed Dec 23 03:12:16 2009 -0800 116.2 +++ b/src/share/vm/prims/jvmtiExport.cpp Wed Jan 06 22:21:39 2010 -0800 116.3 @@ -656,7 +656,7 @@ 116.4 klassOop k = obj->klass(); 116.5 116.6 // if the object is a java.lang.Class then return the java mirror 116.7 - if (k == SystemDictionary::class_klass()) { 116.8 + if (k == SystemDictionary::Class_klass()) { 116.9 if (!java_lang_Class::is_primitive(obj)) { 116.10 k = java_lang_Class::as_klassOop(obj); 116.11 assert(k != NULL, "class for non-primitive mirror must exist"); 116.12 @@ -1925,7 +1925,7 @@ 116.13 if (collector != NULL && collector->is_enabled()) { 116.14 // Don't record classes as these will be notified via the ClassLoad 116.15 // event. 116.16 - if (obj->klass() != SystemDictionary::class_klass()) { 116.17 + if (obj->klass() != SystemDictionary::Class_klass()) { 116.18 collector->record_allocation(obj); 116.19 } 116.20 }
117.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Wed Dec 23 03:12:16 2009 -0800 117.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Wed Jan 06 22:21:39 2010 -0800 117.3 @@ -3214,7 +3214,7 @@ 117.4 // - all instanceKlasses for redefined classes reused & contents updated 117.5 the_class->vtable()->initialize_vtable(false, THREAD); 117.6 the_class->itable()->initialize_itable(false, THREAD); 117.7 - assert(!HAS_PENDING_EXCEPTION || (THREAD->pending_exception()->is_a(SystemDictionary::threaddeath_klass())), "redefine exception"); 117.8 + assert(!HAS_PENDING_EXCEPTION || (THREAD->pending_exception()->is_a(SystemDictionary::ThreadDeath_klass())), "redefine exception"); 117.9 } 117.10 117.11 // Leave arrays of jmethodIDs and itable index cache unchanged
118.1 --- a/src/share/vm/prims/jvmtiTagMap.cpp Wed Dec 23 03:12:16 2009 -0800 118.2 +++ b/src/share/vm/prims/jvmtiTagMap.cpp Wed Jan 06 22:21:39 2010 -0800 118.3 @@ -579,7 +579,7 @@ 118.4 // If the object is a java.lang.Class then return the klassOop, 118.5 // otherwise return the original object 118.6 static inline oop klassOop_if_java_lang_Class(oop o) { 118.7 - if (o->klass() == SystemDictionary::class_klass()) { 118.8 + if (o->klass() == SystemDictionary::Class_klass()) { 118.9 if (!java_lang_Class::is_primitive(o)) { 118.10 o = (oop)java_lang_Class::as_klassOop(o); 118.11 assert(o != NULL, "class for non-primitive mirror must exist"); 118.12 @@ -644,7 +644,7 @@ 118.13 } else { 118.14 // if the object represents a runtime class then use the 118.15 // tag for java.lang.Class 118.16 - _klass = SystemDictionary::class_klass(); 118.17 + _klass = SystemDictionary::Class_klass(); 118.18 } 118.19 _klass_tag = tag_for(tag_map, _klass); 118.20 } 118.21 @@ -747,7 +747,7 @@ 118.22 // get referrer class tag. 118.23 klassOop k = (_referrer == referrer) ? // Check if referrer is a class... 118.24 _referrer->klass() // No, just get its class 118.25 - : SystemDictionary::class_klass(); // Yes, its class is Class 118.26 + : SystemDictionary::Class_klass(); // Yes, its class is Class 118.27 _referrer_klass_tag = tag_for(tag_map, k); 118.28 } 118.29 } 118.30 @@ -1126,7 +1126,7 @@ 118.31 oop str, 118.32 void* user_data) 118.33 { 118.34 - assert(str->klass() == SystemDictionary::string_klass(), "not a string"); 118.35 + assert(str->klass() == SystemDictionary::String_klass(), "not a string"); 118.36 118.37 // get the string value and length 118.38 // (string value may be offset from the base) 118.39 @@ -1186,7 +1186,7 @@ 118.40 // for static fields only the index will be set 118.41 static jvmtiHeapReferenceInfo reference_info = { 0 }; 118.42 118.43 - assert(obj->klass() == SystemDictionary::class_klass(), "not a class"); 118.44 + assert(obj->klass() == SystemDictionary::Class_klass(), "not a class"); 118.45 if (java_lang_Class::is_primitive(obj)) { 118.46 return 0; 118.47 } 118.48 @@ -1498,7 +1498,7 @@ 118.49 if (callbacks()->primitive_field_callback != NULL && obj->is_instance()) { 118.50 jint res; 118.51 jvmtiPrimitiveFieldCallback cb = callbacks()->primitive_field_callback; 118.52 - if (obj->klass() == SystemDictionary::class_klass()) { 118.53 + if (obj->klass() == SystemDictionary::Class_klass()) { 118.54 res = invoke_primitive_field_callback_for_static_fields(&wrapper, 118.55 obj, 118.56 cb, 118.57 @@ -1515,7 +1515,7 @@ 118.58 // string callback 118.59 if (!is_array && 118.60 callbacks()->string_primitive_value_callback != NULL && 118.61 - obj->klass() == SystemDictionary::string_klass()) { 118.62 + obj->klass() == SystemDictionary::String_klass()) { 118.63 jint res = invoke_string_value_callback( 118.64 callbacks()->string_primitive_value_callback, 118.65 &wrapper, 118.66 @@ -2381,7 +2381,7 @@ 118.67 118.68 // invoke the string value callback 118.69 inline bool CallbackInvoker::report_string_value(oop str) { 118.70 - assert(str->klass() == SystemDictionary::string_klass(), "not a string"); 118.71 + assert(str->klass() == SystemDictionary::String_klass(), "not a string"); 118.72 118.73 AdvancedHeapWalkContext* context = advanced_context(); 118.74 assert(context->string_primitive_value_callback() != NULL, "no callback"); 118.75 @@ -2928,7 +2928,7 @@ 118.76 118.77 // super (only if something more interesting than java.lang.Object) 118.78 klassOop java_super = ik->java_super(); 118.79 - if (java_super != NULL && java_super != SystemDictionary::object_klass()) { 118.80 + if (java_super != NULL && java_super != SystemDictionary::Object_klass()) { 118.81 oop super = Klass::cast(java_super)->java_mirror(); 118.82 if (!CallbackInvoker::report_superclass_reference(mirror, super)) { 118.83 return false; 118.84 @@ -3070,7 +3070,7 @@ 118.85 118.86 // if the object is a java.lang.String 118.87 if (is_reporting_string_values() && 118.88 - o->klass() == SystemDictionary::string_klass()) { 118.89 + o->klass() == SystemDictionary::String_klass()) { 118.90 if (!CallbackInvoker::report_string_value(o)) { 118.91 return false; 118.92 } 118.93 @@ -3255,7 +3255,7 @@ 118.94 118.95 // instance 118.96 if (o->is_instance()) { 118.97 - if (o->klass() == SystemDictionary::class_klass()) { 118.98 + if (o->klass() == SystemDictionary::Class_klass()) { 118.99 o = klassOop_if_java_lang_Class(o); 118.100 if (o->is_klass()) { 118.101 // a java.lang.Class
119.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 119.2 +++ b/src/share/vm/prims/methodHandleWalk.cpp Wed Jan 06 22:21:39 2010 -0800 119.3 @@ -0,0 +1,1396 @@ 119.4 +/* 119.5 + * Copyright 2008-2010 Sun Microsystems, Inc. All Rights Reserved. 119.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 119.7 + * 119.8 + * This code is free software; you can redistribute it and/or modify it 119.9 + * under the terms of the GNU General Public License version 2 only, as 119.10 + * published by the Free Software Foundation. 119.11 + * 119.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 119.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 119.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 119.15 + * version 2 for more details (a copy is included in the LICENSE file that 119.16 + * accompanied this code). 119.17 + * 119.18 + * You should have received a copy of the GNU General Public License version 119.19 + * 2 along with this work; if not, write to the Free Software Foundation, 119.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 119.21 + * 119.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 119.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 119.24 + * have any questions. 119.25 + * 119.26 + */ 119.27 + 119.28 +/* 119.29 + * JSR 292 reference implementation: method handle structure analysis 119.30 + */ 119.31 + 119.32 +#include "incls/_precompiled.incl" 119.33 +#include "incls/_methodHandleWalk.cpp.incl" 119.34 + 119.35 + 119.36 +// ----------------------------------------------------------------------------- 119.37 +// MethodHandleChain 119.38 + 119.39 +void MethodHandleChain::set_method_handle(Handle mh, TRAPS) { 119.40 + if (!java_dyn_MethodHandle::is_instance(mh())) lose("bad method handle", CHECK); 119.41 + 119.42 + // set current method handle and unpack partially 119.43 + _method_handle = mh; 119.44 + _is_last = false; 119.45 + _is_bound = false; 119.46 + _arg_slot = -1; 119.47 + _arg_type = T_VOID; 119.48 + _conversion = -1; 119.49 + _last_invoke = Bytecodes::_nop; //arbitrary non-garbage 119.50 + 119.51 + if (sun_dyn_DirectMethodHandle::is_instance(mh())) { 119.52 + set_last_method(mh(), THREAD); 119.53 + return; 119.54 + } 119.55 + if (sun_dyn_AdapterMethodHandle::is_instance(mh())) { 119.56 + _conversion = AdapterMethodHandle_conversion(); 119.57 + assert(_conversion != -1, "bad conv value"); 119.58 + assert(sun_dyn_BoundMethodHandle::is_instance(mh()), "also BMH"); 119.59 + } 119.60 + if (sun_dyn_BoundMethodHandle::is_instance(mh())) { 119.61 + if (!is_adapter()) // keep AMH and BMH separate in this model 119.62 + _is_bound = true; 119.63 + _arg_slot = BoundMethodHandle_vmargslot(); 119.64 + oop target = MethodHandle_vmtarget_oop(); 119.65 + if (!is_bound() || java_dyn_MethodHandle::is_instance(target)) { 119.66 + _arg_type = compute_bound_arg_type(target, NULL, _arg_slot, CHECK); 119.67 + } else if (target != NULL && target->is_method()) { 119.68 + methodOop m = (methodOop) target; 119.69 + _arg_type = compute_bound_arg_type(NULL, m, _arg_slot, CHECK); 119.70 + set_last_method(mh(), CHECK); 119.71 + } else { 119.72 + _is_bound = false; // lose! 119.73 + } 119.74 + } 119.75 + if (is_bound() && _arg_type == T_VOID) { 119.76 + lose("bad vmargslot", CHECK); 119.77 + } 119.78 + if (!is_bound() && !is_adapter()) { 119.79 + lose("unrecognized MH type", CHECK); 119.80 + } 119.81 +} 119.82 + 119.83 + 119.84 +void MethodHandleChain::set_last_method(oop target, TRAPS) { 119.85 + _is_last = true; 119.86 + klassOop receiver_limit_oop = NULL; 119.87 + int flags = 0; 119.88 + methodOop m = MethodHandles::decode_method(target, receiver_limit_oop, flags); 119.89 + _last_method = methodHandle(THREAD, m); 119.90 + if ((flags & MethodHandles::_dmf_has_receiver) == 0) 119.91 + _last_invoke = Bytecodes::_invokestatic; 119.92 + else if ((flags & MethodHandles::_dmf_does_dispatch) == 0) 119.93 + _last_invoke = Bytecodes::_invokespecial; 119.94 + else if ((flags & MethodHandles::_dmf_from_interface) != 0) 119.95 + _last_invoke = Bytecodes::_invokeinterface; 119.96 + else 119.97 + _last_invoke = Bytecodes::_invokevirtual; 119.98 +} 119.99 + 119.100 + 119.101 +BasicType MethodHandleChain::compute_bound_arg_type(oop target, methodOop m, int arg_slot, TRAPS) { 119.102 + // There is no direct indication of whether the argument is primitive or not. 119.103 + // It is implied by the _vmentry code, and by the MethodType of the target. 119.104 + // FIXME: Make it explicit MethodHandleImpl refactors out from MethodHandle 119.105 + BasicType arg_type = T_VOID; 119.106 + if (target != NULL) { 119.107 + oop mtype = java_dyn_MethodHandle::type(target); 119.108 + int arg_num = MethodHandles::argument_slot_to_argnum(mtype, arg_slot); 119.109 + if (arg_num >= 0) { 119.110 + oop ptype = java_dyn_MethodType::ptype(mtype, arg_num); 119.111 + arg_type = java_lang_Class::as_BasicType(ptype); 119.112 + } 119.113 + } else if (m != NULL) { 119.114 + // figure out the argument type from the slot 119.115 + // FIXME: make this explicit in the MH 119.116 + int cur_slot = m->size_of_parameters(); 119.117 + if (arg_slot >= cur_slot) 119.118 + return T_VOID; 119.119 + if (!m->is_static()) { 119.120 + cur_slot -= type2size[T_OBJECT]; 119.121 + if (cur_slot == arg_slot) 119.122 + return T_OBJECT; 119.123 + } 119.124 + for (SignatureStream ss(m->signature()); !ss.is_done(); ss.next()) { 119.125 + BasicType bt = ss.type(); 119.126 + cur_slot -= type2size[bt]; 119.127 + if (cur_slot <= arg_slot) { 119.128 + if (cur_slot == arg_slot) 119.129 + arg_type = bt; 119.130 + break; 119.131 + } 119.132 + } 119.133 + } 119.134 + if (arg_type == T_ARRAY) 119.135 + arg_type = T_OBJECT; 119.136 + return arg_type; 119.137 +} 119.138 + 119.139 + 119.140 +void MethodHandleChain::lose(const char* msg, TRAPS) { 119.141 + assert(false, "lose"); 119.142 + _lose_message = msg; 119.143 + if (!THREAD->is_Java_thread() || ((JavaThread*)THREAD)->thread_state() != _thread_in_vm) { 119.144 + // throw a preallocated exception 119.145 + THROW_OOP(Universe::virtual_machine_error_instance()); 119.146 + } 119.147 + THROW_MSG(vmSymbols::java_lang_InternalError(), msg); 119.148 +} 119.149 + 119.150 + 119.151 +// ----------------------------------------------------------------------------- 119.152 +// MethodHandleWalker 119.153 + 119.154 +Bytecodes::Code MethodHandleWalker::conversion_code(BasicType src, BasicType dest) { 119.155 + if (is_subword_type(src)) { 119.156 + src = T_INT; // all subword src types act like int 119.157 + } 119.158 + if (src == dest) { 119.159 + return Bytecodes::_nop; 119.160 + } 119.161 + 119.162 +#define SRC_DEST(s,d) (((int)(s) << 4) + (int)(d)) 119.163 + switch (SRC_DEST(src, dest)) { 119.164 + case SRC_DEST(T_INT, T_LONG): return Bytecodes::_i2l; 119.165 + case SRC_DEST(T_INT, T_FLOAT): return Bytecodes::_i2f; 119.166 + case SRC_DEST(T_INT, T_DOUBLE): return Bytecodes::_i2d; 119.167 + case SRC_DEST(T_INT, T_BYTE): return Bytecodes::_i2b; 119.168 + case SRC_DEST(T_INT, T_CHAR): return Bytecodes::_i2c; 119.169 + case SRC_DEST(T_INT, T_SHORT): return Bytecodes::_i2s; 119.170 + 119.171 + case SRC_DEST(T_LONG, T_INT): return Bytecodes::_l2i; 119.172 + case SRC_DEST(T_LONG, T_FLOAT): return Bytecodes::_l2f; 119.173 + case SRC_DEST(T_LONG, T_DOUBLE): return Bytecodes::_l2d; 119.174 + 119.175 + case SRC_DEST(T_FLOAT, T_INT): return Bytecodes::_f2i; 119.176 + case SRC_DEST(T_FLOAT, T_LONG): return Bytecodes::_f2l; 119.177 + case SRC_DEST(T_FLOAT, T_DOUBLE): return Bytecodes::_f2d; 119.178 + 119.179 + case SRC_DEST(T_DOUBLE, T_INT): return Bytecodes::_d2i; 119.180 + case SRC_DEST(T_DOUBLE, T_LONG): return Bytecodes::_d2l; 119.181 + case SRC_DEST(T_DOUBLE, T_FLOAT): return Bytecodes::_d2f; 119.182 + } 119.183 +#undef SRC_DEST 119.184 + 119.185 + // cannot do it in one step, or at all 119.186 + return Bytecodes::_illegal; 119.187 +} 119.188 + 119.189 + 119.190 +// ----------------------------------------------------------------------------- 119.191 +// MethodHandleWalker::walk 119.192 +// 119.193 +MethodHandleWalker::ArgToken 119.194 +MethodHandleWalker::walk(TRAPS) { 119.195 + ArgToken empty = ArgToken(); // Empty return value. 119.196 + 119.197 + walk_incoming_state(CHECK_(empty)); 119.198 + 119.199 + for (;;) { 119.200 + set_method_handle(chain().method_handle_oop()); 119.201 + 119.202 + assert(_outgoing_argc == argument_count_slow(), "empty slots under control"); 119.203 + 119.204 + if (chain().is_adapter()) { 119.205 + int conv_op = chain().adapter_conversion_op(); 119.206 + int arg_slot = chain().adapter_arg_slot(); 119.207 + SlotState* arg_state = slot_state(arg_slot); 119.208 + if (arg_state == NULL 119.209 + && conv_op > sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW) { 119.210 + lose("bad argument index", CHECK_(empty)); 119.211 + } 119.212 + 119.213 + // perform the adapter action 119.214 + switch (chain().adapter_conversion_op()) { 119.215 + case sun_dyn_AdapterMethodHandle::OP_RETYPE_ONLY: 119.216 + // No changes to arguments; pass the bits through. 119.217 + break; 119.218 + 119.219 + case sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW: { 119.220 + // To keep the verifier happy, emit bitwise ("raw") conversions as needed. 119.221 + // See MethodHandles::same_basic_type_for_arguments for allowed conversions. 119.222 + Handle incoming_mtype(THREAD, chain().method_type_oop()); 119.223 + oop outgoing_mh_oop = chain().vmtarget_oop(); 119.224 + if (!java_dyn_MethodHandle::is_instance(outgoing_mh_oop)) 119.225 + lose("outgoing target not a MethodHandle", CHECK_(empty)); 119.226 + Handle outgoing_mtype(THREAD, java_dyn_MethodHandle::type(outgoing_mh_oop)); 119.227 + outgoing_mh_oop = NULL; // GC safety 119.228 + 119.229 + int nptypes = java_dyn_MethodType::ptype_count(outgoing_mtype()); 119.230 + if (nptypes != java_dyn_MethodType::ptype_count(incoming_mtype())) 119.231 + lose("incoming and outgoing parameter count do not agree", CHECK_(empty)); 119.232 + 119.233 + for (int i = 0, slot = _outgoing.length() - 1; slot >= 0; slot--) { 119.234 + SlotState* arg_state = slot_state(slot); 119.235 + if (arg_state->_type == T_VOID) continue; 119.236 + ArgToken arg = _outgoing.at(slot)._arg; 119.237 + 119.238 + klassOop in_klass = NULL; 119.239 + klassOop out_klass = NULL; 119.240 + BasicType inpbt = java_lang_Class::as_BasicType(java_dyn_MethodType::ptype(incoming_mtype(), i), &in_klass); 119.241 + BasicType outpbt = java_lang_Class::as_BasicType(java_dyn_MethodType::ptype(outgoing_mtype(), i), &out_klass); 119.242 + assert(inpbt == arg.basic_type(), "sanity"); 119.243 + 119.244 + if (inpbt != outpbt) { 119.245 + vmIntrinsics::ID iid = vmIntrinsics::for_raw_conversion(inpbt, outpbt); 119.246 + if (iid == vmIntrinsics::_none) { 119.247 + lose("no raw conversion method", CHECK_(empty)); 119.248 + } 119.249 + ArgToken arglist[2]; 119.250 + arglist[0] = arg; // outgoing 'this' 119.251 + arglist[1] = ArgToken(); // sentinel 119.252 + arg = make_invoke(NULL, iid, Bytecodes::_invokestatic, false, 1, &arglist[0], CHECK_(empty)); 119.253 + change_argument(inpbt, slot, outpbt, arg); 119.254 + } 119.255 + 119.256 + i++; // We need to skip void slots at the top of the loop. 119.257 + } 119.258 + 119.259 + BasicType inrbt = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(incoming_mtype())); 119.260 + BasicType outrbt = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(outgoing_mtype())); 119.261 + if (inrbt != outrbt) { 119.262 + if (inrbt == T_INT && outrbt == T_VOID) { 119.263 + // See comments in MethodHandles::same_basic_type_for_arguments. 119.264 + } else { 119.265 + assert(false, "IMPLEMENT ME"); 119.266 + lose("no raw conversion method", CHECK_(empty)); 119.267 + } 119.268 + } 119.269 + break; 119.270 + } 119.271 + 119.272 + case sun_dyn_AdapterMethodHandle::OP_CHECK_CAST: { 119.273 + // checkcast the Nth outgoing argument in place 119.274 + klassOop dest_klass = NULL; 119.275 + BasicType dest = java_lang_Class::as_BasicType(chain().adapter_arg_oop(), &dest_klass); 119.276 + assert(dest == T_OBJECT, ""); 119.277 + assert(dest == arg_state->_type, ""); 119.278 + ArgToken arg = arg_state->_arg; 119.279 + ArgToken new_arg = make_conversion(T_OBJECT, dest_klass, Bytecodes::_checkcast, arg, CHECK_(empty)); 119.280 + assert(arg.index() == new_arg.index(), "should be the same index"); 119.281 + debug_only(dest_klass = (klassOop)badOop); 119.282 + break; 119.283 + } 119.284 + 119.285 + case sun_dyn_AdapterMethodHandle::OP_PRIM_TO_PRIM: { 119.286 + // i2l, etc., on the Nth outgoing argument in place 119.287 + BasicType src = chain().adapter_conversion_src_type(), 119.288 + dest = chain().adapter_conversion_dest_type(); 119.289 + Bytecodes::Code bc = conversion_code(src, dest); 119.290 + ArgToken arg = arg_state->_arg; 119.291 + if (bc == Bytecodes::_nop) { 119.292 + break; 119.293 + } else if (bc != Bytecodes::_illegal) { 119.294 + arg = make_conversion(dest, NULL, bc, arg, CHECK_(empty)); 119.295 + } else if (is_subword_type(dest)) { 119.296 + bc = conversion_code(src, T_INT); 119.297 + if (bc != Bytecodes::_illegal) { 119.298 + arg = make_conversion(dest, NULL, bc, arg, CHECK_(empty)); 119.299 + bc = conversion_code(T_INT, dest); 119.300 + arg = make_conversion(dest, NULL, bc, arg, CHECK_(empty)); 119.301 + } 119.302 + } 119.303 + if (bc == Bytecodes::_illegal) { 119.304 + lose("bad primitive conversion", CHECK_(empty)); 119.305 + } 119.306 + change_argument(src, arg_slot, dest, arg); 119.307 + break; 119.308 + } 119.309 + 119.310 + case sun_dyn_AdapterMethodHandle::OP_REF_TO_PRIM: { 119.311 + // checkcast to wrapper type & call intValue, etc. 119.312 + BasicType dest = chain().adapter_conversion_dest_type(); 119.313 + ArgToken arg = arg_state->_arg; 119.314 + arg = make_conversion(T_OBJECT, SystemDictionary::box_klass(dest), 119.315 + Bytecodes::_checkcast, arg, CHECK_(empty)); 119.316 + vmIntrinsics::ID unboxer = vmIntrinsics::for_unboxing(dest); 119.317 + if (unboxer == vmIntrinsics::_none) { 119.318 + lose("no unboxing method", CHECK_(empty)); 119.319 + } 119.320 + ArgToken arglist[2]; 119.321 + arglist[0] = arg; // outgoing 'this' 119.322 + arglist[1] = ArgToken(); // sentinel 119.323 + arg = make_invoke(NULL, unboxer, Bytecodes::_invokevirtual, false, 1, &arglist[0], CHECK_(empty)); 119.324 + change_argument(T_OBJECT, arg_slot, dest, arg); 119.325 + break; 119.326 + } 119.327 + 119.328 + case sun_dyn_AdapterMethodHandle::OP_PRIM_TO_REF: { 119.329 + // call wrapper type.valueOf 119.330 + BasicType src = chain().adapter_conversion_src_type(); 119.331 + ArgToken arg = arg_state->_arg; 119.332 + vmIntrinsics::ID boxer = vmIntrinsics::for_boxing(src); 119.333 + if (boxer == vmIntrinsics::_none) { 119.334 + lose("no boxing method", CHECK_(empty)); 119.335 + } 119.336 + ArgToken arglist[2]; 119.337 + arglist[0] = arg; // outgoing value 119.338 + arglist[1] = ArgToken(); // sentinel 119.339 + assert(false, "I think the argument count must be 1 instead of 0"); 119.340 + arg = make_invoke(NULL, boxer, Bytecodes::_invokevirtual, false, 0, &arglist[0], CHECK_(empty)); 119.341 + change_argument(src, arg_slot, T_OBJECT, arg); 119.342 + break; 119.343 + } 119.344 + 119.345 + case sun_dyn_AdapterMethodHandle::OP_SWAP_ARGS: { 119.346 + int dest_arg_slot = chain().adapter_conversion_vminfo(); 119.347 + if (!slot_has_argument(dest_arg_slot)) { 119.348 + lose("bad swap index", CHECK_(empty)); 119.349 + } 119.350 + // a simple swap between two arguments 119.351 + SlotState* dest_arg_state = slot_state(dest_arg_slot); 119.352 + SlotState temp = (*dest_arg_state); 119.353 + (*dest_arg_state) = (*arg_state); 119.354 + (*arg_state) = temp; 119.355 + break; 119.356 + } 119.357 + 119.358 + case sun_dyn_AdapterMethodHandle::OP_ROT_ARGS: { 119.359 + int dest_arg_slot = chain().adapter_conversion_vminfo(); 119.360 + if (!slot_has_argument(dest_arg_slot) || arg_slot == dest_arg_slot) { 119.361 + lose("bad rotate index", CHECK_(empty)); 119.362 + } 119.363 + SlotState* dest_arg_state = slot_state(dest_arg_slot); 119.364 + // Rotate the source argument (plus following N slots) into the 119.365 + // position occupied by the dest argument (plus following N slots). 119.366 + int rotate_count = type2size[dest_arg_state->_type]; 119.367 + // (no other rotate counts are currently supported) 119.368 + if (arg_slot < dest_arg_slot) { 119.369 + for (int i = 0; i < rotate_count; i++) { 119.370 + SlotState temp = _outgoing.at(arg_slot); 119.371 + _outgoing.remove_at(arg_slot); 119.372 + _outgoing.insert_before(dest_arg_slot + rotate_count - 1, temp); 119.373 + } 119.374 + } else { // arg_slot > dest_arg_slot 119.375 + for (int i = 0; i < rotate_count; i++) { 119.376 + SlotState temp = _outgoing.at(arg_slot + rotate_count - 1); 119.377 + _outgoing.remove_at(arg_slot + rotate_count - 1); 119.378 + _outgoing.insert_before(dest_arg_slot, temp); 119.379 + } 119.380 + } 119.381 + break; 119.382 + } 119.383 + 119.384 + case sun_dyn_AdapterMethodHandle::OP_DUP_ARGS: { 119.385 + int dup_slots = chain().adapter_conversion_stack_pushes(); 119.386 + if (dup_slots <= 0) { 119.387 + lose("bad dup count", CHECK_(empty)); 119.388 + } 119.389 + for (int i = 0; i < dup_slots; i++) { 119.390 + SlotState* dup = slot_state(arg_slot + 2*i); 119.391 + if (dup == NULL) break; // safety net 119.392 + if (dup->_type != T_VOID) _outgoing_argc += 1; 119.393 + _outgoing.insert_before(i, (*dup)); 119.394 + } 119.395 + break; 119.396 + } 119.397 + 119.398 + case sun_dyn_AdapterMethodHandle::OP_DROP_ARGS: { 119.399 + int drop_slots = -chain().adapter_conversion_stack_pushes(); 119.400 + if (drop_slots <= 0) { 119.401 + lose("bad drop count", CHECK_(empty)); 119.402 + } 119.403 + for (int i = 0; i < drop_slots; i++) { 119.404 + SlotState* drop = slot_state(arg_slot); 119.405 + if (drop == NULL) break; // safety net 119.406 + if (drop->_type != T_VOID) _outgoing_argc -= 1; 119.407 + _outgoing.remove_at(arg_slot); 119.408 + } 119.409 + break; 119.410 + } 119.411 + 119.412 + case sun_dyn_AdapterMethodHandle::OP_COLLECT_ARGS: { //NYI, may GC 119.413 + lose("unimplemented", CHECK_(empty)); 119.414 + break; 119.415 + } 119.416 + 119.417 + case sun_dyn_AdapterMethodHandle::OP_SPREAD_ARGS: { 119.418 + klassOop array_klass_oop = NULL; 119.419 + BasicType array_type = java_lang_Class::as_BasicType(chain().adapter_arg_oop(), 119.420 + &array_klass_oop); 119.421 + assert(array_type == T_OBJECT, ""); 119.422 + assert(Klass::cast(array_klass_oop)->oop_is_array(), ""); 119.423 + arrayKlassHandle array_klass(THREAD, array_klass_oop); 119.424 + debug_only(array_klass_oop = (klassOop)badOop); 119.425 + 119.426 + klassOop element_klass_oop = NULL; 119.427 + BasicType element_type = java_lang_Class::as_BasicType(array_klass->component_mirror(), 119.428 + &element_klass_oop); 119.429 + KlassHandle element_klass(THREAD, element_klass_oop); 119.430 + debug_only(element_klass_oop = (klassOop)badOop); 119.431 + 119.432 + // Fetch the argument, which we will cast to the required array type. 119.433 + assert(arg_state->_type == T_OBJECT, ""); 119.434 + ArgToken array_arg = arg_state->_arg; 119.435 + array_arg = make_conversion(T_OBJECT, array_klass(), Bytecodes::_checkcast, array_arg, CHECK_(empty)); 119.436 + change_argument(T_OBJECT, arg_slot, T_VOID, ArgToken(tt_void)); 119.437 + 119.438 + // Check the required length. 119.439 + int spread_slots = 1 + chain().adapter_conversion_stack_pushes(); 119.440 + int spread_length = spread_slots; 119.441 + if (type2size[element_type] == 2) { 119.442 + if (spread_slots % 2 != 0) spread_slots = -1; // force error 119.443 + spread_length = spread_slots / 2; 119.444 + } 119.445 + if (spread_slots < 0) { 119.446 + lose("bad spread length", CHECK_(empty)); 119.447 + } 119.448 + 119.449 + jvalue length_jvalue; length_jvalue.i = spread_length; 119.450 + ArgToken length_arg = make_prim_constant(T_INT, &length_jvalue, CHECK_(empty)); 119.451 + // Call a built-in method known to the JVM to validate the length. 119.452 + ArgToken arglist[3]; 119.453 + arglist[0] = array_arg; // value to check 119.454 + arglist[1] = length_arg; // length to check 119.455 + arglist[2] = ArgToken(); // sentinel 119.456 + make_invoke(NULL, vmIntrinsics::_checkSpreadArgument, 119.457 + Bytecodes::_invokestatic, false, 3, &arglist[0], CHECK_(empty)); 119.458 + 119.459 + // Spread out the array elements. 119.460 + Bytecodes::Code aload_op = Bytecodes::_aaload; 119.461 + if (element_type != T_OBJECT) { 119.462 + lose("primitive array NYI", CHECK_(empty)); 119.463 + } 119.464 + int ap = arg_slot; 119.465 + for (int i = 0; i < spread_length; i++) { 119.466 + jvalue offset_jvalue; offset_jvalue.i = i; 119.467 + ArgToken offset_arg = make_prim_constant(T_INT, &offset_jvalue, CHECK_(empty)); 119.468 + ArgToken element_arg = make_fetch(element_type, element_klass(), aload_op, array_arg, offset_arg, CHECK_(empty)); 119.469 + change_argument(T_VOID, ap, element_type, element_arg); 119.470 + ap += type2size[element_type]; 119.471 + } 119.472 + break; 119.473 + } 119.474 + 119.475 + case sun_dyn_AdapterMethodHandle::OP_FLYBY: //NYI, runs Java code 119.476 + case sun_dyn_AdapterMethodHandle::OP_RICOCHET: //NYI, runs Java code 119.477 + lose("unimplemented", CHECK_(empty)); 119.478 + break; 119.479 + 119.480 + default: 119.481 + lose("bad adapter conversion", CHECK_(empty)); 119.482 + break; 119.483 + } 119.484 + } 119.485 + 119.486 + if (chain().is_bound()) { 119.487 + // push a new argument 119.488 + BasicType arg_type = chain().bound_arg_type(); 119.489 + jint arg_slot = chain().bound_arg_slot(); 119.490 + oop arg_oop = chain().bound_arg_oop(); 119.491 + ArgToken arg; 119.492 + if (arg_type == T_OBJECT) { 119.493 + arg = make_oop_constant(arg_oop, CHECK_(empty)); 119.494 + } else { 119.495 + jvalue arg_value; 119.496 + BasicType bt = java_lang_boxing_object::get_value(arg_oop, &arg_value); 119.497 + if (bt == arg_type) { 119.498 + arg = make_prim_constant(arg_type, &arg_value, CHECK_(empty)); 119.499 + } else { 119.500 + lose("bad bound value", CHECK_(empty)); 119.501 + } 119.502 + } 119.503 + debug_only(arg_oop = badOop); 119.504 + change_argument(T_VOID, arg_slot, arg_type, arg); 119.505 + } 119.506 + 119.507 + // this test must come after the body of the loop 119.508 + if (!chain().is_last()) { 119.509 + chain().next(CHECK_(empty)); 119.510 + } else { 119.511 + break; 119.512 + } 119.513 + } 119.514 + 119.515 + // finish the sequence with a tail-call to the ultimate target 119.516 + // parameters are passed in logical order (recv 1st), not slot order 119.517 + ArgToken* arglist = NEW_RESOURCE_ARRAY(ArgToken, _outgoing.length() + 1); 119.518 + int ap = 0; 119.519 + for (int i = _outgoing.length() - 1; i >= 0; i--) { 119.520 + SlotState* arg_state = slot_state(i); 119.521 + if (arg_state->_type == T_VOID) continue; 119.522 + arglist[ap++] = _outgoing.at(i)._arg; 119.523 + } 119.524 + assert(ap == _outgoing_argc, ""); 119.525 + arglist[ap] = ArgToken(); // add a sentinel, for the sake of asserts 119.526 + return make_invoke(chain().last_method_oop(), 119.527 + vmIntrinsics::_none, 119.528 + chain().last_invoke_code(), true, 119.529 + ap, arglist, THREAD); 119.530 +} 119.531 + 119.532 + 119.533 +// ----------------------------------------------------------------------------- 119.534 +// MethodHandleWalker::walk_incoming_state 119.535 +// 119.536 +void MethodHandleWalker::walk_incoming_state(TRAPS) { 119.537 + Handle mtype(THREAD, chain().method_type_oop()); 119.538 + int nptypes = java_dyn_MethodType::ptype_count(mtype()); 119.539 + _outgoing_argc = nptypes; 119.540 + int argp = nptypes - 1; 119.541 + if (argp >= 0) { 119.542 + _outgoing.at_grow(argp, make_state(T_VOID, ArgToken(tt_void))); // presize 119.543 + } 119.544 + for (int i = 0; i < nptypes; i++) { 119.545 + klassOop arg_type_klass = NULL; 119.546 + BasicType arg_type = java_lang_Class::as_BasicType( 119.547 + java_dyn_MethodType::ptype(mtype(), i), &arg_type_klass); 119.548 + int index = new_local_index(arg_type); 119.549 + ArgToken arg = make_parameter(arg_type, arg_type_klass, index, CHECK); 119.550 + debug_only(arg_type_klass = (klassOop) NULL); 119.551 + _outgoing.at_put(argp, make_state(arg_type, arg)); 119.552 + if (type2size[arg_type] == 2) { 119.553 + // add the extra slot, so we can model the JVM stack 119.554 + _outgoing.insert_before(argp+1, make_state(T_VOID, ArgToken(tt_void))); 119.555 + } 119.556 + --argp; 119.557 + } 119.558 + // call make_parameter at the end of the list for the return type 119.559 + klassOop ret_type_klass = NULL; 119.560 + BasicType ret_type = java_lang_Class::as_BasicType( 119.561 + java_dyn_MethodType::rtype(mtype()), &ret_type_klass); 119.562 + ArgToken ret = make_parameter(ret_type, ret_type_klass, -1, CHECK); 119.563 + // ignore ret; client can catch it if needed 119.564 +} 119.565 + 119.566 + 119.567 +// ----------------------------------------------------------------------------- 119.568 +// MethodHandleWalker::change_argument 119.569 +// 119.570 +// This is messy because some kinds of arguments are paired with 119.571 +// companion slots containing an empty value. 119.572 +void MethodHandleWalker::change_argument(BasicType old_type, int slot, BasicType new_type, 119.573 + const ArgToken& new_arg) { 119.574 + int old_size = type2size[old_type]; 119.575 + int new_size = type2size[new_type]; 119.576 + if (old_size == new_size) { 119.577 + // simple case first 119.578 + _outgoing.at_put(slot, make_state(new_type, new_arg)); 119.579 + } else if (old_size > new_size) { 119.580 + for (int i = old_size - 1; i >= new_size; i--) { 119.581 + assert((i != 0) == (_outgoing.at(slot + i)._type == T_VOID), ""); 119.582 + _outgoing.remove_at(slot + i); 119.583 + } 119.584 + if (new_size > 0) 119.585 + _outgoing.at_put(slot, make_state(new_type, new_arg)); 119.586 + else 119.587 + _outgoing_argc -= 1; // deleted a real argument 119.588 + } else { 119.589 + for (int i = old_size; i < new_size; i++) { 119.590 + _outgoing.insert_before(slot + i, make_state(T_VOID, ArgToken(tt_void))); 119.591 + } 119.592 + _outgoing.at_put(slot, make_state(new_type, new_arg)); 119.593 + if (old_size == 0) 119.594 + _outgoing_argc += 1; // inserted a real argument 119.595 + } 119.596 +} 119.597 + 119.598 + 119.599 +#ifdef ASSERT 119.600 +int MethodHandleWalker::argument_count_slow() { 119.601 + int args_seen = 0; 119.602 + for (int i = _outgoing.length() - 1; i >= 0; i--) { 119.603 + if (_outgoing.at(i)._type != T_VOID) { 119.604 + ++args_seen; 119.605 + } 119.606 + } 119.607 + return args_seen; 119.608 +} 119.609 +#endif 119.610 + 119.611 + 119.612 +// ----------------------------------------------------------------------------- 119.613 +// MethodHandleCompiler 119.614 + 119.615 +MethodHandleCompiler::MethodHandleCompiler(Handle root, methodHandle callee, bool is_invokedynamic, TRAPS) 119.616 + : MethodHandleWalker(root, is_invokedynamic, THREAD), 119.617 + _callee(callee), 119.618 + _thread(THREAD), 119.619 + _bytecode(THREAD, 50), 119.620 + _constants(THREAD, 10), 119.621 + _cur_stack(0), 119.622 + _max_stack(0), 119.623 + _rtype(T_ILLEGAL) 119.624 +{ 119.625 + 119.626 + // Element zero is always the null constant. 119.627 + (void) _constants.append(NULL); 119.628 + 119.629 + // Set name and signature index. 119.630 + _name_index = cpool_symbol_put(_callee->name()); 119.631 + _signature_index = cpool_symbol_put(_callee->signature()); 119.632 + 119.633 + // Get return type klass. 119.634 + Handle first_mtype(THREAD, chain().method_type_oop()); 119.635 + // _rklass is NULL for primitives. 119.636 + _rtype = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(first_mtype()), &_rklass); 119.637 + 119.638 + int params = _callee->size_of_parameters(); // Incoming arguments plus receiver. 119.639 + _num_params = for_invokedynamic() ? params - 1 : params; // XXX Check if callee is static? 119.640 +} 119.641 + 119.642 + 119.643 +// ----------------------------------------------------------------------------- 119.644 +// MethodHandleCompiler::compile 119.645 +// 119.646 +// Compile this MethodHandle into a bytecode adapter and return a 119.647 +// methodOop. 119.648 +methodHandle MethodHandleCompiler::compile(TRAPS) { 119.649 + assert(_thread == THREAD, "must be same thread"); 119.650 + methodHandle nullHandle; 119.651 + (void) walk(CHECK_(nullHandle)); 119.652 + return get_method_oop(CHECK_(nullHandle)); 119.653 +} 119.654 + 119.655 + 119.656 +void MethodHandleCompiler::emit_bc(Bytecodes::Code op, int index) { 119.657 + Bytecodes::check(op); // Are we legal? 119.658 + 119.659 + switch (op) { 119.660 + // b 119.661 + case Bytecodes::_aconst_null: 119.662 + case Bytecodes::_iconst_m1: 119.663 + case Bytecodes::_iconst_0: 119.664 + case Bytecodes::_iconst_1: 119.665 + case Bytecodes::_iconst_2: 119.666 + case Bytecodes::_iconst_3: 119.667 + case Bytecodes::_iconst_4: 119.668 + case Bytecodes::_iconst_5: 119.669 + case Bytecodes::_lconst_0: 119.670 + case Bytecodes::_lconst_1: 119.671 + case Bytecodes::_fconst_0: 119.672 + case Bytecodes::_fconst_1: 119.673 + case Bytecodes::_fconst_2: 119.674 + case Bytecodes::_dconst_0: 119.675 + case Bytecodes::_dconst_1: 119.676 + case Bytecodes::_iload_0: 119.677 + case Bytecodes::_iload_1: 119.678 + case Bytecodes::_iload_2: 119.679 + case Bytecodes::_iload_3: 119.680 + case Bytecodes::_lload_0: 119.681 + case Bytecodes::_lload_1: 119.682 + case Bytecodes::_lload_2: 119.683 + case Bytecodes::_lload_3: 119.684 + case Bytecodes::_fload_0: 119.685 + case Bytecodes::_fload_1: 119.686 + case Bytecodes::_fload_2: 119.687 + case Bytecodes::_fload_3: 119.688 + case Bytecodes::_dload_0: 119.689 + case Bytecodes::_dload_1: 119.690 + case Bytecodes::_dload_2: 119.691 + case Bytecodes::_dload_3: 119.692 + case Bytecodes::_aload_0: 119.693 + case Bytecodes::_aload_1: 119.694 + case Bytecodes::_aload_2: 119.695 + case Bytecodes::_aload_3: 119.696 + case Bytecodes::_istore_0: 119.697 + case Bytecodes::_istore_1: 119.698 + case Bytecodes::_istore_2: 119.699 + case Bytecodes::_istore_3: 119.700 + case Bytecodes::_lstore_0: 119.701 + case Bytecodes::_lstore_1: 119.702 + case Bytecodes::_lstore_2: 119.703 + case Bytecodes::_lstore_3: 119.704 + case Bytecodes::_fstore_0: 119.705 + case Bytecodes::_fstore_1: 119.706 + case Bytecodes::_fstore_2: 119.707 + case Bytecodes::_fstore_3: 119.708 + case Bytecodes::_dstore_0: 119.709 + case Bytecodes::_dstore_1: 119.710 + case Bytecodes::_dstore_2: 119.711 + case Bytecodes::_dstore_3: 119.712 + case Bytecodes::_astore_0: 119.713 + case Bytecodes::_astore_1: 119.714 + case Bytecodes::_astore_2: 119.715 + case Bytecodes::_astore_3: 119.716 + case Bytecodes::_i2l: 119.717 + case Bytecodes::_i2f: 119.718 + case Bytecodes::_i2d: 119.719 + case Bytecodes::_i2b: 119.720 + case Bytecodes::_i2c: 119.721 + case Bytecodes::_i2s: 119.722 + case Bytecodes::_l2i: 119.723 + case Bytecodes::_l2f: 119.724 + case Bytecodes::_l2d: 119.725 + case Bytecodes::_f2i: 119.726 + case Bytecodes::_f2l: 119.727 + case Bytecodes::_f2d: 119.728 + case Bytecodes::_d2i: 119.729 + case Bytecodes::_d2l: 119.730 + case Bytecodes::_d2f: 119.731 + case Bytecodes::_ireturn: 119.732 + case Bytecodes::_lreturn: 119.733 + case Bytecodes::_freturn: 119.734 + case Bytecodes::_dreturn: 119.735 + case Bytecodes::_areturn: 119.736 + case Bytecodes::_return: 119.737 + assert(strcmp(Bytecodes::format(op), "b") == 0, "wrong bytecode format"); 119.738 + _bytecode.push(op); 119.739 + break; 119.740 + 119.741 + // bi 119.742 + case Bytecodes::_ldc: 119.743 + case Bytecodes::_iload: 119.744 + case Bytecodes::_lload: 119.745 + case Bytecodes::_fload: 119.746 + case Bytecodes::_dload: 119.747 + case Bytecodes::_aload: 119.748 + case Bytecodes::_istore: 119.749 + case Bytecodes::_lstore: 119.750 + case Bytecodes::_fstore: 119.751 + case Bytecodes::_dstore: 119.752 + case Bytecodes::_astore: 119.753 + assert(strcmp(Bytecodes::format(op), "bi") == 0, "wrong bytecode format"); 119.754 + assert((char) index == index, "index does not fit in 8-bit"); 119.755 + _bytecode.push(op); 119.756 + _bytecode.push(index); 119.757 + break; 119.758 + 119.759 + // bii 119.760 + case Bytecodes::_ldc2_w: 119.761 + case Bytecodes::_checkcast: 119.762 + assert(strcmp(Bytecodes::format(op), "bii") == 0, "wrong bytecode format"); 119.763 + assert((short) index == index, "index does not fit in 16-bit"); 119.764 + _bytecode.push(op); 119.765 + _bytecode.push(index >> 8); 119.766 + _bytecode.push(index); 119.767 + break; 119.768 + 119.769 + // bjj 119.770 + case Bytecodes::_invokestatic: 119.771 + case Bytecodes::_invokespecial: 119.772 + case Bytecodes::_invokevirtual: 119.773 + assert(strcmp(Bytecodes::format(op), "bjj") == 0, "wrong bytecode format"); 119.774 + assert((short) index == index, "index does not fit in 16-bit"); 119.775 + _bytecode.push(op); 119.776 + _bytecode.push(index >> 8); 119.777 + _bytecode.push(index); 119.778 + break; 119.779 + 119.780 + default: 119.781 + ShouldNotReachHere(); 119.782 + } 119.783 +} 119.784 + 119.785 + 119.786 +void MethodHandleCompiler::emit_load(BasicType bt, int index) { 119.787 + if (index <= 3) { 119.788 + switch (bt) { 119.789 + case T_BOOLEAN: case T_BYTE: case T_CHAR: case T_SHORT: 119.790 + case T_INT: emit_bc(Bytecodes::cast(Bytecodes::_iload_0 + index)); break; 119.791 + case T_LONG: emit_bc(Bytecodes::cast(Bytecodes::_lload_0 + index)); break; 119.792 + case T_FLOAT: emit_bc(Bytecodes::cast(Bytecodes::_fload_0 + index)); break; 119.793 + case T_DOUBLE: emit_bc(Bytecodes::cast(Bytecodes::_dload_0 + index)); break; 119.794 + case T_OBJECT: emit_bc(Bytecodes::cast(Bytecodes::_aload_0 + index)); break; 119.795 + default: 119.796 + ShouldNotReachHere(); 119.797 + } 119.798 + } 119.799 + else { 119.800 + switch (bt) { 119.801 + case T_BOOLEAN: case T_BYTE: case T_CHAR: case T_SHORT: 119.802 + case T_INT: emit_bc(Bytecodes::_iload, index); break; 119.803 + case T_LONG: emit_bc(Bytecodes::_lload, index); break; 119.804 + case T_FLOAT: emit_bc(Bytecodes::_fload, index); break; 119.805 + case T_DOUBLE: emit_bc(Bytecodes::_dload, index); break; 119.806 + case T_OBJECT: emit_bc(Bytecodes::_aload, index); break; 119.807 + default: 119.808 + ShouldNotReachHere(); 119.809 + } 119.810 + } 119.811 + stack_push(bt); 119.812 +} 119.813 + 119.814 +void MethodHandleCompiler::emit_store(BasicType bt, int index) { 119.815 + if (index <= 3) { 119.816 + switch (bt) { 119.817 + case T_BOOLEAN: case T_BYTE: case T_CHAR: case T_SHORT: 119.818 + case T_INT: emit_bc(Bytecodes::cast(Bytecodes::_istore_0 + index)); break; 119.819 + case T_LONG: emit_bc(Bytecodes::cast(Bytecodes::_lstore_0 + index)); break; 119.820 + case T_FLOAT: emit_bc(Bytecodes::cast(Bytecodes::_fstore_0 + index)); break; 119.821 + case T_DOUBLE: emit_bc(Bytecodes::cast(Bytecodes::_dstore_0 + index)); break; 119.822 + case T_OBJECT: emit_bc(Bytecodes::cast(Bytecodes::_astore_0 + index)); break; 119.823 + default: 119.824 + ShouldNotReachHere(); 119.825 + } 119.826 + } 119.827 + else { 119.828 + switch (bt) { 119.829 + case T_BOOLEAN: case T_BYTE: case T_CHAR: case T_SHORT: 119.830 + case T_INT: emit_bc(Bytecodes::_istore, index); break; 119.831 + case T_LONG: emit_bc(Bytecodes::_lstore, index); break; 119.832 + case T_FLOAT: emit_bc(Bytecodes::_fstore, index); break; 119.833 + case T_DOUBLE: emit_bc(Bytecodes::_dstore, index); break; 119.834 + case T_OBJECT: emit_bc(Bytecodes::_astore, index); break; 119.835 + default: 119.836 + ShouldNotReachHere(); 119.837 + } 119.838 + } 119.839 + stack_pop(bt); 119.840 +} 119.841 + 119.842 + 119.843 +void MethodHandleCompiler::emit_load_constant(ArgToken arg) { 119.844 + BasicType bt = arg.basic_type(); 119.845 + switch (bt) { 119.846 + case T_INT: { 119.847 + jint value = arg.get_jint(); 119.848 + if (-1 <= value && value <= 5) 119.849 + emit_bc(Bytecodes::cast(Bytecodes::_iconst_0 + value)); 119.850 + else 119.851 + emit_bc(Bytecodes::_ldc, cpool_int_put(value)); 119.852 + break; 119.853 + } 119.854 + case T_LONG: { 119.855 + jlong value = arg.get_jlong(); 119.856 + if (0 <= value && value <= 1) 119.857 + emit_bc(Bytecodes::cast(Bytecodes::_lconst_0 + (int) value)); 119.858 + else 119.859 + emit_bc(Bytecodes::_ldc2_w, cpool_long_put(value)); 119.860 + break; 119.861 + } 119.862 + case T_FLOAT: { 119.863 + jfloat value = arg.get_jfloat(); 119.864 + if (value == 0.0 || value == 1.0 || value == 2.0) 119.865 + emit_bc(Bytecodes::cast(Bytecodes::_fconst_0 + (int) value)); 119.866 + else 119.867 + emit_bc(Bytecodes::_ldc, cpool_float_put(value)); 119.868 + break; 119.869 + } 119.870 + case T_DOUBLE: { 119.871 + jdouble value = arg.get_jdouble(); 119.872 + if (value == 0.0 || value == 1.0) 119.873 + emit_bc(Bytecodes::cast(Bytecodes::_dconst_0 + (int) value)); 119.874 + else 119.875 + emit_bc(Bytecodes::_ldc2_w, cpool_double_put(value)); 119.876 + break; 119.877 + } 119.878 + case T_OBJECT: { 119.879 + Handle value = arg.object(); 119.880 + if (value.is_null()) 119.881 + emit_bc(Bytecodes::_aconst_null); 119.882 + else 119.883 + emit_bc(Bytecodes::_ldc, cpool_object_put(value)); 119.884 + break; 119.885 + } 119.886 + default: 119.887 + ShouldNotReachHere(); 119.888 + } 119.889 + stack_push(bt); 119.890 +} 119.891 + 119.892 + 119.893 +MethodHandleWalker::ArgToken 119.894 +MethodHandleCompiler::make_conversion(BasicType type, klassOop tk, Bytecodes::Code op, 119.895 + const ArgToken& src, TRAPS) { 119.896 + 119.897 + BasicType srctype = src.basic_type(); 119.898 + int index = src.index(); 119.899 + 119.900 + switch (op) { 119.901 + case Bytecodes::_i2l: 119.902 + case Bytecodes::_i2f: 119.903 + case Bytecodes::_i2d: 119.904 + case Bytecodes::_i2b: 119.905 + case Bytecodes::_i2c: 119.906 + case Bytecodes::_i2s: 119.907 + 119.908 + case Bytecodes::_l2i: 119.909 + case Bytecodes::_l2f: 119.910 + case Bytecodes::_l2d: 119.911 + 119.912 + case Bytecodes::_f2i: 119.913 + case Bytecodes::_f2l: 119.914 + case Bytecodes::_f2d: 119.915 + 119.916 + case Bytecodes::_d2i: 119.917 + case Bytecodes::_d2l: 119.918 + case Bytecodes::_d2f: 119.919 + emit_load(srctype, index); 119.920 + stack_pop(srctype); // pop the src type 119.921 + emit_bc(op); 119.922 + stack_push(type); // push the dest value 119.923 + if (srctype != type) 119.924 + index = new_local_index(type); 119.925 + emit_store(type, index); 119.926 + break; 119.927 + 119.928 + case Bytecodes::_checkcast: 119.929 + emit_load(srctype, index); 119.930 + emit_bc(op, cpool_klass_put(tk)); 119.931 + emit_store(srctype, index); 119.932 + break; 119.933 + 119.934 + default: 119.935 + ShouldNotReachHere(); 119.936 + } 119.937 + 119.938 + return make_parameter(type, tk, index, THREAD); 119.939 +} 119.940 + 119.941 + 119.942 +// ----------------------------------------------------------------------------- 119.943 +// MethodHandleCompiler 119.944 +// 119.945 + 119.946 +static jvalue zero_jvalue; 119.947 + 119.948 +// Emit bytecodes for the given invoke instruction. 119.949 +MethodHandleWalker::ArgToken 119.950 +MethodHandleCompiler::make_invoke(methodOop m, vmIntrinsics::ID iid, 119.951 + Bytecodes::Code op, bool tailcall, 119.952 + int argc, MethodHandleWalker::ArgToken* argv, 119.953 + TRAPS) { 119.954 + if (m == NULL) { 119.955 + // Get the intrinsic methodOop. 119.956 + m = vmIntrinsics::method_for(iid); 119.957 + } 119.958 + 119.959 + klassOop klass = m->method_holder(); 119.960 + symbolOop name = m->name(); 119.961 + symbolOop signature = m->signature(); 119.962 + 119.963 + // This generated adapter method should be in the same class as the 119.964 + // DMH target method (for accessability reasons). 119.965 + if (tailcall) { 119.966 + _target_klass = klass; 119.967 + } 119.968 + 119.969 + // instanceKlass* ik = instanceKlass::cast(klass); 119.970 + // tty->print_cr("MethodHandleCompiler::make_invoke: %s %s.%s%s", Bytecodes::name(op), ik->external_name(), name->as_C_string(), signature->as_C_string()); 119.971 + 119.972 + // Inline the method. 119.973 + InvocationCounter* ic = m->invocation_counter(); 119.974 + ic->set_carry(); 119.975 + 119.976 + for (int i = 0; i < argc; i++) { 119.977 + ArgToken arg = argv[i]; 119.978 + TokenType tt = arg.token_type(); 119.979 + BasicType bt = arg.basic_type(); 119.980 + 119.981 + switch (tt) { 119.982 + case tt_parameter: 119.983 + case tt_temporary: 119.984 + emit_load(bt, arg.index()); 119.985 + break; 119.986 + case tt_constant: 119.987 + emit_load_constant(arg); 119.988 + break; 119.989 + case tt_illegal: 119.990 + // Sentinel. 119.991 + assert(i == (argc - 1), "sentinel must be last entry"); 119.992 + break; 119.993 + case tt_void: 119.994 + default: 119.995 + ShouldNotReachHere(); 119.996 + } 119.997 + } 119.998 + 119.999 + // Populate constant pool. 119.1000 + int name_index = cpool_symbol_put(name); 119.1001 + int signature_index = cpool_symbol_put(signature); 119.1002 + int name_and_type_index = cpool_name_and_type_put(name_index, signature_index); 119.1003 + int klass_index = cpool_klass_put(klass); 119.1004 + int methodref_index = cpool_methodref_put(klass_index, name_and_type_index); 119.1005 + 119.1006 + // Generate invoke. 119.1007 + switch (op) { 119.1008 + case Bytecodes::_invokestatic: 119.1009 + case Bytecodes::_invokespecial: 119.1010 + case Bytecodes::_invokevirtual: 119.1011 + emit_bc(op, methodref_index); 119.1012 + break; 119.1013 + case Bytecodes::_invokeinterface: 119.1014 + Unimplemented(); 119.1015 + break; 119.1016 + default: 119.1017 + ShouldNotReachHere(); 119.1018 + } 119.1019 + 119.1020 + // If tailcall, we have walked all the way to a direct method handle. 119.1021 + // Otherwise, make a recursive call to some helper routine. 119.1022 + BasicType rbt = m->result_type(); 119.1023 + ArgToken ret; 119.1024 + if (tailcall) { 119.1025 + if (rbt != _rtype) { 119.1026 + if (rbt == T_VOID) { 119.1027 + // push a zero of the right sort 119.1028 + ArgToken zero; 119.1029 + if (_rtype == T_OBJECT) { 119.1030 + zero = make_oop_constant(NULL, CHECK_(zero)); 119.1031 + } else { 119.1032 + zero = make_prim_constant(_rtype, &zero_jvalue, CHECK_(zero)); 119.1033 + } 119.1034 + emit_load_constant(zero); 119.1035 + } else if (_rtype == T_VOID) { 119.1036 + // We'll emit a _return with something on the stack. 119.1037 + // It's OK to ignore what's on the stack. 119.1038 + } else { 119.1039 + tty->print_cr("*** rbt=%d != rtype=%d", rbt, _rtype); 119.1040 + assert(false, "IMPLEMENT ME"); 119.1041 + } 119.1042 + } 119.1043 + switch (_rtype) { 119.1044 + case T_BOOLEAN: case T_BYTE: case T_CHAR: case T_SHORT: 119.1045 + case T_INT: emit_bc(Bytecodes::_ireturn); break; 119.1046 + case T_LONG: emit_bc(Bytecodes::_lreturn); break; 119.1047 + case T_FLOAT: emit_bc(Bytecodes::_freturn); break; 119.1048 + case T_DOUBLE: emit_bc(Bytecodes::_dreturn); break; 119.1049 + case T_VOID: emit_bc(Bytecodes::_return); break; 119.1050 + case T_OBJECT: 119.1051 + if (_rklass.not_null() && _rklass() != SystemDictionary::Object_klass()) 119.1052 + emit_bc(Bytecodes::_checkcast, cpool_klass_put(_rklass())); 119.1053 + emit_bc(Bytecodes::_areturn); 119.1054 + break; 119.1055 + default: ShouldNotReachHere(); 119.1056 + } 119.1057 + ret = ArgToken(); // Dummy return value. 119.1058 + } 119.1059 + else { 119.1060 + stack_push(rbt); // The return value is already pushed onto the stack. 119.1061 + int index = new_local_index(rbt); 119.1062 + switch (rbt) { 119.1063 + case T_BOOLEAN: case T_BYTE: case T_CHAR: case T_SHORT: 119.1064 + case T_INT: case T_LONG: case T_FLOAT: case T_DOUBLE: 119.1065 + case T_OBJECT: 119.1066 + emit_store(rbt, index); 119.1067 + ret = ArgToken(tt_temporary, rbt, index); 119.1068 + break; 119.1069 + case T_VOID: 119.1070 + ret = ArgToken(tt_void); 119.1071 + break; 119.1072 + default: 119.1073 + ShouldNotReachHere(); 119.1074 + } 119.1075 + } 119.1076 + 119.1077 + return ret; 119.1078 +} 119.1079 + 119.1080 +MethodHandleWalker::ArgToken 119.1081 +MethodHandleCompiler::make_fetch(BasicType type, klassOop tk, Bytecodes::Code op, 119.1082 + const MethodHandleWalker::ArgToken& base, 119.1083 + const MethodHandleWalker::ArgToken& offset, 119.1084 + TRAPS) { 119.1085 + Unimplemented(); 119.1086 + return ArgToken(); 119.1087 +} 119.1088 + 119.1089 + 119.1090 +int MethodHandleCompiler::cpool_primitive_put(BasicType bt, jvalue* con) { 119.1091 + jvalue con_copy; 119.1092 + assert(bt < T_OBJECT, ""); 119.1093 + if (type2aelembytes(bt) < jintSize) { 119.1094 + // widen to int 119.1095 + con_copy = (*con); 119.1096 + con = &con_copy; 119.1097 + switch (bt) { 119.1098 + case T_BOOLEAN: con->i = (con->z ? 1 : 0); break; 119.1099 + case T_BYTE: con->i = con->b; break; 119.1100 + case T_CHAR: con->i = con->c; break; 119.1101 + case T_SHORT: con->i = con->s; break; 119.1102 + default: ShouldNotReachHere(); 119.1103 + } 119.1104 + bt = T_INT; 119.1105 + } 119.1106 + 119.1107 +// for (int i = 1, imax = _constants.length(); i < imax; i++) { 119.1108 +// ConstantValue* con = _constants.at(i); 119.1109 +// if (con != NULL && con->is_primitive() && con->_type == bt) { 119.1110 +// bool match = false; 119.1111 +// switch (type2size[bt]) { 119.1112 +// case 1: if (pcon->_value.i == con->i) match = true; break; 119.1113 +// case 2: if (pcon->_value.j == con->j) match = true; break; 119.1114 +// } 119.1115 +// if (match) 119.1116 +// return i; 119.1117 +// } 119.1118 +// } 119.1119 + ConstantValue* cv = new ConstantValue(bt, *con); 119.1120 + int index = _constants.append(cv); 119.1121 + 119.1122 + // long and double entries take 2 slots, we add another empty entry. 119.1123 + if (type2size[bt] == 2) 119.1124 + (void) _constants.append(NULL); 119.1125 + 119.1126 + return index; 119.1127 +} 119.1128 + 119.1129 + 119.1130 +constantPoolHandle MethodHandleCompiler::get_constant_pool(TRAPS) const { 119.1131 + constantPoolHandle nullHandle; 119.1132 + bool is_conc_safe = true; 119.1133 + constantPoolOop cpool_oop = oopFactory::new_constantPool(_constants.length(), is_conc_safe, CHECK_(nullHandle)); 119.1134 + constantPoolHandle cpool(THREAD, cpool_oop); 119.1135 + 119.1136 + // Fill the real constant pool skipping the zero element. 119.1137 + for (int i = 1; i < _constants.length(); i++) { 119.1138 + ConstantValue* cv = _constants.at(i); 119.1139 + switch (cv->tag()) { 119.1140 + case JVM_CONSTANT_Utf8: cpool->symbol_at_put( i, cv->symbol_oop() ); break; 119.1141 + case JVM_CONSTANT_Integer: cpool->int_at_put( i, cv->get_jint() ); break; 119.1142 + case JVM_CONSTANT_Float: cpool->float_at_put( i, cv->get_jfloat() ); break; 119.1143 + case JVM_CONSTANT_Long: cpool->long_at_put( i, cv->get_jlong() ); break; 119.1144 + case JVM_CONSTANT_Double: cpool->double_at_put( i, cv->get_jdouble() ); break; 119.1145 + case JVM_CONSTANT_Class: cpool->klass_at_put( i, cv->klass_oop() ); break; 119.1146 + case JVM_CONSTANT_Methodref: cpool->method_at_put( i, cv->first_index(), cv->second_index()); break; 119.1147 + case JVM_CONSTANT_NameAndType: cpool->name_and_type_at_put(i, cv->first_index(), cv->second_index()); break; 119.1148 + case JVM_CONSTANT_Object: cpool->object_at_put( i, cv->object_oop() ); break; 119.1149 + default: ShouldNotReachHere(); 119.1150 + } 119.1151 + 119.1152 + switch (cv->tag()) { 119.1153 + case JVM_CONSTANT_Long: 119.1154 + case JVM_CONSTANT_Double: 119.1155 + i++; // Skip empty entry. 119.1156 + assert(_constants.at(i) == NULL, "empty entry"); 119.1157 + break; 119.1158 + } 119.1159 + } 119.1160 + 119.1161 + // Set the constant pool holder to the target method's class. 119.1162 + cpool->set_pool_holder(_target_klass()); 119.1163 + 119.1164 + return cpool; 119.1165 +} 119.1166 + 119.1167 + 119.1168 +methodHandle MethodHandleCompiler::get_method_oop(TRAPS) const { 119.1169 + methodHandle nullHandle; 119.1170 + // Create a method that holds the generated bytecode. invokedynamic 119.1171 + // has no receiver, normal MH calls do. 119.1172 + int flags_bits; 119.1173 + if (for_invokedynamic()) 119.1174 + flags_bits = (/*JVM_MH_INVOKE_BITS |*/ JVM_ACC_PUBLIC | JVM_ACC_FINAL | JVM_ACC_STATIC); 119.1175 + else 119.1176 + flags_bits = (/*JVM_MH_INVOKE_BITS |*/ JVM_ACC_PUBLIC | JVM_ACC_FINAL); 119.1177 + 119.1178 + bool is_conc_safe = true; 119.1179 + methodOop m_oop = oopFactory::new_method(bytecode_length(), 119.1180 + accessFlags_from(flags_bits), 119.1181 + 0, 0, 0, is_conc_safe, CHECK_(nullHandle)); 119.1182 + methodHandle m(THREAD, m_oop); 119.1183 + m_oop = NULL; // oop not GC safe 119.1184 + 119.1185 + constantPoolHandle cpool = get_constant_pool(CHECK_(nullHandle)); 119.1186 + m->set_constants(cpool()); 119.1187 + 119.1188 + m->set_name_index(_name_index); 119.1189 + m->set_signature_index(_signature_index); 119.1190 + 119.1191 + m->set_code((address) bytecode()); 119.1192 + 119.1193 + m->set_max_stack(_max_stack); 119.1194 + m->set_max_locals(max_locals()); 119.1195 + m->set_size_of_parameters(_num_params); 119.1196 + 119.1197 + typeArrayHandle exception_handlers(THREAD, Universe::the_empty_int_array()); 119.1198 + m->set_exception_table(exception_handlers()); 119.1199 + 119.1200 + // Set the carry bit of the invocation counter to force inlining of 119.1201 + // the adapter. 119.1202 + InvocationCounter* ic = m->invocation_counter(); 119.1203 + ic->set_carry(); 119.1204 + 119.1205 + // Rewrite the method and set up the constant pool cache. 119.1206 + objArrayOop m_array = oopFactory::new_system_objArray(1, CHECK_(nullHandle)); 119.1207 + objArrayHandle methods(THREAD, m_array); 119.1208 + methods->obj_at_put(0, m()); 119.1209 + Rewriter::rewrite(_target_klass(), cpool, methods, CHECK_(nullHandle)); // Use fake class. 119.1210 + 119.1211 +#ifndef PRODUCT 119.1212 + if (TraceMethodHandles) { 119.1213 + m->print(); 119.1214 + m->print_codes(); 119.1215 + } 119.1216 +#endif //PRODUCT 119.1217 + 119.1218 + return m; 119.1219 +} 119.1220 + 119.1221 + 119.1222 +#ifndef PRODUCT 119.1223 + 119.1224 +#if 0 119.1225 +// MH printer for debugging. 119.1226 + 119.1227 +class MethodHandlePrinter : public MethodHandleWalker { 119.1228 +private: 119.1229 + outputStream* _out; 119.1230 + bool _verbose; 119.1231 + int _temp_num; 119.1232 + stringStream _strbuf; 119.1233 + const char* strbuf() { 119.1234 + const char* s = _strbuf.as_string(); 119.1235 + _strbuf.reset(); 119.1236 + return s; 119.1237 + } 119.1238 + ArgToken token(const char* str) { 119.1239 + return (ArgToken) str; 119.1240 + } 119.1241 + void start_params() { 119.1242 + _out->print("("); 119.1243 + } 119.1244 + void end_params() { 119.1245 + if (_verbose) _out->print("\n"); 119.1246 + _out->print(") => {"); 119.1247 + } 119.1248 + void put_type_name(BasicType type, klassOop tk, outputStream* s) { 119.1249 + const char* kname = NULL; 119.1250 + if (tk != NULL) 119.1251 + kname = Klass::cast(tk)->external_name(); 119.1252 + s->print("%s", (kname != NULL) ? kname : type2name(type)); 119.1253 + } 119.1254 + ArgToken maybe_make_temp(const char* statement_op, BasicType type, const char* temp_name) { 119.1255 + const char* value = strbuf(); 119.1256 + if (!_verbose) return token(value); 119.1257 + // make an explicit binding for each separate value 119.1258 + _strbuf.print("%s%d", temp_name, ++_temp_num); 119.1259 + const char* temp = strbuf(); 119.1260 + _out->print("\n %s %s %s = %s;", statement_op, type2name(type), temp, value); 119.1261 + return token(temp); 119.1262 + } 119.1263 + 119.1264 +public: 119.1265 + MethodHandlePrinter(Handle root, bool verbose, outputStream* out, TRAPS) 119.1266 + : MethodHandleWalker(root, THREAD), 119.1267 + _out(out), 119.1268 + _verbose(verbose), 119.1269 + _temp_num(0) 119.1270 + { 119.1271 + start_params(); 119.1272 + } 119.1273 + virtual ArgToken make_parameter(BasicType type, klassOop tk, int argnum, TRAPS) { 119.1274 + if (argnum < 0) { 119.1275 + end_params(); 119.1276 + return NULL; 119.1277 + } 119.1278 + if (argnum == 0) { 119.1279 + _out->print(_verbose ? "\n " : ""); 119.1280 + } else { 119.1281 + _out->print(_verbose ? ",\n " : ", "); 119.1282 + } 119.1283 + if (argnum >= _temp_num) 119.1284 + _temp_num = argnum; 119.1285 + // generate an argument name 119.1286 + _strbuf.print("a%d", argnum); 119.1287 + const char* arg = strbuf(); 119.1288 + put_type_name(type, tk, _out); 119.1289 + _out->print(" %s", arg); 119.1290 + return token(arg); 119.1291 + } 119.1292 + virtual ArgToken make_oop_constant(oop con, TRAPS) { 119.1293 + if (con == NULL) 119.1294 + _strbuf.print("null"); 119.1295 + else 119.1296 + con->print_value_on(&_strbuf); 119.1297 + if (_strbuf.size() == 0) { // yuck 119.1298 + _strbuf.print("(a "); 119.1299 + put_type_name(T_OBJECT, con->klass(), &_strbuf); 119.1300 + _strbuf.print(")"); 119.1301 + } 119.1302 + return maybe_make_temp("constant", T_OBJECT, "k"); 119.1303 + } 119.1304 + virtual ArgToken make_prim_constant(BasicType type, jvalue* con, TRAPS) { 119.1305 + java_lang_boxing_object::print(type, con, &_strbuf); 119.1306 + return maybe_make_temp("constant", type, "k"); 119.1307 + } 119.1308 + virtual ArgToken make_conversion(BasicType type, klassOop tk, Bytecodes::Code op, ArgToken src, TRAPS) { 119.1309 + _strbuf.print("%s(%s", Bytecodes::name(op), (const char*)src); 119.1310 + if (tk != NULL) { 119.1311 + _strbuf.print(", "); 119.1312 + put_type_name(type, tk, &_strbuf); 119.1313 + } 119.1314 + _strbuf.print(")"); 119.1315 + return maybe_make_temp("convert", type, "v"); 119.1316 + } 119.1317 + virtual ArgToken make_fetch(BasicType type, klassOop tk, Bytecodes::Code op, ArgToken base, ArgToken offset, TRAPS) { 119.1318 + _strbuf.print("%s(%s, %s", Bytecodes::name(op), (const char*)base, (const char*)offset); 119.1319 + if (tk != NULL) { 119.1320 + _strbuf.print(", "); 119.1321 + put_type_name(type, tk, &_strbuf); 119.1322 + } 119.1323 + _strbuf.print(")"); 119.1324 + return maybe_make_temp("fetch", type, "x"); 119.1325 + } 119.1326 + virtual ArgToken make_invoke(methodOop m, vmIntrinsics::ID iid, 119.1327 + Bytecodes::Code op, bool tailcall, 119.1328 + int argc, ArgToken* argv, TRAPS) { 119.1329 + symbolOop name, sig; 119.1330 + if (m != NULL) { 119.1331 + name = m->name(); 119.1332 + sig = m->signature(); 119.1333 + } else { 119.1334 + name = vmSymbols::symbol_at(vmIntrinsics::name_for(iid)); 119.1335 + sig = vmSymbols::symbol_at(vmIntrinsics::signature_for(iid)); 119.1336 + } 119.1337 + _strbuf.print("%s %s%s(", Bytecodes::name(op), name->as_C_string(), sig->as_C_string()); 119.1338 + for (int i = 0; i < argc; i++) { 119.1339 + _strbuf.print("%s%s", (i > 0 ? ", " : ""), (const char*)argv[i]); 119.1340 + } 119.1341 + _strbuf.print(")"); 119.1342 + if (!tailcall) { 119.1343 + BasicType rt = char2type(sig->byte_at(sig->utf8_length()-1)); 119.1344 + if (rt == T_ILLEGAL) rt = T_OBJECT; // ';' at the end of '(...)L...;' 119.1345 + return maybe_make_temp("invoke", rt, "x"); 119.1346 + } else { 119.1347 + const char* ret = strbuf(); 119.1348 + _out->print(_verbose ? "\n return " : " "); 119.1349 + _out->print("%s", ret); 119.1350 + _out->print(_verbose ? "\n}\n" : " }"); 119.1351 + } 119.1352 + return ArgToken(); 119.1353 + } 119.1354 + 119.1355 + virtual void set_method_handle(oop mh) { 119.1356 + if (WizardMode && Verbose) { 119.1357 + tty->print("\n--- next target: "); 119.1358 + mh->print(); 119.1359 + } 119.1360 + } 119.1361 + 119.1362 + static void print(Handle root, bool verbose, outputStream* out, TRAPS) { 119.1363 + ResourceMark rm; 119.1364 + MethodHandlePrinter printer(root, verbose, out, CHECK); 119.1365 + printer.walk(CHECK); 119.1366 + out->print("\n"); 119.1367 + } 119.1368 + static void print(Handle root, bool verbose = Verbose, outputStream* out = tty) { 119.1369 + EXCEPTION_MARK; 119.1370 + ResourceMark rm; 119.1371 + MethodHandlePrinter printer(root, verbose, out, THREAD); 119.1372 + if (!HAS_PENDING_EXCEPTION) 119.1373 + printer.walk(THREAD); 119.1374 + if (HAS_PENDING_EXCEPTION) { 119.1375 + oop ex = PENDING_EXCEPTION; 119.1376 + CLEAR_PENDING_EXCEPTION; 119.1377 + out->print("\n*** "); 119.1378 + if (ex != Universe::virtual_machine_error_instance()) 119.1379 + ex->print_on(out); 119.1380 + else 119.1381 + out->print("lose: %s", printer.lose_message()); 119.1382 + out->print("\n}\n"); 119.1383 + } 119.1384 + out->print("\n"); 119.1385 + } 119.1386 +}; 119.1387 +#endif // 0 119.1388 + 119.1389 +extern "C" 119.1390 +void print_method_handle(oop mh) { 119.1391 + if (java_dyn_MethodHandle::is_instance(mh)) { 119.1392 + //MethodHandlePrinter::print(mh); 119.1393 + } else { 119.1394 + tty->print("*** not a method handle: "); 119.1395 + mh->print(); 119.1396 + } 119.1397 +} 119.1398 + 119.1399 +#endif // PRODUCT
120.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 120.2 +++ b/src/share/vm/prims/methodHandleWalk.hpp Wed Jan 06 22:21:39 2010 -0800 120.3 @@ -0,0 +1,407 @@ 120.4 +/* 120.5 + * Copyright 2008-2010 Sun Microsystems, Inc. All Rights Reserved. 120.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 120.7 + * 120.8 + * This code is free software; you can redistribute it and/or modify it 120.9 + * under the terms of the GNU General Public License version 2 only, as 120.10 + * published by the Free Software Foundation. 120.11 + * 120.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 120.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 120.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 120.15 + * version 2 for more details (a copy is included in the LICENSE file that 120.16 + * accompanied this code). 120.17 + * 120.18 + * You should have received a copy of the GNU General Public License version 120.19 + * 2 along with this work; if not, write to the Free Software Foundation, 120.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 120.21 + * 120.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 120.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 120.24 + * have any questions. 120.25 + * 120.26 + */ 120.27 + 120.28 +// Low-level parser for method handle chains. 120.29 +class MethodHandleChain : StackObj { 120.30 +public: 120.31 + typedef MethodHandles::EntryKind EntryKind; 120.32 + 120.33 +private: 120.34 + Handle _root; // original target 120.35 + Handle _method_handle; // current target 120.36 + bool _is_last; // final guy in chain 120.37 + bool _is_bound; // has a bound argument 120.38 + BasicType _arg_type; // if is_bound, the bound argument type 120.39 + int _arg_slot; // if is_bound or is_adapter, affected argument slot 120.40 + jint _conversion; // conversion field of AMH or -1 120.41 + methodHandle _last_method; // if is_last, which method we target 120.42 + Bytecodes::Code _last_invoke; // if is_last, type of invoke 120.43 + const char* _lose_message; // saved argument to lose() 120.44 + 120.45 + void set_method_handle(Handle target, TRAPS); 120.46 + void set_last_method(oop target, TRAPS); 120.47 + static BasicType compute_bound_arg_type(oop target, methodOop m, int arg_slot, TRAPS); 120.48 + 120.49 + oop MethodHandle_type_oop() { return java_dyn_MethodHandle::type(method_handle_oop()); } 120.50 + oop MethodHandle_vmtarget_oop() { return java_dyn_MethodHandle::vmtarget(method_handle_oop()); } 120.51 + int MethodHandle_vmslots() { return java_dyn_MethodHandle::vmslots(method_handle_oop()); } 120.52 + int DirectMethodHandle_vmindex() { return sun_dyn_DirectMethodHandle::vmindex(method_handle_oop()); } 120.53 + oop BoundMethodHandle_argument_oop() { return sun_dyn_BoundMethodHandle::argument(method_handle_oop()); } 120.54 + int BoundMethodHandle_vmargslot() { return sun_dyn_BoundMethodHandle::vmargslot(method_handle_oop()); } 120.55 + int AdapterMethodHandle_conversion() { return sun_dyn_AdapterMethodHandle::conversion(method_handle_oop()); } 120.56 + 120.57 +public: 120.58 + MethodHandleChain(Handle root, TRAPS) 120.59 + : _root(root) 120.60 + { set_method_handle(root, THREAD); } 120.61 + 120.62 + bool is_adapter() { return _conversion != -1; } 120.63 + bool is_bound() { return _is_bound; } 120.64 + bool is_last() { return _is_last; } 120.65 + 120.66 + void next(TRAPS) { 120.67 + assert(!is_last(), ""); 120.68 + set_method_handle(MethodHandle_vmtarget_oop(), THREAD); 120.69 + } 120.70 + 120.71 + Handle method_handle() { return _method_handle; } 120.72 + oop method_handle_oop() { return _method_handle(); } 120.73 + oop method_type_oop() { return MethodHandle_type_oop(); } 120.74 + oop vmtarget_oop() { return MethodHandle_vmtarget_oop(); } 120.75 + 120.76 + jint adapter_conversion() { assert(is_adapter(), ""); return _conversion; } 120.77 + int adapter_conversion_op() { return MethodHandles::adapter_conversion_op(adapter_conversion()); } 120.78 + BasicType adapter_conversion_src_type() 120.79 + { return MethodHandles::adapter_conversion_src_type(adapter_conversion()); } 120.80 + BasicType adapter_conversion_dest_type() 120.81 + { return MethodHandles::adapter_conversion_dest_type(adapter_conversion()); } 120.82 + int adapter_conversion_stack_move() 120.83 + { return MethodHandles::adapter_conversion_stack_move(adapter_conversion()); } 120.84 + int adapter_conversion_stack_pushes() 120.85 + { return adapter_conversion_stack_move() / MethodHandles::stack_move_unit(); } 120.86 + int adapter_conversion_vminfo() 120.87 + { return MethodHandles::adapter_conversion_vminfo(adapter_conversion()); } 120.88 + int adapter_arg_slot() { assert(is_adapter(), ""); return _arg_slot; } 120.89 + oop adapter_arg_oop() { assert(is_adapter(), ""); return BoundMethodHandle_argument_oop(); } 120.90 + 120.91 + BasicType bound_arg_type() { assert(is_bound(), ""); return _arg_type; } 120.92 + int bound_arg_slot() { assert(is_bound(), ""); return _arg_slot; } 120.93 + oop bound_arg_oop() { assert(is_bound(), ""); return BoundMethodHandle_argument_oop(); } 120.94 + 120.95 + methodOop last_method_oop() { assert(is_last(), ""); return _last_method(); } 120.96 + Bytecodes::Code last_invoke_code() { assert(is_last(), ""); return _last_invoke; } 120.97 + 120.98 + void lose(const char* msg, TRAPS); 120.99 + const char* lose_message() { return _lose_message; } 120.100 +}; 120.101 + 120.102 + 120.103 +// Structure walker for method handles. 120.104 +// Does abstract interpretation on top of low-level parsing. 120.105 +// You supply the tokens shuffled by the abstract interpretation. 120.106 +class MethodHandleWalker : StackObj { 120.107 +public: 120.108 + // Stack values: 120.109 + enum TokenType { 120.110 + tt_void, 120.111 + tt_parameter, 120.112 + tt_temporary, 120.113 + tt_constant, 120.114 + tt_illegal 120.115 + }; 120.116 + 120.117 + // Argument token: 120.118 + class ArgToken { 120.119 + private: 120.120 + TokenType _tt; 120.121 + BasicType _bt; 120.122 + jvalue _value; 120.123 + Handle _handle; 120.124 + 120.125 + public: 120.126 + ArgToken(TokenType tt = tt_illegal) : _tt(tt) {} 120.127 + ArgToken(TokenType tt, BasicType bt, jvalue value) : _tt(tt), _bt(bt), _value(value) {} 120.128 + 120.129 + ArgToken(TokenType tt, BasicType bt, int index) : _tt(tt), _bt(bt) { 120.130 + _value.i = index; 120.131 + } 120.132 + 120.133 + ArgToken(TokenType tt, BasicType bt, Handle value) : _tt(tt), _bt(bt) { 120.134 + _handle = value; 120.135 + } 120.136 + 120.137 + TokenType token_type() const { return _tt; } 120.138 + BasicType basic_type() const { return _bt; } 120.139 + int index() const { return _value.i; } 120.140 + Handle object() const { return _handle; } 120.141 + 120.142 + jint get_jint() const { return _value.i; } 120.143 + jlong get_jlong() const { return _value.j; } 120.144 + jfloat get_jfloat() const { return _value.f; } 120.145 + jdouble get_jdouble() const { return _value.d; } 120.146 + }; 120.147 + 120.148 + // Abstract interpretation state: 120.149 + struct SlotState { 120.150 + BasicType _type; 120.151 + ArgToken _arg; 120.152 + SlotState() : _type(), _arg() {} 120.153 + }; 120.154 + static SlotState make_state(BasicType type, ArgToken arg) { 120.155 + SlotState ss; 120.156 + ss._type = type; ss._arg = arg; 120.157 + return ss; 120.158 + } 120.159 + 120.160 +private: 120.161 + MethodHandleChain _chain; 120.162 + bool _for_invokedynamic; 120.163 + int _local_index; 120.164 + 120.165 + GrowableArray<SlotState> _outgoing; // current outgoing parameter slots 120.166 + int _outgoing_argc; // # non-empty outgoing slots 120.167 + 120.168 + // Replace a value of type old_type at slot (and maybe slot+1) with the new value. 120.169 + // If old_type != T_VOID, remove the old argument at that point. 120.170 + // If new_type != T_VOID, insert the new argument at that point. 120.171 + // Insert or delete a second empty slot as needed. 120.172 + void change_argument(BasicType old_type, int slot, BasicType new_type, const ArgToken& new_arg); 120.173 + 120.174 + SlotState* slot_state(int slot) { 120.175 + if (slot < 0 || slot >= _outgoing.length()) 120.176 + return NULL; 120.177 + return _outgoing.adr_at(slot); 120.178 + } 120.179 + BasicType slot_type(int slot) { 120.180 + SlotState* ss = slot_state(slot); 120.181 + if (ss == NULL) 120.182 + return T_ILLEGAL; 120.183 + return ss->_type; 120.184 + } 120.185 + bool slot_has_argument(int slot) { 120.186 + return slot_type(slot) < T_VOID; 120.187 + } 120.188 + 120.189 +#ifdef ASSERT 120.190 + int argument_count_slow(); 120.191 +#endif 120.192 + 120.193 + // Return a bytecode for converting src to dest, if one exists. 120.194 + Bytecodes::Code conversion_code(BasicType src, BasicType dest); 120.195 + 120.196 + void walk_incoming_state(TRAPS); 120.197 + 120.198 +public: 120.199 + MethodHandleWalker(Handle root, bool for_invokedynamic, TRAPS) 120.200 + : _chain(root, THREAD), 120.201 + _for_invokedynamic(for_invokedynamic), 120.202 + _outgoing(THREAD, 10), 120.203 + _outgoing_argc(0) 120.204 + { 120.205 + _local_index = for_invokedynamic ? 0 : 1; 120.206 + } 120.207 + 120.208 + MethodHandleChain& chain() { return _chain; } 120.209 + 120.210 + bool for_invokedynamic() const { return _for_invokedynamic; } 120.211 + 120.212 + int new_local_index(BasicType bt) { 120.213 + //int index = _for_invokedynamic ? _local_index : _local_index - 1; 120.214 + int index = _local_index; 120.215 + _local_index += type2size[bt]; 120.216 + return index; 120.217 + } 120.218 + 120.219 + int max_locals() const { return _local_index; } 120.220 + 120.221 + // plug-in abstract interpretation steps: 120.222 + virtual ArgToken make_parameter( BasicType type, klassOop tk, int argnum, TRAPS ) = 0; 120.223 + virtual ArgToken make_prim_constant( BasicType type, jvalue* con, TRAPS ) = 0; 120.224 + virtual ArgToken make_oop_constant( oop con, TRAPS ) = 0; 120.225 + virtual ArgToken make_conversion( BasicType type, klassOop tk, Bytecodes::Code op, const ArgToken& src, TRAPS ) = 0; 120.226 + virtual ArgToken make_fetch( BasicType type, klassOop tk, Bytecodes::Code op, const ArgToken& base, const ArgToken& offset, TRAPS ) = 0; 120.227 + virtual ArgToken make_invoke( methodOop m, vmIntrinsics::ID iid, Bytecodes::Code op, bool tailcall, int argc, ArgToken* argv, TRAPS ) = 0; 120.228 + 120.229 + // For make_invoke, the methodOop can be NULL if the intrinsic ID 120.230 + // is something other than vmIntrinsics::_none. 120.231 + 120.232 + // and in case anyone cares to related the previous actions to the chain: 120.233 + virtual void set_method_handle(oop mh) { } 120.234 + 120.235 + void lose(const char* msg, TRAPS) { chain().lose(msg, THREAD); } 120.236 + const char* lose_message() { return chain().lose_message(); } 120.237 + 120.238 + ArgToken walk(TRAPS); 120.239 +}; 120.240 + 120.241 + 120.242 +// An abstract interpreter for method handle chains. 120.243 +// Produces an account of the semantics of a chain, in terms of a static IR. 120.244 +// The IR happens to be JVM bytecodes. 120.245 +class MethodHandleCompiler : public MethodHandleWalker { 120.246 +private: 120.247 + methodHandle _callee; 120.248 + KlassHandle _rklass; // Return type for casting. 120.249 + BasicType _rtype; 120.250 + KlassHandle _target_klass; 120.251 + Thread* _thread; 120.252 + 120.253 + // Fake constant pool entry. 120.254 + class ConstantValue { 120.255 + private: 120.256 + int _tag; // Constant pool tag type. 120.257 + JavaValue _value; 120.258 + Handle _handle; 120.259 + 120.260 + public: 120.261 + // Constructor for oop types. 120.262 + ConstantValue(int tag, Handle con) : _tag(tag), _handle(con) { 120.263 + assert(tag == JVM_CONSTANT_Utf8 || 120.264 + tag == JVM_CONSTANT_Class || 120.265 + tag == JVM_CONSTANT_String || 120.266 + tag == JVM_CONSTANT_Object, "must be oop type"); 120.267 + } 120.268 + 120.269 + // Constructor for oop reference types. 120.270 + ConstantValue(int tag, int index) : _tag(tag) { 120.271 + assert(JVM_CONSTANT_Fieldref <= tag && tag <= JVM_CONSTANT_NameAndType, "must be ref type"); 120.272 + _value.set_jint(index); 120.273 + } 120.274 + ConstantValue(int tag, int first_index, int second_index) : _tag(tag) { 120.275 + assert(JVM_CONSTANT_Fieldref <= tag && tag <= JVM_CONSTANT_NameAndType, "must be ref type"); 120.276 + _value.set_jint(first_index << 16 | second_index); 120.277 + } 120.278 + 120.279 + // Constructor for primitive types. 120.280 + ConstantValue(BasicType bt, jvalue con) { 120.281 + _value.set_type(bt); 120.282 + switch (bt) { 120.283 + case T_INT: _tag = JVM_CONSTANT_Integer; _value.set_jint( con.i); break; 120.284 + case T_LONG: _tag = JVM_CONSTANT_Long; _value.set_jlong( con.j); break; 120.285 + case T_FLOAT: _tag = JVM_CONSTANT_Float; _value.set_jfloat( con.f); break; 120.286 + case T_DOUBLE: _tag = JVM_CONSTANT_Double; _value.set_jdouble(con.d); break; 120.287 + default: ShouldNotReachHere(); 120.288 + } 120.289 + } 120.290 + 120.291 + int tag() const { return _tag; } 120.292 + symbolOop symbol_oop() const { return (symbolOop) _handle(); } 120.293 + klassOop klass_oop() const { return (klassOop) _handle(); } 120.294 + oop object_oop() const { return _handle(); } 120.295 + int index() const { return _value.get_jint(); } 120.296 + int first_index() const { return _value.get_jint() >> 16; } 120.297 + int second_index() const { return _value.get_jint() & 0x0000FFFF; } 120.298 + 120.299 + bool is_primitive() const { return is_java_primitive(_value.get_type()); } 120.300 + jint get_jint() const { return _value.get_jint(); } 120.301 + jlong get_jlong() const { return _value.get_jlong(); } 120.302 + jfloat get_jfloat() const { return _value.get_jfloat(); } 120.303 + jdouble get_jdouble() const { return _value.get_jdouble(); } 120.304 + }; 120.305 + 120.306 + // Fake constant pool. 120.307 + GrowableArray<ConstantValue*> _constants; 120.308 + 120.309 + // Accumulated compiler state: 120.310 + GrowableArray<unsigned char> _bytecode; 120.311 + 120.312 + int _cur_stack; 120.313 + int _max_stack; 120.314 + int _num_params; 120.315 + int _name_index; 120.316 + int _signature_index; 120.317 + 120.318 + void stack_push(BasicType bt) { 120.319 + _cur_stack += type2size[bt]; 120.320 + if (_cur_stack > _max_stack) _max_stack = _cur_stack; 120.321 + } 120.322 + void stack_pop(BasicType bt) { 120.323 + _cur_stack -= type2size[bt]; 120.324 + assert(_cur_stack >= 0, "sanity"); 120.325 + } 120.326 + 120.327 + unsigned char* bytecode() const { return _bytecode.adr_at(0); } 120.328 + int bytecode_length() const { return _bytecode.length(); } 120.329 + 120.330 + // Fake constant pool. 120.331 + int cpool_oop_put(int tag, Handle con) { 120.332 + if (con.is_null()) return 0; 120.333 + ConstantValue* cv = new ConstantValue(tag, con); 120.334 + return _constants.append(cv); 120.335 + } 120.336 + 120.337 + int cpool_oop_reference_put(int tag, int first_index, int second_index) { 120.338 + if (first_index == 0 && second_index == 0) return 0; 120.339 + assert(first_index != 0 && second_index != 0, "no zero indexes"); 120.340 + ConstantValue* cv = new ConstantValue(tag, first_index, second_index); 120.341 + return _constants.append(cv); 120.342 + } 120.343 + 120.344 + int cpool_primitive_put(BasicType type, jvalue* con); 120.345 + 120.346 + int cpool_int_put(jint value) { 120.347 + jvalue con; con.i = value; 120.348 + return cpool_primitive_put(T_INT, &con); 120.349 + } 120.350 + int cpool_long_put(jlong value) { 120.351 + jvalue con; con.j = value; 120.352 + return cpool_primitive_put(T_LONG, &con); 120.353 + } 120.354 + int cpool_float_put(jfloat value) { 120.355 + jvalue con; con.f = value; 120.356 + return cpool_primitive_put(T_FLOAT, &con); 120.357 + } 120.358 + int cpool_double_put(jdouble value) { 120.359 + jvalue con; con.d = value; 120.360 + return cpool_primitive_put(T_DOUBLE, &con); 120.361 + } 120.362 + 120.363 + int cpool_object_put(Handle obj) { 120.364 + return cpool_oop_put(JVM_CONSTANT_Object, obj); 120.365 + } 120.366 + int cpool_symbol_put(symbolOop sym) { 120.367 + return cpool_oop_put(JVM_CONSTANT_Utf8, sym); 120.368 + } 120.369 + int cpool_klass_put(klassOop klass) { 120.370 + return cpool_oop_put(JVM_CONSTANT_Class, klass); 120.371 + } 120.372 + int cpool_methodref_put(int class_index, int name_and_type_index) { 120.373 + return cpool_oop_reference_put(JVM_CONSTANT_Methodref, class_index, name_and_type_index); 120.374 + } 120.375 + int cpool_name_and_type_put(int name_index, int signature_index) { 120.376 + return cpool_oop_reference_put(JVM_CONSTANT_NameAndType, name_index, signature_index); 120.377 + } 120.378 + 120.379 + void emit_bc(Bytecodes::Code op, int index = 0); 120.380 + void emit_load(BasicType bt, int index); 120.381 + void emit_store(BasicType bt, int index); 120.382 + void emit_load_constant(ArgToken arg); 120.383 + 120.384 + virtual ArgToken make_parameter(BasicType type, klassOop tk, int argnum, TRAPS) { 120.385 + return ArgToken(tt_parameter, type, argnum); 120.386 + } 120.387 + virtual ArgToken make_oop_constant(oop con, TRAPS) { 120.388 + Handle h(THREAD, con); 120.389 + return ArgToken(tt_constant, T_OBJECT, h); 120.390 + } 120.391 + virtual ArgToken make_prim_constant(BasicType type, jvalue* con, TRAPS) { 120.392 + return ArgToken(tt_constant, type, *con); 120.393 + } 120.394 + 120.395 + virtual ArgToken make_conversion(BasicType type, klassOop tk, Bytecodes::Code op, const ArgToken& src, TRAPS); 120.396 + virtual ArgToken make_fetch(BasicType type, klassOop tk, Bytecodes::Code op, const ArgToken& base, const ArgToken& offset, TRAPS); 120.397 + virtual ArgToken make_invoke(methodOop m, vmIntrinsics::ID iid, Bytecodes::Code op, bool tailcall, int argc, ArgToken* argv, TRAPS); 120.398 + 120.399 + // Get a real constant pool. 120.400 + constantPoolHandle get_constant_pool(TRAPS) const; 120.401 + 120.402 + // Get a real methodOop. 120.403 + methodHandle get_method_oop(TRAPS) const; 120.404 + 120.405 +public: 120.406 + MethodHandleCompiler(Handle root, methodHandle call_method, bool for_invokedynamic, TRAPS); 120.407 + 120.408 + // Compile the given MH chain into bytecode. 120.409 + methodHandle compile(TRAPS); 120.410 +};
121.1 --- a/src/share/vm/prims/methodHandles.cpp Wed Dec 23 03:12:16 2009 -0800 121.2 +++ b/src/share/vm/prims/methodHandles.cpp Wed Jan 06 22:21:39 2010 -0800 121.3 @@ -132,8 +132,9 @@ 121.4 } 121.5 return m; 121.6 } else { 121.7 + assert(vmtarget->is_klass(), "must be class or interface"); 121.8 decode_flags_result |= MethodHandles::_dmf_does_dispatch; 121.9 - assert(vmtarget->is_klass(), "must be class or interface"); 121.10 + decode_flags_result |= MethodHandles::_dmf_has_receiver; 121.11 receiver_limit_result = (klassOop)vmtarget; 121.12 Klass* tk = Klass::cast((klassOop)vmtarget); 121.13 if (tk->is_interface()) { 121.14 @@ -142,7 +143,7 @@ 121.15 return klassItable::method_for_itable_index((klassOop)vmtarget, vmindex); 121.16 } else { 121.17 if (!tk->oop_is_instance()) 121.18 - tk = instanceKlass::cast(SystemDictionary::object_klass()); 121.19 + tk = instanceKlass::cast(SystemDictionary::Object_klass()); 121.20 return ((instanceKlass*)tk)->method_at_vtable(vmindex); 121.21 } 121.22 } 121.23 @@ -179,8 +180,10 @@ 121.24 // short-circuits directly to the methodOop. 121.25 // (It might be another argument besides a receiver also.) 121.26 assert(target->is_method(), "must be a simple method"); 121.27 + decode_flags_result |= MethodHandles::_dmf_binds_method; 121.28 methodOop m = (methodOop) target; 121.29 - decode_flags_result |= MethodHandles::_dmf_binds_method; 121.30 + if (!m->is_static()) 121.31 + decode_flags_result |= MethodHandles::_dmf_has_receiver; 121.32 return m; 121.33 } 121.34 } 121.35 @@ -233,8 +236,8 @@ 121.36 BasicType recv_bt = char2type(sig->byte_at(1)); 121.37 // Note: recv_bt might be T_ILLEGAL if byte_at(2) is ')' 121.38 assert(sig->byte_at(0) == '(', "must be method sig"); 121.39 - if (recv_bt == T_OBJECT || recv_bt == T_ARRAY) 121.40 - decode_flags_result |= _dmf_has_receiver; 121.41 +// if (recv_bt == T_OBJECT || recv_bt == T_ARRAY) 121.42 +// decode_flags_result |= _dmf_has_receiver; 121.43 } else { 121.44 // non-static method 121.45 decode_flags_result |= _dmf_has_receiver; 121.46 @@ -261,14 +264,14 @@ 121.47 return decode_MemberName(x, receiver_limit_result, decode_flags_result); 121.48 } else if (java_dyn_MethodHandle::is_subclass(xk)) { 121.49 return decode_MethodHandle(x, receiver_limit_result, decode_flags_result); 121.50 - } else if (xk == SystemDictionary::reflect_method_klass()) { 121.51 + } else if (xk == SystemDictionary::reflect_Method_klass()) { 121.52 oop clazz = java_lang_reflect_Method::clazz(x); 121.53 int slot = java_lang_reflect_Method::slot(x); 121.54 klassOop k = java_lang_Class::as_klassOop(clazz); 121.55 if (k != NULL && Klass::cast(k)->oop_is_instance()) 121.56 return decode_methodOop(instanceKlass::cast(k)->method_with_idnum(slot), 121.57 decode_flags_result); 121.58 - } else if (xk == SystemDictionary::reflect_constructor_klass()) { 121.59 + } else if (xk == SystemDictionary::reflect_Constructor_klass()) { 121.60 oop clazz = java_lang_reflect_Constructor::clazz(x); 121.61 int slot = java_lang_reflect_Constructor::slot(x); 121.62 klassOop k = java_lang_Class::as_klassOop(clazz); 121.63 @@ -325,7 +328,7 @@ 121.64 }; 121.65 121.66 void MethodHandles::init_MemberName(oop mname_oop, oop target_oop) { 121.67 - if (target_oop->klass() == SystemDictionary::reflect_field_klass()) { 121.68 + if (target_oop->klass() == SystemDictionary::reflect_Field_klass()) { 121.69 oop clazz = java_lang_reflect_Field::clazz(target_oop); // fd.field_holder() 121.70 int slot = java_lang_reflect_Field::slot(target_oop); // fd.index() 121.71 int mods = java_lang_reflect_Field::modifiers(target_oop); 121.72 @@ -410,7 +413,7 @@ 121.73 if (defc_klassOop == NULL) return; // a primitive; no resolution possible 121.74 if (!Klass::cast(defc_klassOop)->oop_is_instance()) { 121.75 if (!Klass::cast(defc_klassOop)->oop_is_array()) return; 121.76 - defc_klassOop = SystemDictionary::object_klass(); 121.77 + defc_klassOop = SystemDictionary::Object_klass(); 121.78 } 121.79 instanceKlassHandle defc(THREAD, defc_klassOop); 121.80 defc_klassOop = NULL; // safety 121.81 @@ -746,7 +749,7 @@ 121.82 return NULL; // unformed MH 121.83 } 121.84 klassOop tklass = target->klass(); 121.85 - if (Klass::cast(tklass)->is_subclass_of(SystemDictionary::object_klass())) { 121.86 + if (Klass::cast(tklass)->is_subclass_of(SystemDictionary::Object_klass())) { 121.87 return target; // target is another MH (or something else?) 121.88 } 121.89 } 121.90 @@ -818,26 +821,26 @@ 121.91 for (int i = 0; ; i++) { 121.92 const char* test_name = always_null_names[i]; 121.93 if (test_name == NULL) break; 121.94 - if (name->equals(test_name, (int) strlen(test_name))) 121.95 + if (name->equals(test_name)) 121.96 return true; 121.97 } 121.98 return false; 121.99 } 121.100 121.101 bool MethodHandles::class_cast_needed(klassOop src, klassOop dst) { 121.102 - if (src == dst || dst == SystemDictionary::object_klass()) 121.103 + if (src == dst || dst == SystemDictionary::Object_klass()) 121.104 return false; // quickest checks 121.105 Klass* srck = Klass::cast(src); 121.106 Klass* dstk = Klass::cast(dst); 121.107 if (dstk->is_interface()) { 121.108 // interface receivers can safely be viewed as untyped, 121.109 // because interface calls always include a dynamic check 121.110 - //dstk = Klass::cast(SystemDictionary::object_klass()); 121.111 + //dstk = Klass::cast(SystemDictionary::Object_klass()); 121.112 return false; 121.113 } 121.114 if (srck->is_interface()) { 121.115 // interface arguments must be viewed as untyped 121.116 - //srck = Klass::cast(SystemDictionary::object_klass()); 121.117 + //srck = Klass::cast(SystemDictionary::Object_klass()); 121.118 return true; 121.119 } 121.120 if (is_always_null_type(src)) { 121.121 @@ -850,7 +853,7 @@ 121.122 } 121.123 121.124 static oop object_java_mirror() { 121.125 - return Klass::cast(SystemDictionary::object_klass())->java_mirror(); 121.126 + return Klass::cast(SystemDictionary::Object_klass())->java_mirror(); 121.127 } 121.128 121.129 bool MethodHandles::same_basic_type_for_arguments(BasicType src, 121.130 @@ -1446,7 +1449,7 @@ 121.131 break; 121.132 } 121.133 // check subrange of Integer.value, if necessary 121.134 - if (argument == NULL || argument->klass() != SystemDictionary::int_klass()) { 121.135 + if (argument == NULL || argument->klass() != SystemDictionary::Integer_klass()) { 121.136 err = "bound integer argument must be of type java.lang.Integer"; 121.137 break; 121.138 } 121.139 @@ -1469,7 +1472,7 @@ 121.140 BasicType argbox = java_lang_boxing_object::basic_type(argument); 121.141 if (argbox != ptype) { 121.142 err = check_argument_type_change(T_OBJECT, (argument == NULL 121.143 - ? SystemDictionary::object_klass() 121.144 + ? SystemDictionary::Object_klass() 121.145 : argument->klass()), 121.146 ptype, ptype_klass(), argnum); 121.147 assert(err != NULL, "this must be an error"); 121.148 @@ -1487,8 +1490,9 @@ 121.149 int target_pushes = decode_MethodHandle_stack_pushes(target()); 121.150 assert(this_pushes == slots_pushed + target_pushes, "BMH stack motion must be correct"); 121.151 // do not blow the stack; use a Java-based adapter if this limit is exceeded 121.152 - if (slots_pushed + target_pushes > MethodHandlePushLimit) 121.153 - err = "too many bound parameters"; 121.154 + // FIXME 121.155 + // if (slots_pushed + target_pushes > MethodHandlePushLimit) 121.156 + // err = "too many bound parameters"; 121.157 } 121.158 } 121.159 121.160 @@ -1518,6 +1522,11 @@ 121.161 verify_vmslots(mh, CHECK); 121.162 } 121.163 121.164 + // Get bound type and required slots. 121.165 + oop ptype_oop = java_dyn_MethodType::ptype(java_dyn_MethodHandle::type(target()), argnum); 121.166 + BasicType ptype = java_lang_Class::as_BasicType(ptype_oop); 121.167 + int slots_pushed = type2size[ptype]; 121.168 + 121.169 // If (a) the target is a direct non-dispatched method handle, 121.170 // or (b) the target is a dispatched direct method handle and we 121.171 // are binding the receiver, cut out the middle-man. 121.172 @@ -1529,7 +1538,7 @@ 121.173 int decode_flags = 0; klassOop receiver_limit_oop = NULL; 121.174 methodHandle m(THREAD, decode_method(target(), receiver_limit_oop, decode_flags)); 121.175 if (m.is_null()) { THROW_MSG(vmSymbols::java_lang_InternalError(), "DMH failed to decode"); } 121.176 - DEBUG_ONLY(int m_vmslots = m->size_of_parameters() - 1); // pos. of 1st arg. 121.177 + DEBUG_ONLY(int m_vmslots = m->size_of_parameters() - slots_pushed); // pos. of 1st arg. 121.178 assert(sun_dyn_BoundMethodHandle::vmslots(mh()) == m_vmslots, "type w/ m sig"); 121.179 if (argnum == 0 && (decode_flags & _dmf_has_receiver) != 0) { 121.180 KlassHandle receiver_limit(THREAD, receiver_limit_oop); 121.181 @@ -1554,10 +1563,6 @@ 121.182 } 121.183 121.184 // Next question: Is this a ref, int, or long bound value? 121.185 - oop ptype_oop = java_dyn_MethodType::ptype(java_dyn_MethodHandle::type(target()), argnum); 121.186 - BasicType ptype = java_lang_Class::as_BasicType(ptype_oop); 121.187 - int slots_pushed = type2size[ptype]; 121.188 - 121.189 MethodHandleEntry* me = NULL; 121.190 if (ptype == T_OBJECT) { 121.191 if (direct_to_method) me = MethodHandles::entry(_bound_ref_direct_mh); 121.192 @@ -2170,7 +2175,7 @@ 121.193 symbolOop name = vmSymbols::toString_name(), sig = vmSymbols::void_string_signature(); 121.194 JavaCallArguments args(Handle(THREAD, JNIHandles::resolve_non_null(erased_jh))); 121.195 JavaValue result(T_OBJECT); 121.196 - JavaCalls::call_virtual(&result, SystemDictionary::object_klass(), name, sig, 121.197 + JavaCalls::call_virtual(&result, SystemDictionary::Object_klass(), name, sig, 121.198 &args, CHECK); 121.199 Handle str(THREAD, (oop)result.get_jobject()); 121.200 java_lang_String::print(str, tty);
122.1 --- a/src/share/vm/prims/nativeLookup.cpp Wed Dec 23 03:12:16 2009 -0800 122.2 +++ b/src/share/vm/prims/nativeLookup.cpp Wed Jan 06 22:21:39 2010 -0800 122.3 @@ -137,7 +137,7 @@ 122.4 } 122.5 122.6 // Otherwise call static method findNative in ClassLoader 122.7 - KlassHandle klass (THREAD, SystemDictionary::classloader_klass()); 122.8 + KlassHandle klass (THREAD, SystemDictionary::ClassLoader_klass()); 122.9 Handle name_arg = java_lang_String::create_from_str(jni_name, CHECK_NULL); 122.10 122.11 JavaValue result(T_LONG);
123.1 --- a/src/share/vm/runtime/arguments.cpp Wed Dec 23 03:12:16 2009 -0800 123.2 +++ b/src/share/vm/runtime/arguments.cpp Wed Jan 06 22:21:39 2010 -0800 123.3 @@ -2699,6 +2699,15 @@ 123.4 } 123.5 ScavengeRootsInCode = 1; 123.6 } 123.7 +#ifdef COMPILER2 123.8 + if (EnableInvokeDynamic && DoEscapeAnalysis) { 123.9 + // TODO: We need to find rules for invokedynamic and EA. For now, 123.10 + // simply disable EA by default. 123.11 + if (FLAG_IS_DEFAULT(DoEscapeAnalysis)) { 123.12 + DoEscapeAnalysis = false; 123.13 + } 123.14 + } 123.15 +#endif 123.16 123.17 if (PrintGCDetails) { 123.18 // Turn on -verbose:gc options as well 123.19 @@ -2722,6 +2731,15 @@ 123.20 // Set flags based on ergonomics. 123.21 set_ergonomics_flags(); 123.22 123.23 +#ifdef _LP64 123.24 + // XXX JSR 292 currently does not support compressed oops. 123.25 + if (EnableMethodHandles && UseCompressedOops) { 123.26 + if (FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops)) { 123.27 + UseCompressedOops = false; 123.28 + } 123.29 + } 123.30 +#endif // _LP64 123.31 + 123.32 // Check the GC selections again. 123.33 if (!check_gc_consistency()) { 123.34 return JNI_EINVAL; 123.35 @@ -2756,9 +2774,16 @@ 123.36 set_aggressive_opts_flags(); 123.37 123.38 #ifdef CC_INTERP 123.39 - // Biased locking is not implemented with c++ interpreter 123.40 + // Clear flags not supported by the C++ interpreter 123.41 + FLAG_SET_DEFAULT(ProfileInterpreter, false); 123.42 FLAG_SET_DEFAULT(UseBiasedLocking, false); 123.43 -#endif /* CC_INTERP */ 123.44 + LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); 123.45 +#endif // CC_INTERP 123.46 + 123.47 +#ifdef ZERO 123.48 + // Clear flags not supported by Zero 123.49 + FLAG_SET_DEFAULT(TaggedStackInterpreter, false); 123.50 +#endif // ZERO 123.51 123.52 #ifdef COMPILER2 123.53 if (!UseBiasedLocking || EmitSync != 0) {
124.1 --- a/src/share/vm/runtime/frame.cpp Wed Dec 23 03:12:16 2009 -0800 124.2 +++ b/src/share/vm/runtime/frame.cpp Wed Jan 06 22:21:39 2010 -0800 124.3 @@ -1,5 +1,5 @@ 124.4 /* 124.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 124.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 124.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 124.8 * 124.9 * This code is free software; you can redistribute it and/or modify it 124.10 @@ -769,9 +769,9 @@ 124.11 124.12 class InterpretedArgumentOopFinder: public SignatureInfo { 124.13 private: 124.14 - OopClosure* _f; // Closure to invoke 124.15 - int _offset; // TOS-relative offset, decremented with each argument 124.16 - bool _is_static; // true if the callee is a static method 124.17 + OopClosure* _f; // Closure to invoke 124.18 + int _offset; // TOS-relative offset, decremented with each argument 124.19 + bool _has_receiver; // true if the callee has a receiver 124.20 frame* _fr; 124.21 124.22 void set(int size, BasicType type) { 124.23 @@ -786,9 +786,9 @@ 124.24 } 124.25 124.26 public: 124.27 - InterpretedArgumentOopFinder(symbolHandle signature, bool is_static, frame* fr, OopClosure* f) : SignatureInfo(signature) { 124.28 + InterpretedArgumentOopFinder(symbolHandle signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) { 124.29 // compute size of arguments 124.30 - int args_size = ArgumentSizeComputer(signature).size() + (is_static ? 0 : 1); 124.31 + int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0); 124.32 assert(!fr->is_interpreted_frame() || 124.33 args_size <= fr->interpreter_frame_expression_stack_size(), 124.34 "args cannot be on stack anymore"); 124.35 @@ -796,11 +796,10 @@ 124.36 _f = f; 124.37 _fr = fr; 124.38 _offset = args_size; 124.39 - _is_static = is_static; 124.40 } 124.41 124.42 void oops_do() { 124.43 - if (!_is_static) { 124.44 + if (_has_receiver) { 124.45 --_offset; 124.46 oop_offset_do(); 124.47 } 124.48 @@ -912,7 +911,7 @@ 124.49 int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals(); 124.50 124.51 symbolHandle signature; 124.52 - bool is_static = false; 124.53 + bool has_receiver = false; 124.54 124.55 // Process a callee's arguments if we are at a call site 124.56 // (i.e., if we are at an invoke bytecode) 124.57 @@ -922,7 +921,7 @@ 124.58 Bytecode_invoke *call = Bytecode_invoke_at_check(m, bci); 124.59 if (call != NULL) { 124.60 signature = symbolHandle(thread, call->signature()); 124.61 - is_static = call->is_invokestatic(); 124.62 + has_receiver = call->has_receiver(); 124.63 if (map->include_argument_oops() && 124.64 interpreter_frame_expression_stack_size() > 0) { 124.65 ResourceMark rm(thread); // is this right ??? 124.66 @@ -936,7 +935,7 @@ 124.67 // code in the interpreter calls a blocking runtime 124.68 // routine which can cause this code to be executed). 124.69 // (was bug gri 7/27/98) 124.70 - oops_interpreted_arguments_do(signature, is_static, f); 124.71 + oops_interpreted_arguments_do(signature, has_receiver, f); 124.72 } 124.73 } 124.74 } 124.75 @@ -950,7 +949,7 @@ 124.76 mask = &oopmap_mask; 124.77 #endif // ASSERT 124.78 oops_interpreted_locals_do(f, max_locals, mask); 124.79 - oops_interpreted_expressions_do(f, signature, is_static, 124.80 + oops_interpreted_expressions_do(f, signature, has_receiver, 124.81 m->max_stack(), 124.82 max_locals, mask); 124.83 } else { 124.84 @@ -992,7 +991,7 @@ 124.85 124.86 void frame::oops_interpreted_expressions_do(OopClosure *f, 124.87 symbolHandle signature, 124.88 - bool is_static, 124.89 + bool has_receiver, 124.90 int max_stack, 124.91 int max_locals, 124.92 InterpreterOopMap *mask) { 124.93 @@ -1005,7 +1004,7 @@ 124.94 // arguments in callee's locals. 124.95 int args_size = 0; 124.96 if (!signature.is_null()) { 124.97 - args_size = ArgumentSizeComputer(signature).size() + (is_static ? 0 : 1); 124.98 + args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0); 124.99 } 124.100 124.101 intptr_t *tos_addr = interpreter_frame_tos_at(args_size); 124.102 @@ -1038,8 +1037,8 @@ 124.103 } 124.104 } 124.105 124.106 -void frame::oops_interpreted_arguments_do(symbolHandle signature, bool is_static, OopClosure* f) { 124.107 - InterpretedArgumentOopFinder finder(signature, is_static, this, f); 124.108 +void frame::oops_interpreted_arguments_do(symbolHandle signature, bool has_receiver, OopClosure* f) { 124.109 + InterpretedArgumentOopFinder finder(signature, has_receiver, this, f); 124.110 finder.oops_do(); 124.111 } 124.112 124.113 @@ -1066,8 +1065,8 @@ 124.114 class CompiledArgumentOopFinder: public SignatureInfo { 124.115 protected: 124.116 OopClosure* _f; 124.117 - int _offset; // the current offset, incremented with each argument 124.118 - bool _is_static; // true if the callee is a static method 124.119 + int _offset; // the current offset, incremented with each argument 124.120 + bool _has_receiver; // true if the callee has a receiver 124.121 frame _fr; 124.122 RegisterMap* _reg_map; 124.123 int _arg_size; 124.124 @@ -1087,24 +1086,24 @@ 124.125 } 124.126 124.127 public: 124.128 - CompiledArgumentOopFinder(symbolHandle signature, bool is_static, OopClosure* f, frame fr, const RegisterMap* reg_map) 124.129 + CompiledArgumentOopFinder(symbolHandle signature, bool has_receiver, OopClosure* f, frame fr, const RegisterMap* reg_map) 124.130 : SignatureInfo(signature) { 124.131 124.132 // initialize CompiledArgumentOopFinder 124.133 _f = f; 124.134 _offset = 0; 124.135 - _is_static = is_static; 124.136 + _has_receiver = has_receiver; 124.137 _fr = fr; 124.138 _reg_map = (RegisterMap*)reg_map; 124.139 - _arg_size = ArgumentSizeComputer(signature).size() + (is_static ? 0 : 1); 124.140 + _arg_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0); 124.141 124.142 int arg_size; 124.143 - _regs = SharedRuntime::find_callee_arguments(signature(), is_static, &arg_size); 124.144 + _regs = SharedRuntime::find_callee_arguments(signature(), has_receiver, &arg_size); 124.145 assert(arg_size == _arg_size, "wrong arg size"); 124.146 } 124.147 124.148 void oops_do() { 124.149 - if (!_is_static) { 124.150 + if (_has_receiver) { 124.151 handle_oop_offset(); 124.152 _offset++; 124.153 } 124.154 @@ -1112,9 +1111,9 @@ 124.155 } 124.156 }; 124.157 124.158 -void frame::oops_compiled_arguments_do(symbolHandle signature, bool is_static, const RegisterMap* reg_map, OopClosure* f) { 124.159 +void frame::oops_compiled_arguments_do(symbolHandle signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f) { 124.160 ResourceMark rm; 124.161 - CompiledArgumentOopFinder finder(signature, is_static, f, *this, reg_map); 124.162 + CompiledArgumentOopFinder finder(signature, has_receiver, f, *this, reg_map); 124.163 finder.oops_do(); 124.164 } 124.165
125.1 --- a/src/share/vm/runtime/frame.hpp Wed Dec 23 03:12:16 2009 -0800 125.2 +++ b/src/share/vm/runtime/frame.hpp Wed Jan 06 22:21:39 2010 -0800 125.3 @@ -371,7 +371,7 @@ 125.4 oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const; 125.5 125.6 // Oops-do's 125.7 - void oops_compiled_arguments_do(symbolHandle signature, bool is_static, const RegisterMap* reg_map, OopClosure* f); 125.8 + void oops_compiled_arguments_do(symbolHandle signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f); 125.9 void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true); 125.10 125.11 private: 125.12 @@ -379,9 +379,9 @@ 125.13 int max_locals, 125.14 InterpreterOopMap *mask); 125.15 void oops_interpreted_expressions_do(OopClosure *f, symbolHandle signature, 125.16 - bool is_static, int max_stack, int max_locals, 125.17 + bool has_receiver, int max_stack, int max_locals, 125.18 InterpreterOopMap *mask); 125.19 - void oops_interpreted_arguments_do(symbolHandle signature, bool is_static, OopClosure* f); 125.20 + void oops_interpreted_arguments_do(symbolHandle signature, bool has_receiver, OopClosure* f); 125.21 125.22 // Iteration of oops 125.23 void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache);
126.1 --- a/src/share/vm/runtime/jniHandles.cpp Wed Dec 23 03:12:16 2009 -0800 126.2 +++ b/src/share/vm/runtime/jniHandles.cpp Wed Jan 06 22:21:39 2010 -0800 126.3 @@ -144,7 +144,7 @@ 126.4 EXCEPTION_MARK; 126.5 // We will never reach the CATCH below since Exceptions::_throw will cause 126.6 // the VM to exit if an exception is thrown during initialization 126.7 - klassOop k = SystemDictionary::object_klass(); 126.8 + klassOop k = SystemDictionary::Object_klass(); 126.9 _deleted_handle = instanceKlass::cast(k)->allocate_permanent_instance(CATCH); 126.10 } 126.11
127.1 --- a/src/share/vm/runtime/os.cpp Wed Dec 23 03:12:16 2009 -0800 127.2 +++ b/src/share/vm/runtime/os.cpp Wed Jan 06 22:21:39 2010 -0800 127.3 @@ -280,7 +280,7 @@ 127.4 string, 127.5 CHECK); 127.6 127.7 - KlassHandle group(THREAD, SystemDictionary::threadGroup_klass()); 127.8 + KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass()); 127.9 JavaCalls::call_special(&result, 127.10 thread_group, 127.11 group,
128.1 --- a/src/share/vm/runtime/reflection.cpp Wed Dec 23 03:12:16 2009 -0800 128.2 +++ b/src/share/vm/runtime/reflection.cpp Wed Jan 06 22:21:39 2010 -0800 128.3 @@ -449,7 +449,7 @@ 128.4 // sun/reflect/MagicAccessorImpl subclasses to succeed trivially. 128.5 if ( JDK_Version::is_gte_jdk14x_version() 128.6 && UseNewReflection 128.7 - && Klass::cast(current_class)->is_subclass_of(SystemDictionary::reflect_magic_klass())) { 128.8 + && Klass::cast(current_class)->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) { 128.9 return true; 128.10 } 128.11 128.12 @@ -541,7 +541,7 @@ 128.13 // sun/reflect/MagicAccessorImpl subclasses to succeed trivially. 128.14 if ( JDK_Version::is_gte_jdk14x_version() 128.15 && UseNewReflection 128.16 - && Klass::cast(current_class)->is_subclass_of(SystemDictionary::reflect_magic_klass())) { 128.17 + && Klass::cast(current_class)->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) { 128.18 return true; 128.19 } 128.20 128.21 @@ -631,7 +631,7 @@ 128.22 128.23 objArrayHandle Reflection::get_parameter_types(methodHandle method, int parameter_count, oop* return_type, TRAPS) { 128.24 // Allocate array holding parameter types (java.lang.Class instances) 128.25 - objArrayOop m = oopFactory::new_objArray(SystemDictionary::class_klass(), parameter_count, CHECK_(objArrayHandle())); 128.26 + objArrayOop m = oopFactory::new_objArray(SystemDictionary::Class_klass(), parameter_count, CHECK_(objArrayHandle())); 128.27 objArrayHandle mirrors (THREAD, m); 128.28 int index = 0; 128.29 // Collect parameter types 128.30 @@ -1308,7 +1308,7 @@ 128.31 if (Klass::cast(klass)->oop_is_array() && which == MEMBER_DECLARED) return NULL; 128.32 128.33 if (Klass::cast(java_lang_Class::as_klassOop(mirror))->oop_is_array()) { 128.34 - klass = SystemDictionary::object_klass(); 128.35 + klass = SystemDictionary::Object_klass(); 128.36 } 128.37 instanceKlassHandle h_k(THREAD, klass); 128.38 128.39 @@ -1375,13 +1375,13 @@ 128.40 // Exclude primitive types 128.41 if (java_lang_Class::is_primitive(mirror) || 128.42 (Klass::cast(java_lang_Class::as_klassOop(mirror))->oop_is_array() && (which == MEMBER_DECLARED))) { 128.43 - klassOop klass = SystemDictionary::reflect_method_klass(); 128.44 + klassOop klass = SystemDictionary::reflect_Method_klass(); 128.45 return oopFactory::new_objArray(klass, 0, CHECK_NULL); // Return empty array 128.46 } 128.47 128.48 klassOop klass = java_lang_Class::as_klassOop(mirror); 128.49 if (Klass::cast(java_lang_Class::as_klassOop(mirror))->oop_is_array()) { 128.50 - klass = SystemDictionary::object_klass(); 128.51 + klass = SystemDictionary::Object_klass(); 128.52 } 128.53 instanceKlassHandle h_k(THREAD, klass); 128.54 128.55 @@ -1411,7 +1411,7 @@ 128.56 } 128.57 128.58 // Allocate result 128.59 - klassOop klass = SystemDictionary::reflect_method_klass(); 128.60 + klassOop klass = SystemDictionary::reflect_Method_klass(); 128.61 objArrayOop r = oopFactory::new_objArray(klass, count, CHECK_NULL); 128.62 objArrayHandle h_result (THREAD, r); 128.63 128.64 @@ -1462,7 +1462,7 @@ 128.65 } 128.66 } 128.67 // Allocate result 128.68 - klassOop klass = SystemDictionary::reflect_method_klass(); 128.69 + klassOop klass = SystemDictionary::reflect_Method_klass(); 128.70 objArrayOop r = oopFactory::new_objArray(klass, count, CHECK_NULL); 128.71 objArrayHandle h_result (THREAD, r); 128.72 128.73 @@ -1523,7 +1523,7 @@ 128.74 bool prim = java_lang_Class::is_primitive(mirror); 128.75 Klass* k = prim ? NULL : Klass::cast(java_lang_Class::as_klassOop(mirror)); 128.76 if (prim || k->is_interface() || k->oop_is_array()) { 128.77 - return oopFactory::new_objArray(SystemDictionary::reflect_constructor_klass(), 0, CHECK_NULL); // Return empty array 128.78 + return oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), 0, CHECK_NULL); // Return empty array 128.79 } 128.80 128.81 // Must be instanceKlass at this point
129.1 --- a/src/share/vm/runtime/reflectionUtils.cpp Wed Dec 23 03:12:16 2009 -0800 129.2 +++ b/src/share/vm/runtime/reflectionUtils.cpp Wed Jan 06 22:21:39 2010 -0800 129.3 @@ -63,15 +63,15 @@ 129.4 void FilteredFieldsMap::initialize() { 129.5 int offset; 129.6 offset = java_lang_Throwable::get_backtrace_offset(); 129.7 - _filtered_fields->append(new FilteredField(SystemDictionary::throwable_klass(), offset)); 129.8 + _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset)); 129.9 // The latest version of vm may be used with old jdk. 129.10 if (JDK_Version::is_gte_jdk16x_version()) { 129.11 // The following class fields do not exist in 129.12 // previous version of jdk. 129.13 offset = sun_reflect_ConstantPool::cp_oop_offset(); 129.14 - _filtered_fields->append(new FilteredField(SystemDictionary::reflect_constant_pool_klass(), offset)); 129.15 + _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset)); 129.16 offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset(); 129.17 - _filtered_fields->append(new FilteredField(SystemDictionary::reflect_unsafe_static_field_accessor_impl_klass(), offset)); 129.18 + _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset)); 129.19 } 129.20 } 129.21
130.1 --- a/src/share/vm/runtime/sharedRuntime.cpp Wed Dec 23 03:12:16 2009 -0800 130.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp Wed Jan 06 22:21:39 2010 -0800 130.3 @@ -802,7 +802,7 @@ 130.4 130.5 #ifdef ASSERT 130.6 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls 130.7 - if (bc != Bytecodes::_invokestatic) { 130.8 + if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) { 130.9 assert(receiver.not_null(), "should have thrown exception"); 130.10 KlassHandle receiver_klass (THREAD, receiver->klass()); 130.11 klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); 130.12 @@ -860,7 +860,7 @@ 130.13 if (JvmtiExport::can_hotswap_or_post_breakpoint()) { 130.14 int retry_count = 0; 130.15 while (!HAS_PENDING_EXCEPTION && callee_method->is_old() && 130.16 - callee_method->method_holder() != SystemDictionary::object_klass()) { 130.17 + callee_method->method_holder() != SystemDictionary::Object_klass()) { 130.18 // If has a pending exception then there is no need to re-try to 130.19 // resolve this method. 130.20 // If the method has been redefined, we need to try again. 130.21 @@ -1027,7 +1027,16 @@ 130.22 frame stub_frame = thread->last_frame(); 130.23 assert(stub_frame.is_runtime_frame(), "sanity check"); 130.24 frame caller_frame = stub_frame.sender(®_map); 130.25 - if (caller_frame.is_interpreted_frame() || caller_frame.is_entry_frame() ) { 130.26 + 130.27 + // MethodHandle invokes don't have a CompiledIC and should always 130.28 + // simply redispatch to the callee_target. 130.29 + address sender_pc = caller_frame.pc(); 130.30 + CodeBlob* sender_cb = caller_frame.cb(); 130.31 + nmethod* sender_nm = sender_cb->as_nmethod_or_null(); 130.32 + 130.33 + if (caller_frame.is_interpreted_frame() || 130.34 + caller_frame.is_entry_frame() || 130.35 + (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc))) { 130.36 methodOop callee = thread->callee_target(); 130.37 guarantee(callee != NULL && callee->is_method(), "bad handshake"); 130.38 thread->set_vm_result(callee); 130.39 @@ -1529,7 +1538,7 @@ 130.40 oop SharedRuntime::wrong_method_type_is_for_single_argument(JavaThread* thr, 130.41 oopDesc* required) { 130.42 if (required == NULL) return NULL; 130.43 - if (required->klass() == SystemDictionary::class_klass()) 130.44 + if (required->klass() == SystemDictionary::Class_klass()) 130.45 return required; 130.46 if (required->is_klass()) 130.47 return Klass::cast(klassOop(required))->java_mirror(); 130.48 @@ -2136,7 +2145,7 @@ 130.49 return regs.first(); 130.50 } 130.51 130.52 -VMRegPair *SharedRuntime::find_callee_arguments(symbolOop sig, bool is_static, int* arg_size) { 130.53 +VMRegPair *SharedRuntime::find_callee_arguments(symbolOop sig, bool has_receiver, int* arg_size) { 130.54 // This method is returning a data structure allocating as a 130.55 // ResourceObject, so do not put any ResourceMarks in here. 130.56 char *s = sig->as_C_string(); 130.57 @@ -2148,7 +2157,7 @@ 130.58 BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, 256 ); 130.59 VMRegPair *regs = NEW_RESOURCE_ARRAY( VMRegPair, 256 ); 130.60 int cnt = 0; 130.61 - if (!is_static) { 130.62 + if (has_receiver) { 130.63 sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature 130.64 } 130.65
131.1 --- a/src/share/vm/runtime/sharedRuntime.hpp Wed Dec 23 03:12:16 2009 -0800 131.2 +++ b/src/share/vm/runtime/sharedRuntime.hpp Wed Jan 06 22:21:39 2010 -0800 131.3 @@ -357,7 +357,7 @@ 131.4 131.5 // Convert a sig into a calling convention register layout 131.6 // and find interesting things about it. 131.7 - static VMRegPair* find_callee_arguments(symbolOop sig, bool is_static, int *arg_size); 131.8 + static VMRegPair* find_callee_arguments(symbolOop sig, bool has_receiver, int *arg_size); 131.9 static VMReg name_for_receiver(); 131.10 131.11 // "Top of Stack" slots that may be unused by the calling convention but must
132.1 --- a/src/share/vm/runtime/statSampler.cpp Wed Dec 23 03:12:16 2009 -0800 132.2 +++ b/src/share/vm/runtime/statSampler.cpp Wed Jan 06 22:21:39 2010 -0800 132.3 @@ -177,7 +177,7 @@ 132.4 132.5 // public static String getProperty(String key, String def); 132.6 JavaCalls::call_static(&result, 132.7 - KlassHandle(THREAD, SystemDictionary::system_klass()), 132.8 + KlassHandle(THREAD, SystemDictionary::System_klass()), 132.9 vmSymbolHandles::getProperty_name(), 132.10 vmSymbolHandles::string_string_signature(), 132.11 key_str,
133.1 --- a/src/share/vm/runtime/thread.cpp Wed Dec 23 03:12:16 2009 -0800 133.2 +++ b/src/share/vm/runtime/thread.cpp Wed Jan 06 22:21:39 2010 -0800 133.3 @@ -973,7 +973,7 @@ 133.4 return; 133.5 } 133.6 133.7 - KlassHandle group(this, SystemDictionary::threadGroup_klass()); 133.8 + KlassHandle group(this, SystemDictionary::ThreadGroup_klass()); 133.9 Handle threadObj(this, this->threadObj()); 133.10 133.11 JavaCalls::call_special(&result, 133.12 @@ -1468,7 +1468,7 @@ 133.13 // so call ThreadGroup.uncaughtException() 133.14 KlassHandle recvrKlass(THREAD, threadObj->klass()); 133.15 CallInfo callinfo; 133.16 - KlassHandle thread_klass(THREAD, SystemDictionary::thread_klass()); 133.17 + KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); 133.18 LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass, 133.19 vmSymbolHandles::dispatchUncaughtException_name(), 133.20 vmSymbolHandles::throwable_void_signature(), 133.21 @@ -1484,7 +1484,7 @@ 133.22 uncaught_exception, 133.23 THREAD); 133.24 } else { 133.25 - KlassHandle thread_group(THREAD, SystemDictionary::threadGroup_klass()); 133.26 + KlassHandle thread_group(THREAD, SystemDictionary::ThreadGroup_klass()); 133.27 JavaValue result(T_VOID); 133.28 JavaCalls::call_virtual(&result, 133.29 group, thread_group, 133.30 @@ -1505,7 +1505,7 @@ 133.31 while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) { 133.32 EXCEPTION_MARK; 133.33 JavaValue result(T_VOID); 133.34 - KlassHandle thread_klass(THREAD, SystemDictionary::thread_klass()); 133.35 + KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); 133.36 JavaCalls::call_virtual(&result, 133.37 threadObj, thread_klass, 133.38 vmSymbolHandles::exit_method_name(), 133.39 @@ -1743,7 +1743,7 @@ 133.40 // Check for pending async. exception 133.41 if (_pending_async_exception != NULL) { 133.42 // Only overwrite an already pending exception, if it is not a threadDeath. 133.43 - if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::threaddeath_klass())) { 133.44 + if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::ThreadDeath_klass())) { 133.45 133.46 // We cannot call Exceptions::_throw(...) here because we cannot block 133.47 set_pending_exception(_pending_async_exception, __FILE__, __LINE__); 133.48 @@ -1852,14 +1852,14 @@ 133.49 if (is_Compiler_thread()) return; 133.50 133.51 // This is a change from JDK 1.1, but JDK 1.2 will also do it: 133.52 - if (java_throwable->is_a(SystemDictionary::threaddeath_klass())) { 133.53 + if (java_throwable->is_a(SystemDictionary::ThreadDeath_klass())) { 133.54 java_lang_Thread::set_stillborn(threadObj()); 133.55 } 133.56 133.57 { 133.58 // Actually throw the Throwable against the target Thread - however 133.59 // only if there is no thread death exception installed already. 133.60 - if (_pending_async_exception == NULL || !_pending_async_exception->is_a(SystemDictionary::threaddeath_klass())) { 133.61 + if (_pending_async_exception == NULL || !_pending_async_exception->is_a(SystemDictionary::ThreadDeath_klass())) { 133.62 // If the topmost frame is a runtime stub, then we are calling into 133.63 // OptoRuntime from compiled code. Some runtime stubs (new, monitor_exit..) 133.64 // must deoptimize the caller before continuing, as the compiled exception handler table 133.65 @@ -3095,6 +3095,12 @@ 133.66 warning("java.lang.ArithmeticException has not been initialized"); 133.67 warning("java.lang.StackOverflowError has not been initialized"); 133.68 } 133.69 + 133.70 + if (EnableInvokeDynamic) { 133.71 + // JSR 292: An intialized java.dyn.InvokeDynamic is required in 133.72 + // the compiler. 133.73 + initialize_class(vmSymbolHandles::java_dyn_InvokeDynamic(), CHECK_0); 133.74 + } 133.75 } 133.76 133.77 // See : bugid 4211085.
134.1 --- a/src/share/vm/runtime/thread.hpp Wed Dec 23 03:12:16 2009 -0800 134.2 +++ b/src/share/vm/runtime/thread.hpp Wed Jan 06 22:21:39 2010 -0800 134.3 @@ -772,6 +772,7 @@ 134.4 volatile address _exception_pc; // PC where exception happened 134.5 volatile address _exception_handler_pc; // PC for handler of exception 134.6 volatile int _exception_stack_size; // Size of frame where exception happened 134.7 + volatile int _is_method_handle_exception; // True if the current exception PC is at a MethodHandle call. 134.8 134.9 // support for compilation 134.10 bool _is_compiling; // is true if a compilation is active inthis thread (one compilation per thread possible) 134.11 @@ -1107,11 +1108,13 @@ 134.12 int exception_stack_size() const { return _exception_stack_size; } 134.13 address exception_pc() const { return _exception_pc; } 134.14 address exception_handler_pc() const { return _exception_handler_pc; } 134.15 + int is_method_handle_exception() const { return _is_method_handle_exception; } 134.16 134.17 void set_exception_oop(oop o) { _exception_oop = o; } 134.18 void set_exception_pc(address a) { _exception_pc = a; } 134.19 void set_exception_handler_pc(address a) { _exception_handler_pc = a; } 134.20 void set_exception_stack_size(int size) { _exception_stack_size = size; } 134.21 + void set_is_method_handle_exception(int value) { _is_method_handle_exception = value; } 134.22 134.23 // Stack overflow support 134.24 inline size_t stack_available(address cur_sp); 134.25 @@ -1185,6 +1188,7 @@ 134.26 static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc ); } 134.27 static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); } 134.28 static ByteSize exception_stack_size_offset() { return byte_offset_of(JavaThread, _exception_stack_size); } 134.29 + static ByteSize is_method_handle_exception_offset() { return byte_offset_of(JavaThread, _is_method_handle_exception); } 134.30 static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state ); } 134.31 static ByteSize suspend_flags_offset() { return byte_offset_of(JavaThread, _suspend_flags ); } 134.32
135.1 --- a/src/share/vm/runtime/vframe.cpp Wed Dec 23 03:12:16 2009 -0800 135.2 +++ b/src/share/vm/runtime/vframe.cpp Wed Jan 06 22:21:39 2010 -0800 135.3 @@ -124,7 +124,7 @@ 135.4 static void print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) { 135.5 if (obj.not_null()) { 135.6 st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, (address)obj()); 135.7 - if (obj->klass() == SystemDictionary::class_klass()) { 135.8 + if (obj->klass() == SystemDictionary::Class_klass()) { 135.9 klassOop target_klass = java_lang_Class::as_klassOop(obj()); 135.10 st->print_cr("(a java.lang.Class for %s)", instanceKlass::cast(target_klass)->external_name()); 135.11 } else { 135.12 @@ -430,7 +430,7 @@ 135.13 // This is Method.invoke() -- skip it 135.14 } else if (use_new_reflection && 135.15 Klass::cast(method()->method_holder()) 135.16 - ->is_subclass_of(SystemDictionary::reflect_method_accessor_klass())) { 135.17 + ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) { 135.18 // This is an auxilary frame -- skip it 135.19 } else { 135.20 // This is non-excluded frame, we need to count it against the depth 135.21 @@ -490,8 +490,8 @@ 135.22 void vframeStreamCommon::skip_reflection_related_frames() { 135.23 while (!at_end() && 135.24 (JDK_Version::is_gte_jdk14x_version() && UseNewReflection && 135.25 - (Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_method_accessor_klass()) || 135.26 - Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_constructor_accessor_klass())))) { 135.27 + (Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) || 135.28 + Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) { 135.29 next(); 135.30 } 135.31 }
136.1 --- a/src/share/vm/runtime/vmStructs.cpp Wed Dec 23 03:12:16 2009 -0800 136.2 +++ b/src/share/vm/runtime/vmStructs.cpp Wed Jan 06 22:21:39 2010 -0800 136.3 @@ -455,40 +455,38 @@ 136.4 static_field(SystemDictionary, _shared_dictionary, Dictionary*) \ 136.5 static_field(SystemDictionary, _system_loader_lock_obj, oop) \ 136.6 static_field(SystemDictionary, _loader_constraints, LoaderConstraintTable*) \ 136.7 - static_field(SystemDictionary, WK_KLASS(object_klass), klassOop) \ 136.8 - static_field(SystemDictionary, WK_KLASS(string_klass), klassOop) \ 136.9 - static_field(SystemDictionary, WK_KLASS(class_klass), klassOop) \ 136.10 - static_field(SystemDictionary, WK_KLASS(cloneable_klass), klassOop) \ 136.11 - static_field(SystemDictionary, WK_KLASS(classloader_klass), klassOop) \ 136.12 - static_field(SystemDictionary, WK_KLASS(serializable_klass), klassOop) \ 136.13 - static_field(SystemDictionary, WK_KLASS(system_klass), klassOop) \ 136.14 - static_field(SystemDictionary, WK_KLASS(throwable_klass), klassOop) \ 136.15 - static_field(SystemDictionary, WK_KLASS(threaddeath_klass), klassOop) \ 136.16 - static_field(SystemDictionary, WK_KLASS(error_klass), klassOop) \ 136.17 - static_field(SystemDictionary, WK_KLASS(exception_klass), klassOop) \ 136.18 - static_field(SystemDictionary, WK_KLASS(runtime_exception_klass), klassOop) \ 136.19 - static_field(SystemDictionary, WK_KLASS(classNotFoundException_klass), klassOop) \ 136.20 - static_field(SystemDictionary, WK_KLASS(noClassDefFoundError_klass), klassOop) \ 136.21 - static_field(SystemDictionary, WK_KLASS(linkageError_klass), klassOop) \ 136.22 + static_field(SystemDictionary, WK_KLASS(Object_klass), klassOop) \ 136.23 + static_field(SystemDictionary, WK_KLASS(String_klass), klassOop) \ 136.24 + static_field(SystemDictionary, WK_KLASS(Class_klass), klassOop) \ 136.25 + static_field(SystemDictionary, WK_KLASS(Cloneable_klass), klassOop) \ 136.26 + static_field(SystemDictionary, WK_KLASS(ClassLoader_klass), klassOop) \ 136.27 + static_field(SystemDictionary, WK_KLASS(Serializable_klass), klassOop) \ 136.28 + static_field(SystemDictionary, WK_KLASS(System_klass), klassOop) \ 136.29 + static_field(SystemDictionary, WK_KLASS(Throwable_klass), klassOop) \ 136.30 + static_field(SystemDictionary, WK_KLASS(ThreadDeath_klass), klassOop) \ 136.31 + static_field(SystemDictionary, WK_KLASS(Error_klass), klassOop) \ 136.32 + static_field(SystemDictionary, WK_KLASS(Exception_klass), klassOop) \ 136.33 + static_field(SystemDictionary, WK_KLASS(RuntimeException_klass), klassOop) \ 136.34 + static_field(SystemDictionary, WK_KLASS(ClassNotFoundException_klass), klassOop) \ 136.35 + static_field(SystemDictionary, WK_KLASS(NoClassDefFoundError_klass), klassOop) \ 136.36 + static_field(SystemDictionary, WK_KLASS(LinkageError_klass), klassOop) \ 136.37 static_field(SystemDictionary, WK_KLASS(ClassCastException_klass), klassOop) \ 136.38 static_field(SystemDictionary, WK_KLASS(ArrayStoreException_klass), klassOop) \ 136.39 - static_field(SystemDictionary, WK_KLASS(virtualMachineError_klass), klassOop) \ 136.40 + static_field(SystemDictionary, WK_KLASS(VirtualMachineError_klass), klassOop) \ 136.41 static_field(SystemDictionary, WK_KLASS(OutOfMemoryError_klass), klassOop) \ 136.42 static_field(SystemDictionary, WK_KLASS(StackOverflowError_klass), klassOop) \ 136.43 - static_field(SystemDictionary, WK_KLASS(protectionDomain_klass), klassOop) \ 136.44 + static_field(SystemDictionary, WK_KLASS(ProtectionDomain_klass), klassOop) \ 136.45 static_field(SystemDictionary, WK_KLASS(AccessControlContext_klass), klassOop) \ 136.46 - static_field(SystemDictionary, WK_KLASS(reference_klass), klassOop) \ 136.47 - static_field(SystemDictionary, WK_KLASS(soft_reference_klass), klassOop) \ 136.48 - static_field(SystemDictionary, WK_KLASS(weak_reference_klass), klassOop) \ 136.49 - static_field(SystemDictionary, WK_KLASS(final_reference_klass), klassOop) \ 136.50 - static_field(SystemDictionary, WK_KLASS(phantom_reference_klass), klassOop) \ 136.51 - static_field(SystemDictionary, WK_KLASS(finalizer_klass), klassOop) \ 136.52 - static_field(SystemDictionary, WK_KLASS(thread_klass), klassOop) \ 136.53 - static_field(SystemDictionary, WK_KLASS(threadGroup_klass), klassOop) \ 136.54 - static_field(SystemDictionary, WK_KLASS(properties_klass), klassOop) \ 136.55 - static_field(SystemDictionary, WK_KLASS(stringBuffer_klass), klassOop) \ 136.56 - static_field(SystemDictionary, WK_KLASS(vector_klass), klassOop) \ 136.57 - static_field(SystemDictionary, WK_KLASS(hashtable_klass), klassOop) \ 136.58 + static_field(SystemDictionary, WK_KLASS(Reference_klass), klassOop) \ 136.59 + static_field(SystemDictionary, WK_KLASS(SoftReference_klass), klassOop) \ 136.60 + static_field(SystemDictionary, WK_KLASS(WeakReference_klass), klassOop) \ 136.61 + static_field(SystemDictionary, WK_KLASS(FinalReference_klass), klassOop) \ 136.62 + static_field(SystemDictionary, WK_KLASS(PhantomReference_klass), klassOop) \ 136.63 + static_field(SystemDictionary, WK_KLASS(Finalizer_klass), klassOop) \ 136.64 + static_field(SystemDictionary, WK_KLASS(Thread_klass), klassOop) \ 136.65 + static_field(SystemDictionary, WK_KLASS(ThreadGroup_klass), klassOop) \ 136.66 + static_field(SystemDictionary, WK_KLASS(Properties_klass), klassOop) \ 136.67 + static_field(SystemDictionary, WK_KLASS(StringBuffer_klass), klassOop) \ 136.68 static_field(SystemDictionary, _box_klasses[0], klassOop) \ 136.69 static_field(SystemDictionary, _java_system_loader, oop) \ 136.70 \
137.1 --- a/src/share/vm/services/attachListener.cpp Wed Dec 23 03:12:16 2009 -0800 137.2 +++ b/src/share/vm/services/attachListener.cpp Wed Jan 06 22:21:39 2010 -0800 137.3 @@ -437,7 +437,7 @@ 137.4 string, 137.5 CHECK); 137.6 137.7 - KlassHandle group(THREAD, SystemDictionary::threadGroup_klass()); 137.8 + KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass()); 137.9 JavaCalls::call_special(&result, 137.10 thread_group, 137.11 group,
138.1 --- a/src/share/vm/services/heapDumper.cpp Wed Dec 23 03:12:16 2009 -0800 138.2 +++ b/src/share/vm/services/heapDumper.cpp Wed Jan 06 22:21:39 2010 -0800 138.3 @@ -1274,7 +1274,7 @@ 138.4 if (o->is_klass()) return; 138.5 138.6 // skip classes as these emitted as HPROF_GC_CLASS_DUMP records 138.7 - if (o->klass() == SystemDictionary::class_klass()) { 138.8 + if (o->klass() == SystemDictionary::Class_klass()) { 138.9 if (!java_lang_Class::is_primitive(o)) { 138.10 return; 138.11 }
139.1 --- a/src/share/vm/services/lowMemoryDetector.cpp Wed Dec 23 03:12:16 2009 -0800 139.2 +++ b/src/share/vm/services/lowMemoryDetector.cpp Wed Jan 06 22:21:39 2010 -0800 139.3 @@ -32,7 +32,7 @@ 139.4 void LowMemoryDetector::initialize() { 139.5 EXCEPTION_MARK; 139.6 139.7 - instanceKlassHandle klass (THREAD, SystemDictionary::thread_klass()); 139.8 + instanceKlassHandle klass (THREAD, SystemDictionary::Thread_klass()); 139.9 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK); 139.10 139.11 const char thread_name[] = "Low Memory Detector";
140.1 --- a/src/share/vm/services/management.cpp Wed Dec 23 03:12:16 2009 -0800 140.2 +++ b/src/share/vm/services/management.cpp Wed Jan 06 22:21:39 2010 -0800 140.3 @@ -491,7 +491,7 @@ 140.4 int num_flags = Arguments::num_jvm_flags(); 140.5 int num_args = Arguments::num_jvm_args(); 140.6 140.7 - instanceKlassHandle ik (THREAD, SystemDictionary::string_klass()); 140.8 + instanceKlassHandle ik (THREAD, SystemDictionary::String_klass()); 140.9 objArrayOop r = oopFactory::new_objArray(ik(), num_args + num_flags, CHECK_NULL); 140.10 objArrayHandle result_h(THREAD, r); 140.11 140.12 @@ -1321,7 +1321,7 @@ 140.13 LoadedClassesEnumerator lce(THREAD); // Pass current Thread as parameter 140.14 140.15 int num_classes = lce.num_loaded_classes(); 140.16 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::class_klass(), num_classes, CHECK_0); 140.17 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), num_classes, CHECK_0); 140.18 objArrayHandle classes_ah(THREAD, r); 140.19 140.20 for (int i = 0; i < num_classes; i++) { 140.21 @@ -1481,7 +1481,7 @@ 140.22 // last flag entry is always NULL, so subtract 1 140.23 int nFlags = (int) Flag::numFlags - 1; 140.24 // allocate a temp array 140.25 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::string_klass(), 140.26 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), 140.27 nFlags, CHECK_0); 140.28 objArrayHandle flags_ah(THREAD, r); 140.29 int num_entries = 0; 140.30 @@ -1497,7 +1497,7 @@ 140.31 140.32 if (num_entries < nFlags) { 140.33 // Return array of right length 140.34 - objArrayOop res = oopFactory::new_objArray(SystemDictionary::string_klass(), num_entries, CHECK_0); 140.35 + objArrayOop res = oopFactory::new_objArray(SystemDictionary::String_klass(), num_entries, CHECK_0); 140.36 for(int i = 0; i < num_entries; i++) { 140.37 res->obj_at_put(i, flags_ah->obj_at(i)); 140.38 } 140.39 @@ -1593,7 +1593,7 @@ 140.40 objArrayHandle names_ah(THREAD, ta); 140.41 // Make sure we have a String array 140.42 klassOop element_klass = objArrayKlass::cast(names_ah->klass())->element_klass(); 140.43 - if (element_klass != SystemDictionary::string_klass()) { 140.44 + if (element_klass != SystemDictionary::String_klass()) { 140.45 THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), 140.46 "Array element type is not String class", 0); 140.47 } 140.48 @@ -1747,7 +1747,7 @@ 140.49 140.50 // Make sure we have a String array 140.51 klassOop element_klass = objArrayKlass::cast(names_ah->klass())->element_klass(); 140.52 - if (element_klass != SystemDictionary::string_klass()) { 140.53 + if (element_klass != SystemDictionary::String_klass()) { 140.54 THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), 140.55 "Array element type is not String class", 0); 140.56 } 140.57 @@ -1782,7 +1782,7 @@ 140.58 num_threads += cycle->num_threads(); 140.59 } 140.60 140.61 - objArrayOop r = oopFactory::new_objArray(SystemDictionary::thread_klass(), num_threads, CHECK_NH); 140.62 + objArrayOop r = oopFactory::new_objArray(SystemDictionary::Thread_klass(), num_threads, CHECK_NH); 140.63 objArrayHandle threads_ah(THREAD, r); 140.64 140.65 int index = 0;
141.1 --- a/src/share/vm/services/serviceUtil.hpp Wed Dec 23 03:12:16 2009 -0800 141.2 +++ b/src/share/vm/services/serviceUtil.hpp Wed Jan 06 22:21:39 2010 -0800 141.3 @@ -45,7 +45,7 @@ 141.4 // instance 141.5 if (o->is_instance()) { 141.6 // instance objects are visible 141.7 - if (o->klass() != SystemDictionary::class_klass()) { 141.8 + if (o->klass() != SystemDictionary::Class_klass()) { 141.9 return true; 141.10 } 141.11 if (java_lang_Class::is_primitive(o)) {
142.1 --- a/src/share/vm/services/threadService.cpp Wed Dec 23 03:12:16 2009 -0800 142.2 +++ b/src/share/vm/services/threadService.cpp Wed Jan 06 22:21:39 2010 -0800 142.3 @@ -540,7 +540,7 @@ 142.4 } 142.5 142.6 Handle ThreadStackTrace::allocate_fill_stack_trace_element_array(TRAPS) { 142.7 - klassOop k = SystemDictionary::stackTraceElement_klass(); 142.8 + klassOop k = SystemDictionary::StackTraceElement_klass(); 142.9 assert(k != NULL, "must be loaded in 1.4+"); 142.10 instanceKlassHandle ik(THREAD, k); 142.11
143.1 --- a/src/share/vm/utilities/constantTag.hpp Wed Dec 23 03:12:16 2009 -0800 143.2 +++ b/src/share/vm/utilities/constantTag.hpp Wed Jan 06 22:21:39 2010 -0800 143.3 @@ -36,7 +36,8 @@ 143.4 JVM_CONSTANT_UnresolvedString = 102, // Temporary tag until actual use 143.5 JVM_CONSTANT_StringIndex = 103, // Temporary tag while constructing constant pool 143.6 JVM_CONSTANT_UnresolvedClassInError = 104, // Error tag due to resolution error 143.7 - JVM_CONSTANT_InternalMax = 104 // Last implementation tag 143.8 + JVM_CONSTANT_Object = 105, // Required for BoundMethodHandle arguments. 143.9 + JVM_CONSTANT_InternalMax = 105 // Last implementation tag 143.10 }; 143.11 143.12 143.13 @@ -70,6 +71,8 @@ 143.14 bool is_unresolved_string() const { return _tag == JVM_CONSTANT_UnresolvedString; } 143.15 bool is_string_index() const { return _tag == JVM_CONSTANT_StringIndex; } 143.16 143.17 + bool is_object() const { return _tag == JVM_CONSTANT_Object; } 143.18 + 143.19 bool is_klass_reference() const { return is_klass_index() || is_unresolved_klass(); } 143.20 bool is_klass_or_reference() const{ return is_klass() || is_klass_reference(); } 143.21 bool is_field_or_method() const { return is_field() || is_method() || is_interface_method(); }
144.1 --- a/src/share/vm/utilities/exceptions.cpp Wed Dec 23 03:12:16 2009 -0800 144.2 +++ b/src/share/vm/utilities/exceptions.cpp Wed Jan 06 22:21:39 2010 -0800 144.3 @@ -122,7 +122,7 @@ 144.4 // Check for special boot-strapping/vm-thread handling 144.5 if (special_exception(thread, file, line, h_exception)) return; 144.6 144.7 - assert(h_exception->is_a(SystemDictionary::throwable_klass()), "exception is not a subclass of java/lang/Throwable"); 144.8 + assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable"); 144.9 144.10 // set the pending exception 144.11 thread->set_pending_exception(h_exception(), file, line); 144.12 @@ -255,7 +255,7 @@ 144.13 144.14 // Future: object initializer should take a cause argument 144.15 if (h_cause() != NULL) { 144.16 - assert(h_cause->is_a(SystemDictionary::throwable_klass()), 144.17 + assert(h_cause->is_a(SystemDictionary::Throwable_klass()), 144.18 "exception cause is not a subclass of java/lang/Throwable"); 144.19 JavaValue result1(T_OBJECT); 144.20 JavaCallArguments args1;