1.1 --- a/src/share/vm/opto/callGenerator.cpp Mon Jun 18 12:29:21 2012 -0700 1.2 +++ b/src/share/vm/opto/callGenerator.cpp Mon Jun 18 15:17:30 2012 -0700 1.3 @@ -172,9 +172,11 @@ 1.4 1.5 JVMState* DynamicCallGenerator::generate(JVMState* jvms) { 1.6 GraphKit kit(jvms); 1.7 + Compile* C = kit.C; 1.8 + PhaseGVN& gvn = kit.gvn(); 1.9 1.10 - if (kit.C->log() != NULL) { 1.11 - kit.C->log()->elem("dynamic_call bci='%d'", jvms->bci()); 1.12 + if (C->log() != NULL) { 1.13 + C->log()->elem("dynamic_call bci='%d'", jvms->bci()); 1.14 } 1.15 1.16 // Get the constant pool cache from the caller class. 1.17 @@ -190,18 +192,21 @@ 1.18 size_t call_site_offset = cpcache->get_f1_offset(index); 1.19 1.20 // Load the CallSite object from the constant pool cache. 1.21 - const TypeOopPtr* cpcache_ptr = TypeOopPtr::make_from_constant(cpcache); 1.22 - Node* cpcache_adr = kit.makecon(cpcache_ptr); 1.23 - Node* call_site_adr = kit.basic_plus_adr(cpcache_adr, cpcache_adr, call_site_offset); 1.24 - Node* call_site = kit.make_load(kit.control(), call_site_adr, TypeInstPtr::BOTTOM, T_OBJECT, Compile::AliasIdxRaw); 1.25 + const TypeOopPtr* cpcache_type = TypeOopPtr::make_from_constant(cpcache); // returns TypeAryPtr of type T_OBJECT 1.26 + const TypeOopPtr* call_site_type = TypeOopPtr::make_from_klass(C->env()->CallSite_klass()); 1.27 + Node* cpcache_adr = kit.makecon(cpcache_type); 1.28 + Node* call_site_adr = kit.basic_plus_adr(cpcache_adr, call_site_offset); 1.29 + // The oops in the constant pool cache are not compressed; load then as raw pointers. 1.30 + Node* call_site = kit.make_load(kit.control(), call_site_adr, call_site_type, T_ADDRESS, Compile::AliasIdxRaw); 1.31 1.32 // Load the target MethodHandle from the CallSite object. 1.33 - Node* target_mh_adr = kit.basic_plus_adr(call_site, call_site, java_lang_invoke_CallSite::target_offset_in_bytes()); 1.34 - Node* target_mh = kit.make_load(kit.control(), target_mh_adr, TypeInstPtr::BOTTOM, T_OBJECT); 1.35 + const TypeOopPtr* target_type = TypeOopPtr::make_from_klass(C->env()->MethodHandle_klass()); 1.36 + Node* target_mh_adr = kit.basic_plus_adr(call_site, java_lang_invoke_CallSite::target_offset_in_bytes()); 1.37 + Node* target_mh = kit.make_load(kit.control(), target_mh_adr, target_type, T_OBJECT); 1.38 1.39 address resolve_stub = SharedRuntime::get_resolve_opt_virtual_call_stub(); 1.40 1.41 - CallStaticJavaNode *call = new (kit.C, tf()->domain()->cnt()) CallStaticJavaNode(tf(), resolve_stub, method(), kit.bci()); 1.42 + CallStaticJavaNode* call = new (C, tf()->domain()->cnt()) CallStaticJavaNode(tf(), resolve_stub, method(), kit.bci()); 1.43 // invokedynamic is treated as an optimized invokevirtual. 1.44 call->set_optimized_virtual(true); 1.45 // Take extra care (in the presence of argument motion) not to trash the SP: 1.46 @@ -785,9 +790,10 @@ 1.47 1.48 JVMState* PredictedDynamicCallGenerator::generate(JVMState* jvms) { 1.49 GraphKit kit(jvms); 1.50 + Compile* C = kit.C; 1.51 PhaseGVN& gvn = kit.gvn(); 1.52 1.53 - CompileLog* log = kit.C->log(); 1.54 + CompileLog* log = C->log(); 1.55 if (log != NULL) { 1.56 log->elem("predicted_dynamic_call bci='%d'", jvms->bci()); 1.57 } 1.58 @@ -803,8 +809,8 @@ 1.59 Node* receiver = kit.argument(0); 1.60 1.61 // Check if the MethodHandle is the expected one 1.62 - Node* cmp = gvn.transform(new(kit.C, 3) CmpPNode(receiver, predicted_mh)); 1.63 - bol = gvn.transform(new(kit.C, 2) BoolNode(cmp, BoolTest::eq) ); 1.64 + Node* cmp = gvn.transform(new (C, 3) CmpPNode(receiver, predicted_mh)); 1.65 + bol = gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::eq) ); 1.66 } else { 1.67 // Get the constant pool cache from the caller class. 1.68 ciMethod* caller_method = jvms->method(); 1.69 @@ -818,22 +824,25 @@ 1.70 size_t call_site_offset = cpcache->get_f1_offset(index); 1.71 1.72 // Load the CallSite object from the constant pool cache. 1.73 - const TypeOopPtr* cpcache_ptr = TypeOopPtr::make_from_constant(cpcache); 1.74 - Node* cpcache_adr = kit.makecon(cpcache_ptr); 1.75 - Node* call_site_adr = kit.basic_plus_adr(cpcache_adr, cpcache_adr, call_site_offset); 1.76 - Node* call_site = kit.make_load(kit.control(), call_site_adr, TypeInstPtr::BOTTOM, T_OBJECT, Compile::AliasIdxRaw); 1.77 + const TypeOopPtr* cpcache_type = TypeOopPtr::make_from_constant(cpcache); // returns TypeAryPtr of type T_OBJECT 1.78 + const TypeOopPtr* call_site_type = TypeOopPtr::make_from_klass(C->env()->CallSite_klass()); 1.79 + Node* cpcache_adr = kit.makecon(cpcache_type); 1.80 + Node* call_site_adr = kit.basic_plus_adr(cpcache_adr, call_site_offset); 1.81 + // The oops in the constant pool cache are not compressed; load then as raw pointers. 1.82 + Node* call_site = kit.make_load(kit.control(), call_site_adr, call_site_type, T_ADDRESS, Compile::AliasIdxRaw); 1.83 1.84 // Load the target MethodHandle from the CallSite object. 1.85 + const TypeOopPtr* target_type = TypeOopPtr::make_from_klass(C->env()->MethodHandle_klass()); 1.86 Node* target_adr = kit.basic_plus_adr(call_site, call_site, java_lang_invoke_CallSite::target_offset_in_bytes()); 1.87 - Node* target_mh = kit.make_load(kit.control(), target_adr, TypeInstPtr::BOTTOM, T_OBJECT); 1.88 + Node* target_mh = kit.make_load(kit.control(), target_adr, target_type, T_OBJECT); 1.89 1.90 // Check if the MethodHandle is still the same. 1.91 - Node* cmp = gvn.transform(new(kit.C, 3) CmpPNode(target_mh, predicted_mh)); 1.92 - bol = gvn.transform(new(kit.C, 2) BoolNode(cmp, BoolTest::eq) ); 1.93 + Node* cmp = gvn.transform(new (C, 3) CmpPNode(target_mh, predicted_mh)); 1.94 + bol = gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::eq) ); 1.95 } 1.96 IfNode* iff = kit.create_and_xform_if(kit.control(), bol, _hit_prob, COUNT_UNKNOWN); 1.97 - kit.set_control( gvn.transform(new(kit.C, 1) IfTrueNode (iff))); 1.98 - Node* slow_ctl = gvn.transform(new(kit.C, 1) IfFalseNode(iff)); 1.99 + kit.set_control( gvn.transform(new (C, 1) IfTrueNode (iff))); 1.100 + Node* slow_ctl = gvn.transform(new (C, 1) IfFalseNode(iff)); 1.101 1.102 SafePointNode* slow_map = NULL; 1.103 JVMState* slow_jvms; 1.104 @@ -882,7 +891,7 @@ 1.105 1.106 // Finish the diamond. 1.107 kit.C->set_has_split_ifs(true); // Has chance for split-if optimization 1.108 - RegionNode* region = new (kit.C, 3) RegionNode(3); 1.109 + RegionNode* region = new (C, 3) RegionNode(3); 1.110 region->init_req(1, kit.control()); 1.111 region->init_req(2, slow_map->control()); 1.112 kit.set_control(gvn.transform(region));