< prev index next >

src/hotspot/share/opto/parse1.cpp

Print this page




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "compiler/compileLog.hpp"
  27 #include "interpreter/linkResolver.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "oops/method.hpp"
  30 #include "opto/addnode.hpp"
  31 #include "opto/c2compiler.hpp"
  32 #include "opto/castnode.hpp"
  33 #include "opto/idealGraphPrinter.hpp"
  34 #include "opto/locknode.hpp"
  35 #include "opto/memnode.hpp"
  36 #include "opto/opaquenode.hpp"
  37 #include "opto/parse.hpp"
  38 #include "opto/rootnode.hpp"
  39 #include "opto/runtime.hpp"

  40 #include "runtime/arguments.hpp"
  41 #include "runtime/handles.inline.hpp"
  42 #include "runtime/safepointMechanism.hpp"
  43 #include "runtime/sharedRuntime.hpp"
  44 #include "utilities/copy.hpp"
  45 
  46 // Static array so we can figure out which bytecodes stop us from compiling
  47 // the most. Some of the non-static variables are needed in bytecodeInfo.cpp
  48 // and eventually should be encapsulated in a proper class (gri 8/18/98).
  49 
  50 #ifndef PRODUCT
  51 int nodes_created              = 0;
  52 int methods_parsed             = 0;
  53 int methods_seen               = 0;
  54 int blocks_parsed              = 0;
  55 int blocks_seen                = 0;
  56 
  57 int explicit_null_checks_inserted = 0;
  58 int explicit_null_checks_elided   = 0;
  59 int all_null_checks_found         = 0;


  84   }
  85   if (all_null_checks_found) {
  86     tty->print_cr("%d made implicit (%2d%%)", implicit_null_checks,
  87                   (100*implicit_null_checks)/all_null_checks_found);
  88   }
  89   if (SharedRuntime::_implicit_null_throws) {
  90     tty->print_cr("%d implicit null exceptions at runtime",
  91                   SharedRuntime::_implicit_null_throws);
  92   }
  93 
  94   if (PrintParseStatistics && BytecodeParseHistogram::initialized()) {
  95     BytecodeParseHistogram::print();
  96   }
  97 }
  98 #endif
  99 
 100 //------------------------------ON STACK REPLACEMENT---------------------------
 101 
 102 // Construct a node which can be used to get incoming state for
 103 // on stack replacement.
 104 Node *Parse::fetch_interpreter_state(int index,
 105                                      BasicType bt,
 106                                      Node *local_addrs,
 107                                      Node *local_addrs_base) {






 108   Node *mem = memory(Compile::AliasIdxRaw);
 109   Node *adr = basic_plus_adr( local_addrs_base, local_addrs, -index*wordSize );
 110   Node *ctl = control();
 111 
 112   // Very similar to LoadNode::make, except we handle un-aligned longs and
 113   // doubles on Sparc.  Intel can handle them just fine directly.
 114   Node *l = NULL;
 115   switch (bt) {                // Signature is flattened
 116   case T_INT:     l = new LoadINode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInt::INT,        MemNode::unordered); break;
 117   case T_FLOAT:   l = new LoadFNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::FLOAT,         MemNode::unordered); break;
 118   case T_ADDRESS: l = new LoadPNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM,  MemNode::unordered); break;

 119   case T_OBJECT:  l = new LoadPNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInstPtr::BOTTOM, MemNode::unordered); break;
 120   case T_LONG:
 121   case T_DOUBLE: {
 122     // Since arguments are in reverse order, the argument address 'adr'
 123     // refers to the back half of the long/double.  Recompute adr.
 124     adr = basic_plus_adr(local_addrs_base, local_addrs, -(index+1)*wordSize);
 125     if (Matcher::misaligned_doubles_ok) {
 126       l = (bt == T_DOUBLE)
 127         ? (Node*)new LoadDNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::DOUBLE, MemNode::unordered)
 128         : (Node*)new LoadLNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeLong::LONG, MemNode::unordered);
 129     } else {
 130       l = (bt == T_DOUBLE)
 131         ? (Node*)new LoadD_unalignedNode(ctl, mem, adr, TypeRawPtr::BOTTOM, MemNode::unordered)
 132         : (Node*)new LoadL_unalignedNode(ctl, mem, adr, TypeRawPtr::BOTTOM, MemNode::unordered);
 133     }
 134     break;
 135   }
 136   default: ShouldNotReachHere();
 137   }
 138   return _gvn.transform(l);
 139 }
 140 
 141 // Helper routine to prevent the interpreter from handing
 142 // unexpected typestate to an OSR method.
 143 // The Node l is a value newly dug out of the interpreter frame.
 144 // The type is the type predicted by ciTypeFlow.  Note that it is
 145 // not a general type, but can only come from Type::get_typeflow_type.
 146 // The safepoint is a map which will feed an uncommon trap.
 147 Node* Parse::check_interpreter_type(Node* l, const Type* type,
 148                                     SafePointNode* &bad_type_exit) {
 149 
 150   const TypeOopPtr* tp = type->isa_oopptr();





 151 
 152   // TypeFlow may assert null-ness if a type appears unloaded.
 153   if (type == TypePtr::NULL_PTR ||
 154       (tp != NULL && !tp->klass()->is_loaded())) {
 155     // Value must be null, not a real oop.
 156     Node* chk = _gvn.transform( new CmpPNode(l, null()) );
 157     Node* tst = _gvn.transform( new BoolNode(chk, BoolTest::eq) );
 158     IfNode* iff = create_and_map_if(control(), tst, PROB_MAX, COUNT_UNKNOWN);
 159     set_control(_gvn.transform( new IfTrueNode(iff) ));
 160     Node* bad_type = _gvn.transform( new IfFalseNode(iff) );
 161     bad_type_exit->control()->add_req(bad_type);
 162     l = null();
 163   }
 164 
 165   // Typeflow can also cut off paths from the CFG, based on
 166   // types which appear unloaded, or call sites which appear unlinked.
 167   // When paths are cut off, values at later merge points can rise
 168   // toward more specific classes.  Make sure these specific classes
 169   // are still in effect.
 170   if (tp != NULL && tp->klass() != C->env()->Object_klass()) {
 171     // TypeFlow asserted a specific object type.  Value must have that type.
 172     Node* bad_type_ctrl = NULL;






 173     l = gen_checkcast(l, makecon(TypeKlassPtr::make(tp->klass())), &bad_type_ctrl);
 174     bad_type_exit->control()->add_req(bad_type_ctrl);
 175   }
 176 
 177   BasicType bt_l = _gvn.type(l)->basic_type();
 178   BasicType bt_t = type->basic_type();
 179   assert(_gvn.type(l)->higher_equal(type), "must constrain OSR typestate");
 180   return l;
 181 }
 182 
 183 // Helper routine which sets up elements of the initial parser map when
 184 // performing a parse for on stack replacement.  Add values into map.
 185 // The only parameter contains the address of a interpreter arguments.
 186 void Parse::load_interpreter_state(Node* osr_buf) {
 187   int index;
 188   int max_locals = jvms()->loc_size();
 189   int max_stack  = jvms()->stk_size();
 190 
 191 
 192   // Mismatch between method and jvms can occur since map briefly held
 193   // an OSR entry state (which takes up one RawPtr word).
 194   assert(max_locals == method()->max_locals(), "sanity");
 195   assert(max_stack  >= method()->max_stack(),  "sanity");
 196   assert((int)jvms()->endoff() == TypeFunc::Parms + max_locals + max_stack, "sanity");
 197   assert((int)jvms()->endoff() == (int)map()->req(), "sanity");
 198 
 199   // Find the start block.
 200   Block* osr_block = start_block();
 201   assert(osr_block->start() == osr_bci(), "sanity");
 202 
 203   // Set initial BCI.
 204   set_parse_bci(osr_block->start());
 205 
 206   // Set initial stack depth.
 207   set_sp(osr_block->start_sp());
 208 
 209   // Check bailouts.  We currently do not perform on stack replacement
 210   // of loops in catch blocks or loops which branch with a non-empty stack.
 211   if (sp() != 0) {
 212     C->record_method_not_compilable("OSR starts with non-empty stack");
 213     return;
 214   }
 215   // Do not OSR inside finally clauses:
 216   if (osr_block->has_trap_at(osr_block->start())) {
 217     C->record_method_not_compilable("OSR starts with an immediate trap");
 218     return;
 219   }
 220 
 221   // Commute monitors from interpreter frame to compiler frame.
 222   assert(jvms()->monitor_depth() == 0, "should be no active locks at beginning of osr");
 223   int mcnt = osr_block->flow()->monitor_count();
 224   Node *monitors_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals+mcnt*2-1)*wordSize);
 225   for (index = 0; index < mcnt; index++) {
 226     // Make a BoxLockNode for the monitor.
 227     Node *box = _gvn.transform(new BoxLockNode(next_monitor()));
 228 
 229 
 230     // Displaced headers and locked objects are interleaved in the
 231     // temp OSR buffer.  We only copy the locked objects out here.
 232     // Fetch the locked object from the OSR temp buffer and copy to our fastlock node.
 233     Node *lock_object = fetch_interpreter_state(index*2, T_OBJECT, monitors_addr, osr_buf);
 234     // Try and copy the displaced header to the BoxNode
 235     Node *displaced_hdr = fetch_interpreter_state((index*2) + 1, T_ADDRESS, monitors_addr, osr_buf);
 236 
 237 
 238     store_to_memory(control(), box, displaced_hdr, T_ADDRESS, Compile::AliasIdxRaw, MemNode::unordered);
 239 
 240     // Build a bogus FastLockNode (no code will be generated) and push the
 241     // monitor into our debug info.
 242     const FastLockNode *flock = _gvn.transform(new FastLockNode( 0, lock_object, box ))->as_FastLock();
 243     map()->push_monitor(flock);
 244 
 245     // If the lock is our method synchronization lock, tuck it away in
 246     // _sync_lock for return and rethrow exit paths.
 247     if (index == 0 && method()->is_synchronized()) {
 248       _synch_lock = flock;
 249     }
 250   }
 251 
 252   // Use the raw liveness computation to make sure that unexpected
 253   // values don't propagate into the OSR frame.
 254   MethodLivenessResult live_locals = method()->liveness_at_bci(osr_bci());
 255   if (!live_locals.is_valid()) {
 256     // Degenerate or breakpointed method.


 283         if (C->log() != NULL) {
 284           C->log()->elem("OSR_mismatch local_index='%d'",index);
 285         }
 286         set_local(index, null());
 287         // and ignore it for the loads
 288         continue;
 289       }
 290     }
 291 
 292     // Filter out TOP, HALF, and BOTTOM.  (Cf. ensure_phi.)
 293     if (type == Type::TOP || type == Type::HALF) {
 294       continue;
 295     }
 296     // If the type falls to bottom, then this must be a local that
 297     // is mixing ints and oops or some such.  Forcing it to top
 298     // makes it go dead.
 299     if (type == Type::BOTTOM) {
 300       continue;
 301     }
 302     // Construct code to access the appropriate local.
 303     BasicType bt = type->basic_type();
 304     if (type == TypePtr::NULL_PTR) {
 305       // Ptr types are mixed together with T_ADDRESS but NULL is
 306       // really for T_OBJECT types so correct it.
 307       bt = T_OBJECT;
 308     }
 309     Node *value = fetch_interpreter_state(index, bt, locals_addr, osr_buf);
 310     set_local(index, value);
 311   }
 312 
 313   // Extract the needed stack entries from the interpreter frame.
 314   for (index = 0; index < sp(); index++) {
 315     const Type *type = osr_block->stack_type_at(index);
 316     if (type != Type::TOP) {
 317       // Currently the compiler bails out when attempting to on stack replace
 318       // at a bci with a non-empty stack.  We should not reach here.
 319       ShouldNotReachHere();
 320     }
 321   }
 322 
 323   // End the OSR migration
 324   make_runtime_call(RC_LEAF, OptoRuntime::osr_end_Type(),
 325                     CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end),
 326                     "OSR_migration_end", TypeRawPtr::BOTTOM,
 327                     osr_buf);
 328 
 329   // Now that the interpreter state is loaded, make sure it will match


 583     }
 584   }
 585 
 586   if (depth() == 1 && !failing()) {
 587     if (C->clinit_barrier_on_entry()) {
 588       // Add check to deoptimize the nmethod once the holder class is fully initialized
 589       clinit_deopt();
 590     }
 591 
 592     // Add check to deoptimize the nmethod if RTM state was changed
 593     rtm_deopt();
 594   }
 595 
 596   // Check for bailouts during method entry or RTM state check setup.
 597   if (failing()) {
 598     if (log)  log->done("parse");
 599     C->set_default_node_notes(caller_nn);
 600     return;
 601   }
 602 





















 603   entry_map = map();  // capture any changes performed by method setup code
 604   assert(jvms()->endoff() == map()->req(), "map matches JVMS layout");
 605 
 606   // We begin parsing as if we have just encountered a jump to the
 607   // method entry.
 608   Block* entry_block = start_block();
 609   assert(entry_block->start() == (is_osr_parse() ? osr_bci() : 0), "");
 610   set_map_clone(entry_map);
 611   merge_common(entry_block, entry_block->next_path_num());
 612 
 613 #ifndef PRODUCT
 614   BytecodeParseHistogram *parse_histogram_obj = new (C->env()->arena()) BytecodeParseHistogram(this, C);
 615   set_parse_histogram( parse_histogram_obj );
 616 #endif
 617 
 618   // Parse all the basic blocks.
 619   do_all_blocks();
 620 
 621   C->set_default_node_notes(caller_nn);
 622 


 765 void Parse::build_exits() {
 766   // make a clone of caller to prevent sharing of side-effects
 767   _exits.set_map(_exits.clone_map());
 768   _exits.clean_stack(_exits.sp());
 769   _exits.sync_jvms();
 770 
 771   RegionNode* region = new RegionNode(1);
 772   record_for_igvn(region);
 773   gvn().set_type_bottom(region);
 774   _exits.set_control(region);
 775 
 776   // Note:  iophi and memphi are not transformed until do_exits.
 777   Node* iophi  = new PhiNode(region, Type::ABIO);
 778   Node* memphi = new PhiNode(region, Type::MEMORY, TypePtr::BOTTOM);
 779   gvn().set_type_bottom(iophi);
 780   gvn().set_type_bottom(memphi);
 781   _exits.set_i_o(iophi);
 782   _exits.set_all_memory(memphi);
 783 
 784   // Add a return value to the exit state.  (Do not push it yet.)
 785   if (tf()->range()->cnt() > TypeFunc::Parms) {
 786     const Type* ret_type = tf()->range()->field_at(TypeFunc::Parms);
 787     if (ret_type->isa_int()) {
 788       BasicType ret_bt = method()->return_type()->basic_type();
 789       if (ret_bt == T_BOOLEAN ||
 790           ret_bt == T_CHAR ||
 791           ret_bt == T_BYTE ||
 792           ret_bt == T_SHORT) {
 793         ret_type = TypeInt::INT;
 794       }
 795     }
 796 
 797     // Don't "bind" an unloaded return klass to the ret_phi. If the klass
 798     // becomes loaded during the subsequent parsing, the loaded and unloaded
 799     // types will not join when we transform and push in do_exits().
 800     const TypeOopPtr* ret_oop_type = ret_type->isa_oopptr();
 801     if (ret_oop_type && !ret_oop_type->klass()->is_loaded()) {
 802       ret_type = TypeOopPtr::BOTTOM;
 803     }





 804     int         ret_size = type2size[ret_type->basic_type()];
 805     Node*       ret_phi  = new PhiNode(region, ret_type);
 806     gvn().set_type_bottom(ret_phi);
 807     _exits.ensure_stack(ret_size);
 808     assert((int)(tf()->range()->cnt() - TypeFunc::Parms) == ret_size, "good tf range");
 809     assert(method()->return_type()->size() == ret_size, "tf agrees w/ method");
 810     _exits.set_argument(0, ret_phi);  // here is where the parser finds it
 811     // Note:  ret_phi is not yet pushed, until do_exits.
 812   }
 813 }
 814 
 815 
 816 //----------------------------build_start_state-------------------------------
 817 // Construct a state which contains only the incoming arguments from an
 818 // unknown caller.  The method & bci will be NULL & InvocationEntryBci.
 819 JVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) {
 820   int        arg_size = tf->domain()->cnt();
 821   int        max_size = MAX2(arg_size, (int)tf->range()->cnt());
 822   JVMState*  jvms     = new (this) JVMState(max_size - TypeFunc::Parms);
 823   SafePointNode* map  = new SafePointNode(max_size, NULL);


 824   record_for_igvn(map);
 825   assert(arg_size == TypeFunc::Parms + (is_osr_compilation() ? 1 : method()->arg_size()), "correct arg_size");
 826   Node_Notes* old_nn = default_node_notes();
 827   if (old_nn != NULL && has_method()) {
 828     Node_Notes* entry_nn = old_nn->clone(this);
 829     JVMState* entry_jvms = new(this) JVMState(method(), old_nn->jvms());
 830     entry_jvms->set_offsets(0);
 831     entry_jvms->set_bci(entry_bci());
 832     entry_nn->set_jvms(entry_jvms);
 833     set_default_node_notes(entry_nn);
 834   }
 835   uint i;
 836   for (i = 0; i < (uint)arg_size; i++) {
 837     Node* parm = initial_gvn()->transform(new ParmNode(start, i));






















 838     map->init_req(i, parm);
 839     // Record all these guys for later GVN.
 840     record_for_igvn(parm);
 841   }
 842   for (; i < map->req(); i++) {
 843     map->init_req(i, top());
 844   }
 845   assert(jvms->argoff() == TypeFunc::Parms, "parser gets arguments here");
 846   set_default_node_notes(old_nn);
 847   map->set_jvms(jvms);
 848   jvms->set_map(map);
 849   return jvms;
 850 }
 851 
 852 //-----------------------------make_node_notes---------------------------------
 853 Node_Notes* Parse::make_node_notes(Node_Notes* caller_nn) {
 854   if (caller_nn == NULL)  return NULL;
 855   Node_Notes* nn = caller_nn->clone(C);
 856   JVMState* caller_jvms = nn->jvms();
 857   JVMState* jvms = new (C) JVMState(method(), caller_jvms);
 858   jvms->set_offsets(0);
 859   jvms->set_bci(_entry_bci);
 860   nn->set_jvms(jvms);
 861   return nn;
 862 }
 863 
 864 
 865 //--------------------------return_values--------------------------------------
 866 void Compile::return_values(JVMState* jvms) {
 867   GraphKit kit(jvms);
 868   Node* ret = new ReturnNode(TypeFunc::Parms,
 869                              kit.control(),
 870                              kit.i_o(),
 871                              kit.reset_memory(),
 872                              kit.frameptr(),
 873                              kit.returnadr());
 874   // Add zero or 1 return values
 875   int ret_size = tf()->range()->cnt() - TypeFunc::Parms;
 876   if (ret_size > 0) {
 877     kit.inc_sp(-ret_size);  // pop the return value(s)
 878     kit.sync_jvms();
 879     ret->add_req(kit.argument(0));
 880     // Note:  The second dummy edge is not needed by a ReturnNode.




















 881   }
 882   // bind it to root
 883   root()->add_req(ret);
 884   record_for_igvn(ret);
 885   initial_gvn()->transform_no_reclaim(ret);
 886 }
 887 
 888 //------------------------rethrow_exceptions-----------------------------------
 889 // Bind all exception states in the list into a single RethrowNode.
 890 void Compile::rethrow_exceptions(JVMState* jvms) {
 891   GraphKit kit(jvms);
 892   if (!kit.has_exceptions())  return;  // nothing to generate
 893   // Load my combined exception state into the kit, with all phis transformed:
 894   SafePointNode* ex_map = kit.combine_and_pop_all_exception_states();
 895   Node* ex_oop = kit.use_exception_state(ex_map);
 896   RethrowNode* exit = new RethrowNode(kit.control(),
 897                                       kit.i_o(), kit.reset_memory(),
 898                                       kit.frameptr(), kit.returnadr(),
 899                                       // like a return but with exception input
 900                                       ex_oop);


 981   //    publishes the reference to the newly constructed object. Rather
 982   //    than wait for the publication, we simply block the writes here.
 983   //    Rather than put a barrier on only those writes which are required
 984   //    to complete, we force all writes to complete.
 985   //
 986   // 2. On PPC64, also add MemBarRelease for constructors which write
 987   //    volatile fields. As support_IRIW_for_not_multiple_copy_atomic_cpu
 988   //    is set on PPC64, no sync instruction is issued after volatile
 989   //    stores. We want to guarantee the same behavior as on platforms
 990   //    with total store order, although this is not required by the Java
 991   //    memory model. So as with finals, we add a barrier here.
 992   //
 993   // 3. Experimental VM option is used to force the barrier if any field
 994   //    was written out in the constructor.
 995   //
 996   // "All bets are off" unless the first publication occurs after a
 997   // normal return from the constructor.  We do not attempt to detect
 998   // such unusual early publications.  But no barrier is needed on
 999   // exceptional returns, since they cannot publish normally.
1000   //
1001   if (method()->is_initializer() &&
1002         (wrote_final() ||
1003            PPC64_ONLY(wrote_volatile() ||)
1004            (AlwaysSafeConstructors && wrote_fields()))) {
1005     _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
1006 
1007     // If Memory barrier is created for final fields write
1008     // and allocation node does not escape the initialize method,
1009     // then barrier introduced by allocation node can be removed.
1010     if (DoEscapeAnalysis && alloc_with_final()) {
1011       AllocateNode *alloc = AllocateNode::Ideal_allocation(alloc_with_final(), &_gvn);
1012       alloc->compute_MemBar_redundancy(method());
1013     }
1014     if (PrintOpto && (Verbose || WizardMode)) {
1015       method()->print_name();
1016       tty->print_cr(" writes finals and needs a memory barrier");
1017     }
1018   }
1019 
1020   // Any method can write a @Stable field; insert memory barriers
1021   // after those also. Can't bind predecessor allocation node (if any)
1022   // with barrier because allocation doesn't always dominate
1023   // MemBarRelease.
1024   if (wrote_stable()) {
1025     _exits.insert_mem_bar(Op_MemBarRelease);
1026     if (PrintOpto && (Verbose || WizardMode)) {
1027       method()->print_name();
1028       tty->print_cr(" writes @Stable and needs a memory barrier");
1029     }
1030   }
1031 
1032   for (MergeMemStream mms(_exits.merged_memory()); mms.next_non_empty(); ) {
1033     // transform each slice of the original memphi:
1034     mms.set_memory(_gvn.transform(mms.memory()));
1035   }
1036   // Clean up input MergeMems created by transforming the slices
1037   _gvn.transform(_exits.merged_memory());
1038 
1039   if (tf()->range()->cnt() > TypeFunc::Parms) {
1040     const Type* ret_type = tf()->range()->field_at(TypeFunc::Parms);
1041     Node*       ret_phi  = _gvn.transform( _exits.argument(0) );
1042     if (!_exits.control()->is_top() && _gvn.type(ret_phi)->empty()) {
1043       // In case of concurrent class loading, the type we set for the
1044       // ret_phi in build_exits() may have been too optimistic and the
1045       // ret_phi may be top now.
1046       // Otherwise, we've encountered an error and have to mark the method as
1047       // not compilable. Just using an assertion instead would be dangerous
1048       // as this could lead to an infinite compile loop in non-debug builds.
1049       {
1050         if (C->env()->system_dictionary_modification_counter_changed()) {
1051           C->record_failure(C2Compiler::retry_class_loading_during_parsing());
1052         } else {
1053           C->record_method_not_compilable("Can't determine return type.");
1054         }
1055       }
1056       return;
1057     }
1058     if (ret_type->isa_int()) {
1059       BasicType ret_bt = method()->return_type()->basic_type();
1060       ret_phi = mask_int_value(ret_phi, ret_bt, &_gvn);


1122 }
1123 
1124 //-----------------------------create_entry_map-------------------------------
1125 // Initialize our parser map to contain the types at method entry.
1126 // For OSR, the map contains a single RawPtr parameter.
1127 // Initial monitor locking for sync. methods is performed by do_method_entry.
1128 SafePointNode* Parse::create_entry_map() {
1129   // Check for really stupid bail-out cases.
1130   uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
1131   if (len >= 32760) {
1132     C->record_method_not_compilable("too many local variables");
1133     return NULL;
1134   }
1135 
1136   // clear current replaced nodes that are of no use from here on (map was cloned in build_exits).
1137   _caller->map()->delete_replaced_nodes();
1138 
1139   // If this is an inlined method, we may have to do a receiver null check.
1140   if (_caller->has_method() && is_normal_parse() && !method()->is_static()) {
1141     GraphKit kit(_caller);
1142     kit.null_check_receiver_before_call(method());
1143     _caller = kit.transfer_exceptions_into_jvms();
1144     if (kit.stopped()) {
1145       _exits.add_exception_states_from(_caller);
1146       _exits.set_jvms(_caller);
1147       return NULL;
1148     }
1149   }
1150 
1151   assert(method() != NULL, "parser must have a method");
1152 
1153   // Create an initial safepoint to hold JVM state during parsing
1154   JVMState* jvms = new (C) JVMState(method(), _caller->has_method() ? _caller : NULL);
1155   set_map(new SafePointNode(len, jvms));
1156   jvms->set_map(map());
1157   record_for_igvn(map());
1158   assert(jvms->endoff() == len, "correct jvms sizing");
1159 
1160   SafePointNode* inmap = _caller->map();
1161   assert(inmap != NULL, "must have inmap");
1162   // In case of null check on receiver above
1163   map()->transfer_replaced_nodes_from(inmap, _new_idx);
1164 
1165   uint i;
1166 
1167   // Pass thru the predefined input parameters.
1168   for (i = 0; i < TypeFunc::Parms; i++) {
1169     map()->init_req(i, inmap->in(i));
1170   }
1171 
1172   if (depth() == 1) {
1173     assert(map()->memory()->Opcode() == Op_Parm, "");
1174     // Insert the memory aliasing node
1175     set_all_memory(reset_memory());
1176   }
1177   assert(merged_memory(), "");
1178 
1179   // Now add the locals which are initially bound to arguments:
1180   uint arg_size = tf()->domain()->cnt();
1181   ensure_stack(arg_size - TypeFunc::Parms);  // OSR methods have funny args
1182   for (i = TypeFunc::Parms; i < arg_size; i++) {
1183     map()->init_req(i, inmap->argument(_caller, i - TypeFunc::Parms));
1184   }
1185 
1186   // Clear out the rest of the map (locals and stack)
1187   for (i = arg_size; i < len; i++) {
1188     map()->init_req(i, top());
1189   }
1190 
1191   SafePointNode* entry_map = stop();
1192   return entry_map;
1193 }
1194 
1195 //-----------------------------do_method_entry--------------------------------
1196 // Emit any code needed in the pseudo-block before BCI zero.
1197 // The main thing to do is lock the receiver of a synchronized method.
1198 void Parse::do_method_entry() {
1199   set_parse_bci(InvocationEntryBci); // Pseudo-BCP
1200   set_sp(0);                         // Java Stack Pointer


1619 //--------------------handle_missing_successor---------------------------------
1620 void Parse::handle_missing_successor(int target_bci) {
1621 #ifndef PRODUCT
1622   Block* b = block();
1623   int trap_bci = b->flow()->has_trap()? b->flow()->trap_bci(): -1;
1624   tty->print_cr("### Missing successor at bci:%d for block #%d (trap_bci:%d)", target_bci, b->rpo(), trap_bci);
1625 #endif
1626   ShouldNotReachHere();
1627 }
1628 
1629 //--------------------------merge_common---------------------------------------
1630 void Parse::merge_common(Parse::Block* target, int pnum) {
1631   if (TraceOptoParse) {
1632     tty->print("Merging state at block #%d bci:%d", target->rpo(), target->start());
1633   }
1634 
1635   // Zap extra stack slots to top
1636   assert(sp() == target->start_sp(), "");
1637   clean_stack(sp());
1638 

































1639   if (!target->is_merged()) {   // No prior mapping at this bci
1640     if (TraceOptoParse) { tty->print(" with empty state");  }
1641 
1642     // If this path is dead, do not bother capturing it as a merge.
1643     // It is "as if" we had 1 fewer predecessors from the beginning.
1644     if (stopped()) {
1645       if (TraceOptoParse)  tty->print_cr(", but path is dead and doesn't count");
1646       return;
1647     }
1648 
1649     // Make a region if we know there are multiple or unpredictable inputs.
1650     // (Also, if this is a plain fall-through, we might see another region,
1651     // which must not be allowed into this block's map.)
1652     if (pnum > PhiNode::Input         // Known multiple inputs.
1653         || target->is_handler()       // These have unpredictable inputs.
1654         || target->is_loop_head()     // Known multiple inputs
1655         || control()->is_Region()) {  // We must hide this guy.
1656 
1657       int current_bci = bci();
1658       set_parse_bci(target->start()); // Set target bci


1672       gvn().set_type(r, Type::CONTROL);
1673       record_for_igvn(r);
1674       // zap all inputs to NULL for debugging (done in Node(uint) constructor)
1675       // for (int j = 1; j < edges+1; j++) { r->init_req(j, NULL); }
1676       r->init_req(pnum, control());
1677       set_control(r);
1678       set_parse_bci(current_bci); // Restore bci
1679     }
1680 
1681     // Convert the existing Parser mapping into a mapping at this bci.
1682     store_state_to(target);
1683     assert(target->is_merged(), "do not come here twice");
1684 
1685   } else {                      // Prior mapping at this bci
1686     if (TraceOptoParse) {  tty->print(" with previous state"); }
1687 #ifdef ASSERT
1688     if (target->is_SEL_head()) {
1689       target->mark_merged_backedge(block());
1690     }
1691 #endif

1692     // We must not manufacture more phis if the target is already parsed.
1693     bool nophi = target->is_parsed();
1694 
1695     SafePointNode* newin = map();// Hang on to incoming mapping
1696     Block* save_block = block(); // Hang on to incoming block;
1697     load_state_from(target);    // Get prior mapping
1698 
1699     assert(newin->jvms()->locoff() == jvms()->locoff(), "JVMS layouts agree");
1700     assert(newin->jvms()->stkoff() == jvms()->stkoff(), "JVMS layouts agree");
1701     assert(newin->jvms()->monoff() == jvms()->monoff(), "JVMS layouts agree");
1702     assert(newin->jvms()->endoff() == jvms()->endoff(), "JVMS layouts agree");
1703 
1704     // Iterate over my current mapping and the old mapping.
1705     // Where different, insert Phi functions.
1706     // Use any existing Phi functions.
1707     assert(control()->is_Region(), "must be merging to a region");
1708     RegionNode* r = control()->as_Region();
1709 
1710     // Compute where to merge into
1711     // Merge incoming control path
1712     r->init_req(pnum, newin->control());
1713 
1714     if (pnum == 1) {            // Last merge for this Region?
1715       if (!block()->flow()->is_irreducible_entry()) {
1716         Node* result = _gvn.transform_no_reclaim(r);
1717         if (r != result && TraceOptoParse) {
1718           tty->print_cr("Block #%d replace %d with %d", block()->rpo(), r->_idx, result->_idx);
1719         }
1720       }
1721       record_for_igvn(r);
1722     }
1723 
1724     // Update all the non-control inputs to map:
1725     assert(TypeFunc::Parms == newin->jvms()->locoff(), "parser map should contain only youngest jvms");
1726     bool check_elide_phi = target->is_SEL_backedge(save_block);

1727     for (uint j = 1; j < newin->req(); j++) {
1728       Node* m = map()->in(j);   // Current state of target.
1729       Node* n = newin->in(j);   // Incoming change to target state.
1730       PhiNode* phi;
1731       if (m->is_Phi() && m->as_Phi()->region() == r)
1732         phi = m->as_Phi();
1733       else


1734         phi = NULL;

1735       if (m != n) {             // Different; must merge
1736         switch (j) {
1737         // Frame pointer and Return Address never changes
1738         case TypeFunc::FramePtr:// Drop m, use the original value
1739         case TypeFunc::ReturnAdr:
1740           break;
1741         case TypeFunc::Memory:  // Merge inputs to the MergeMem node
1742           assert(phi == NULL, "the merge contains phis, not vice versa");
1743           merge_memory_edges(n->as_MergeMem(), pnum, nophi);
1744           continue;
1745         default:                // All normal stuff
1746           if (phi == NULL) {
1747             const JVMState* jvms = map()->jvms();
1748             if (EliminateNestedLocks &&
1749                 jvms->is_mon(j) && jvms->is_monitor_box(j)) {
1750               // BoxLock nodes are not commoning.
1751               // Use old BoxLock node as merged box.
1752               assert(newin->jvms()->is_monitor_box(j), "sanity");
1753               // This assert also tests that nodes are BoxLock.
1754               assert(BoxLockNode::same_slot(n, m), "sanity");
1755               C->gvn_replace_by(n, m);
1756             } else if (!check_elide_phi || !target->can_elide_SEL_phi(j)) {
1757               phi = ensure_phi(j, nophi);
1758             }
1759           }
1760           break;
1761         }
1762       }
1763       // At this point, n might be top if:
1764       //  - there is no phi (because TypeFlow detected a conflict), or
1765       //  - the corresponding control edges is top (a dead incoming path)
1766       // It is a bug if we create a phi which sees a garbage value on a live path.
1767 
1768       if (phi != NULL) {























1769         assert(n != top() || r->in(pnum) == top(), "live value must not be garbage");
1770         assert(phi->region() == r, "");
1771         phi->set_req(pnum, n);  // Then add 'n' to the merge
1772         if (pnum == PhiNode::Input) {
1773           // Last merge for this Phi.
1774           // So far, Phis have had a reasonable type from ciTypeFlow.
1775           // Now _gvn will join that with the meet of current inputs.
1776           // BOTTOM is never permissible here, 'cause pessimistically
1777           // Phis of pointers cannot lose the basic pointer type.
1778           debug_only(const Type* bt1 = phi->bottom_type());
1779           assert(bt1 != Type::BOTTOM, "should not be building conflict phis");
1780           map()->set_req(j, _gvn.transform_no_reclaim(phi));
1781           debug_only(const Type* bt2 = phi->bottom_type());
1782           assert(bt2->higher_equal_speculative(bt1), "must be consistent with type-flow");
1783           record_for_igvn(phi);
1784         }
1785       }
1786     } // End of for all values to be merged
1787 
1788     if (pnum == PhiNode::Input &&
1789         !r->in(0)) {         // The occasional useless Region
1790       assert(control() == r, "");
1791       set_control(r->nonnull_req());
1792     }
1793 
1794     map()->merge_replaced_nodes_with(newin);
1795 
1796     // newin has been subsumed into the lazy merge, and is now dead.
1797     set_block(save_block);
1798 
1799     stop();                     // done with this guy, for now
1800   }
1801 
1802   if (TraceOptoParse) {
1803     tty->print_cr(" on path %d", pnum);
1804   }
1805 
1806   // Done with this parser state.
1807   assert(stopped(), "");
1808 }
1809 


1921 
1922   // Add new path to the region.
1923   uint pnum = r->req();
1924   r->add_req(NULL);
1925 
1926   for (uint i = 1; i < map->req(); i++) {
1927     Node* n = map->in(i);
1928     if (i == TypeFunc::Memory) {
1929       // Ensure a phi on all currently known memories.
1930       for (MergeMemStream mms(n->as_MergeMem()); mms.next_non_empty(); ) {
1931         Node* phi = mms.memory();
1932         if (phi->is_Phi() && phi->as_Phi()->region() == r) {
1933           assert(phi->req() == pnum, "must be same size as region");
1934           phi->add_req(NULL);
1935         }
1936       }
1937     } else {
1938       if (n->is_Phi() && n->as_Phi()->region() == r) {
1939         assert(n->req() == pnum, "must be same size as region");
1940         n->add_req(NULL);


1941       }
1942     }
1943   }
1944 
1945   return pnum;
1946 }
1947 
1948 //------------------------------ensure_phi-------------------------------------
1949 // Turn the idx'th entry of the current map into a Phi
1950 PhiNode *Parse::ensure_phi(int idx, bool nocreate) {
1951   SafePointNode* map = this->map();
1952   Node* region = map->control();
1953   assert(region->is_Region(), "");
1954 
1955   Node* o = map->in(idx);
1956   assert(o != NULL, "");
1957 
1958   if (o == top())  return NULL; // TOP always merges into TOP
1959 
1960   if (o->is_Phi() && o->as_Phi()->region() == region) {
1961     return o->as_Phi();
1962   }




1963 
1964   // Now use a Phi here for merging
1965   assert(!nocreate, "Cannot build a phi for a block already parsed.");
1966   const JVMState* jvms = map->jvms();
1967   const Type* t = NULL;
1968   if (jvms->is_loc(idx)) {
1969     t = block()->local_type_at(idx - jvms->locoff());
1970   } else if (jvms->is_stk(idx)) {
1971     t = block()->stack_type_at(idx - jvms->stkoff());
1972   } else if (jvms->is_mon(idx)) {
1973     assert(!jvms->is_monitor_box(idx), "no phis for boxes");
1974     t = TypeInstPtr::BOTTOM; // this is sufficient for a lock object
1975   } else if ((uint)idx < TypeFunc::Parms) {
1976     t = o->bottom_type();  // Type::RETURN_ADDRESS or such-like.
1977   } else {
1978     assert(false, "no type information for this phi");
1979   }
1980 
1981   // If the type falls to bottom, then this must be a local that
1982   // is mixing ints and oops or some such.  Forcing it to top
1983   // makes it go dead.
1984   if (t == Type::BOTTOM) {
1985     map->set_req(idx, top());
1986     return NULL;
1987   }
1988 
1989   // Do not create phis for top either.
1990   // A top on a non-null control flow must be an unused even after the.phi.
1991   if (t == Type::TOP || t == Type::HALF) {
1992     map->set_req(idx, top());
1993     return NULL;
1994   }
1995 
1996   PhiNode* phi = PhiNode::make(region, o, t);
1997   gvn().set_type(phi, t);
1998   if (C->do_escape_analysis()) record_for_igvn(phi);
1999   map->set_req(idx, phi);
2000   return phi;









2001 }
2002 
2003 //--------------------------ensure_memory_phi----------------------------------
2004 // Turn the idx'th slice of the current memory into a Phi
2005 PhiNode *Parse::ensure_memory_phi(int idx, bool nocreate) {
2006   MergeMemNode* mem = merged_memory();
2007   Node* region = control();
2008   assert(region->is_Region(), "");
2009 
2010   Node *o = (idx == Compile::AliasIdxBot)? mem->base_memory(): mem->memory_at(idx);
2011   assert(o != NULL && o != top(), "");
2012 
2013   PhiNode* phi;
2014   if (o->is_Phi() && o->as_Phi()->region() == region) {
2015     phi = o->as_Phi();
2016     if (phi == mem->base_memory() && idx >= Compile::AliasIdxRaw) {
2017       // clone the shared base memory phi to make a new memory split
2018       assert(!nocreate, "Cannot build a phi for a block already parsed.");
2019       const Type* t = phi->bottom_type();
2020       const TypePtr* adr_type = C->get_adr_type(idx);


2173   Node* cnt = make_load(control(), cnt_adr, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
2174   Node* decr = _gvn.transform(new SubINode(cnt, makecon(TypeInt::ONE)));
2175   store_to_memory(control(), cnt_adr, decr, T_INT, adr_type, MemNode::unordered);
2176   Node *chk   = _gvn.transform(new CmpINode(decr, makecon(TypeInt::ZERO)));
2177   Node* tst   = _gvn.transform(new BoolNode(chk, BoolTest::gt));
2178   { BuildCutout unless(this, tst, PROB_ALWAYS);
2179     uncommon_trap(Deoptimization::Reason_tenured,
2180                   Deoptimization::Action_make_not_entrant);
2181   }
2182 }
2183 
2184 //------------------------------return_current---------------------------------
2185 // Append current _map to _exit_return
2186 void Parse::return_current(Node* value) {
2187   if (RegisterFinalizersAtInit &&
2188       method()->intrinsic_id() == vmIntrinsics::_Object_init) {
2189     call_register_finalizer();
2190   }
2191 
2192   // Do not set_parse_bci, so that return goo is credited to the return insn.
2193   set_bci(InvocationEntryBci);



2194   if (method()->is_synchronized() && GenerateSynchronizationCode) {
2195     shared_unlock(_synch_lock->box_node(), _synch_lock->obj_node());
2196   }
2197   if (C->env()->dtrace_method_probes()) {
2198     make_dtrace_method_exit(method());
2199   }
2200   SafePointNode* exit_return = _exits.map();
2201   exit_return->in( TypeFunc::Control  )->add_req( control() );
2202   exit_return->in( TypeFunc::I_O      )->add_req( i_o    () );
2203   Node *mem = exit_return->in( TypeFunc::Memory   );
2204   for (MergeMemStream mms(mem->as_MergeMem(), merged_memory()); mms.next_non_empty2(); ) {
2205     if (mms.is_empty()) {
2206       // get a copy of the base memory, and patch just this one input
2207       const TypePtr* adr_type = mms.adr_type(C);
2208       Node* phi = mms.force_memory()->as_Phi()->slice_memory(adr_type);
2209       assert(phi->as_Phi()->region() == mms.base_memory()->in(0), "");
2210       gvn().set_type_bottom(phi);
2211       phi->del_req(phi->req()-1);  // prepare to re-patch
2212       mms.set_memory(phi);
2213     }
2214     mms.memory()->add_req(mms.memory2());
2215   }
2216 
2217   // frame pointer is always same, already captured
2218   if (value != NULL) {
2219     // If returning oops to an interface-return, there is a silent free
2220     // cast from oop to interface allowed by the Verifier.  Make it explicit
2221     // here.
2222     Node* phi = _exits.argument(0);
2223     const TypeInstPtr *tr = phi->bottom_type()->isa_instptr();
2224     if (tr && tr->klass()->is_loaded() &&
2225         tr->klass()->is_interface()) {
2226       const TypeInstPtr *tp = value->bottom_type()->isa_instptr();
2227       if (tp && tp->klass()->is_loaded() &&
2228           !tp->klass()->is_interface()) {
















2229         // sharpen the type eagerly; this eases certain assert checking
2230         if (tp->higher_equal(TypeInstPtr::NOTNULL))
2231           tr = tr->join_speculative(TypeInstPtr::NOTNULL)->is_instptr();

2232         value = _gvn.transform(new CheckCastPPNode(0, value, tr));
2233       }
2234     } else {
2235       // Also handle returns of oop-arrays to an arrays-of-interface return
2236       const TypeInstPtr* phi_tip;
2237       const TypeInstPtr* val_tip;
2238       Type::get_arrays_base_elements(phi->bottom_type(), value->bottom_type(), &phi_tip, &val_tip);
2239       if (phi_tip != NULL && phi_tip->is_loaded() && phi_tip->klass()->is_interface() &&
2240           val_tip != NULL && val_tip->is_loaded() && !val_tip->klass()->is_interface()) {
2241         value = _gvn.transform(new CheckCastPPNode(0, value, phi->bottom_type()));
2242       }
2243     }
2244     phi->add_req(value);

















2245   }
2246 
2247   if (_first_return) {
2248     _exits.map()->transfer_replaced_nodes_from(map(), _new_idx);
2249     _first_return = false;
2250   } else {
2251     _exits.map()->merge_replaced_nodes_with(map());
2252   }
2253 
2254   stop_and_kill_map();          // This CFG path dies here
2255 }
2256 
2257 
2258 //------------------------------add_safepoint----------------------------------
2259 void Parse::add_safepoint() {
2260   // See if we can avoid this safepoint.  No need for a SafePoint immediately
2261   // after a Call (except Leaf Call) or another SafePoint.
2262   Node *proj = control();
2263   bool add_poll_param = SafePointNode::needs_polling_address_input();
2264   uint parms = add_poll_param ? TypeFunc::Parms+1 : TypeFunc::Parms;




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "compiler/compileLog.hpp"
  27 #include "interpreter/linkResolver.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "oops/method.hpp"
  30 #include "opto/addnode.hpp"
  31 #include "opto/c2compiler.hpp"
  32 #include "opto/castnode.hpp"
  33 #include "opto/idealGraphPrinter.hpp"
  34 #include "opto/locknode.hpp"
  35 #include "opto/memnode.hpp"
  36 #include "opto/opaquenode.hpp"
  37 #include "opto/parse.hpp"
  38 #include "opto/rootnode.hpp"
  39 #include "opto/runtime.hpp"
  40 #include "opto/valuetypenode.hpp"
  41 #include "runtime/arguments.hpp"
  42 #include "runtime/handles.inline.hpp"
  43 #include "runtime/safepointMechanism.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "utilities/copy.hpp"
  46 
  47 // Static array so we can figure out which bytecodes stop us from compiling
  48 // the most. Some of the non-static variables are needed in bytecodeInfo.cpp
  49 // and eventually should be encapsulated in a proper class (gri 8/18/98).
  50 
  51 #ifndef PRODUCT
  52 int nodes_created              = 0;
  53 int methods_parsed             = 0;
  54 int methods_seen               = 0;
  55 int blocks_parsed              = 0;
  56 int blocks_seen                = 0;
  57 
  58 int explicit_null_checks_inserted = 0;
  59 int explicit_null_checks_elided   = 0;
  60 int all_null_checks_found         = 0;


  85   }
  86   if (all_null_checks_found) {
  87     tty->print_cr("%d made implicit (%2d%%)", implicit_null_checks,
  88                   (100*implicit_null_checks)/all_null_checks_found);
  89   }
  90   if (SharedRuntime::_implicit_null_throws) {
  91     tty->print_cr("%d implicit null exceptions at runtime",
  92                   SharedRuntime::_implicit_null_throws);
  93   }
  94 
  95   if (PrintParseStatistics && BytecodeParseHistogram::initialized()) {
  96     BytecodeParseHistogram::print();
  97   }
  98 }
  99 #endif
 100 
 101 //------------------------------ON STACK REPLACEMENT---------------------------
 102 
 103 // Construct a node which can be used to get incoming state for
 104 // on stack replacement.
 105 Node* Parse::fetch_interpreter_state(int index,
 106                                      const Type* type,
 107                                      Node* local_addrs,
 108                                      Node* local_addrs_base) {
 109   BasicType bt = type->basic_type();
 110   if (type == TypePtr::NULL_PTR) {
 111     // Ptr types are mixed together with T_ADDRESS but NULL is
 112     // really for T_OBJECT types so correct it.
 113     bt = T_OBJECT;
 114   }
 115   Node *mem = memory(Compile::AliasIdxRaw);
 116   Node *adr = basic_plus_adr( local_addrs_base, local_addrs, -index*wordSize );
 117   Node *ctl = control();
 118 
 119   // Very similar to LoadNode::make, except we handle un-aligned longs and
 120   // doubles on Sparc.  Intel can handle them just fine directly.
 121   Node *l = NULL;
 122   switch (bt) {                // Signature is flattened
 123   case T_INT:     l = new LoadINode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInt::INT,        MemNode::unordered); break;
 124   case T_FLOAT:   l = new LoadFNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::FLOAT,         MemNode::unordered); break;
 125   case T_ADDRESS: l = new LoadPNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM,  MemNode::unordered); break;
 126   case T_VALUETYPE:
 127   case T_OBJECT:  l = new LoadPNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInstPtr::BOTTOM, MemNode::unordered); break;
 128   case T_LONG:
 129   case T_DOUBLE: {
 130     // Since arguments are in reverse order, the argument address 'adr'
 131     // refers to the back half of the long/double.  Recompute adr.
 132     adr = basic_plus_adr(local_addrs_base, local_addrs, -(index+1)*wordSize);
 133     if (Matcher::misaligned_doubles_ok) {
 134       l = (bt == T_DOUBLE)
 135         ? (Node*)new LoadDNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::DOUBLE, MemNode::unordered)
 136         : (Node*)new LoadLNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeLong::LONG, MemNode::unordered);
 137     } else {
 138       l = (bt == T_DOUBLE)
 139         ? (Node*)new LoadD_unalignedNode(ctl, mem, adr, TypeRawPtr::BOTTOM, MemNode::unordered)
 140         : (Node*)new LoadL_unalignedNode(ctl, mem, adr, TypeRawPtr::BOTTOM, MemNode::unordered);
 141     }
 142     break;
 143   }
 144   default: ShouldNotReachHere();
 145   }
 146   return _gvn.transform(l);
 147 }
 148 
 149 // Helper routine to prevent the interpreter from handing
 150 // unexpected typestate to an OSR method.
 151 // The Node l is a value newly dug out of the interpreter frame.
 152 // The type is the type predicted by ciTypeFlow.  Note that it is
 153 // not a general type, but can only come from Type::get_typeflow_type.
 154 // The safepoint is a map which will feed an uncommon trap.
 155 Node* Parse::check_interpreter_type(Node* l, const Type* type,
 156                                     SafePointNode* &bad_type_exit) {

 157   const TypeOopPtr* tp = type->isa_oopptr();
 158   if (type->isa_valuetype() != NULL) {
 159     // The interpreter passes value types as oops
 160     tp = TypeOopPtr::make_from_klass(type->value_klass());
 161     tp = tp->join_speculative(TypePtr::NOTNULL)->is_oopptr();
 162   }
 163 
 164   // TypeFlow may assert null-ness if a type appears unloaded.
 165   if (type == TypePtr::NULL_PTR ||
 166       (tp != NULL && !tp->klass()->is_loaded())) {
 167     // Value must be null, not a real oop.
 168     Node* chk = _gvn.transform( new CmpPNode(l, null()) );
 169     Node* tst = _gvn.transform( new BoolNode(chk, BoolTest::eq) );
 170     IfNode* iff = create_and_map_if(control(), tst, PROB_MAX, COUNT_UNKNOWN);
 171     set_control(_gvn.transform( new IfTrueNode(iff) ));
 172     Node* bad_type = _gvn.transform( new IfFalseNode(iff) );
 173     bad_type_exit->control()->add_req(bad_type);
 174     l = null();
 175   }
 176 
 177   // Typeflow can also cut off paths from the CFG, based on
 178   // types which appear unloaded, or call sites which appear unlinked.
 179   // When paths are cut off, values at later merge points can rise
 180   // toward more specific classes.  Make sure these specific classes
 181   // are still in effect.
 182   if (tp != NULL && tp->klass() != C->env()->Object_klass()) {
 183     // TypeFlow asserted a specific object type.  Value must have that type.
 184     Node* bad_type_ctrl = NULL;
 185     if (tp->is_valuetypeptr() && !tp->maybe_null()) {
 186       // Check value types for null here to prevent checkcast from adding an
 187       // exception state before the bytecode entry (use 'bad_type_ctrl' instead).
 188       l = null_check_oop(l, &bad_type_ctrl);
 189       bad_type_exit->control()->add_req(bad_type_ctrl);
 190     }
 191     l = gen_checkcast(l, makecon(TypeKlassPtr::make(tp->klass())), &bad_type_ctrl);
 192     bad_type_exit->control()->add_req(bad_type_ctrl);
 193   }



 194   assert(_gvn.type(l)->higher_equal(type), "must constrain OSR typestate");
 195   return l;
 196 }
 197 
 198 // Helper routine which sets up elements of the initial parser map when
 199 // performing a parse for on stack replacement.  Add values into map.
 200 // The only parameter contains the address of a interpreter arguments.
 201 void Parse::load_interpreter_state(Node* osr_buf) {
 202   int index;
 203   int max_locals = jvms()->loc_size();
 204   int max_stack  = jvms()->stk_size();
 205 

 206   // Mismatch between method and jvms can occur since map briefly held
 207   // an OSR entry state (which takes up one RawPtr word).
 208   assert(max_locals == method()->max_locals(), "sanity");
 209   assert(max_stack  >= method()->max_stack(),  "sanity");
 210   assert((int)jvms()->endoff() == TypeFunc::Parms + max_locals + max_stack, "sanity");
 211   assert((int)jvms()->endoff() == (int)map()->req(), "sanity");
 212 
 213   // Find the start block.
 214   Block* osr_block = start_block();
 215   assert(osr_block->start() == osr_bci(), "sanity");
 216 
 217   // Set initial BCI.
 218   set_parse_bci(osr_block->start());
 219 
 220   // Set initial stack depth.
 221   set_sp(osr_block->start_sp());
 222 
 223   // Check bailouts.  We currently do not perform on stack replacement
 224   // of loops in catch blocks or loops which branch with a non-empty stack.
 225   if (sp() != 0) {
 226     C->record_method_not_compilable("OSR starts with non-empty stack");
 227     return;
 228   }
 229   // Do not OSR inside finally clauses:
 230   if (osr_block->has_trap_at(osr_block->start())) {
 231     C->record_method_not_compilable("OSR starts with an immediate trap");
 232     return;
 233   }
 234 
 235   // Commute monitors from interpreter frame to compiler frame.
 236   assert(jvms()->monitor_depth() == 0, "should be no active locks at beginning of osr");
 237   int mcnt = osr_block->flow()->monitor_count();
 238   Node *monitors_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals+mcnt*2-1)*wordSize);
 239   for (index = 0; index < mcnt; index++) {
 240     // Make a BoxLockNode for the monitor.
 241     Node *box = _gvn.transform(new BoxLockNode(next_monitor()));
 242 

 243     // Displaced headers and locked objects are interleaved in the
 244     // temp OSR buffer.  We only copy the locked objects out here.
 245     // Fetch the locked object from the OSR temp buffer and copy to our fastlock node.
 246     Node* lock_object = fetch_interpreter_state(index*2, Type::get_const_basic_type(T_OBJECT), monitors_addr, osr_buf);
 247     // Try and copy the displaced header to the BoxNode
 248     Node* displaced_hdr = fetch_interpreter_state((index*2) + 1, Type::get_const_basic_type(T_ADDRESS), monitors_addr, osr_buf);

 249 
 250     store_to_memory(control(), box, displaced_hdr, T_ADDRESS, Compile::AliasIdxRaw, MemNode::unordered);
 251 
 252     // Build a bogus FastLockNode (no code will be generated) and push the
 253     // monitor into our debug info.
 254     const FastLockNode *flock = _gvn.transform(new FastLockNode( 0, lock_object, box ))->as_FastLock();
 255     map()->push_monitor(flock);
 256 
 257     // If the lock is our method synchronization lock, tuck it away in
 258     // _sync_lock for return and rethrow exit paths.
 259     if (index == 0 && method()->is_synchronized()) {
 260       _synch_lock = flock;
 261     }
 262   }
 263 
 264   // Use the raw liveness computation to make sure that unexpected
 265   // values don't propagate into the OSR frame.
 266   MethodLivenessResult live_locals = method()->liveness_at_bci(osr_bci());
 267   if (!live_locals.is_valid()) {
 268     // Degenerate or breakpointed method.


 295         if (C->log() != NULL) {
 296           C->log()->elem("OSR_mismatch local_index='%d'",index);
 297         }
 298         set_local(index, null());
 299         // and ignore it for the loads
 300         continue;
 301       }
 302     }
 303 
 304     // Filter out TOP, HALF, and BOTTOM.  (Cf. ensure_phi.)
 305     if (type == Type::TOP || type == Type::HALF) {
 306       continue;
 307     }
 308     // If the type falls to bottom, then this must be a local that
 309     // is mixing ints and oops or some such.  Forcing it to top
 310     // makes it go dead.
 311     if (type == Type::BOTTOM) {
 312       continue;
 313     }
 314     // Construct code to access the appropriate local.
 315     Node* value = fetch_interpreter_state(index, type, locals_addr, osr_buf);






 316     set_local(index, value);
 317   }
 318 
 319   // Extract the needed stack entries from the interpreter frame.
 320   for (index = 0; index < sp(); index++) {
 321     const Type *type = osr_block->stack_type_at(index);
 322     if (type != Type::TOP) {
 323       // Currently the compiler bails out when attempting to on stack replace
 324       // at a bci with a non-empty stack.  We should not reach here.
 325       ShouldNotReachHere();
 326     }
 327   }
 328 
 329   // End the OSR migration
 330   make_runtime_call(RC_LEAF, OptoRuntime::osr_end_Type(),
 331                     CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end),
 332                     "OSR_migration_end", TypeRawPtr::BOTTOM,
 333                     osr_buf);
 334 
 335   // Now that the interpreter state is loaded, make sure it will match


 589     }
 590   }
 591 
 592   if (depth() == 1 && !failing()) {
 593     if (C->clinit_barrier_on_entry()) {
 594       // Add check to deoptimize the nmethod once the holder class is fully initialized
 595       clinit_deopt();
 596     }
 597 
 598     // Add check to deoptimize the nmethod if RTM state was changed
 599     rtm_deopt();
 600   }
 601 
 602   // Check for bailouts during method entry or RTM state check setup.
 603   if (failing()) {
 604     if (log)  log->done("parse");
 605     C->set_default_node_notes(caller_nn);
 606     return;
 607   }
 608 
 609   // Handle value type arguments
 610   int arg_size_sig = tf()->domain_sig()->cnt();
 611   for (uint i = 0; i < (uint)arg_size_sig; i++) {
 612     Node* parm = map()->in(i);
 613     const Type* t = _gvn.type(parm);
 614     if (t->is_valuetypeptr() && t->value_klass()->is_scalarizable() && !t->maybe_null()) {
 615       // Create ValueTypeNode from the oop and replace the parameter
 616       Node* vt = ValueTypeNode::make_from_oop(this, parm, t->value_klass());
 617       map()->replace_edge(parm, vt);
 618     } else if (i == (uint)(arg_size_sig - 1) && !is_osr_parse() && method()->has_vararg() &&
 619                t->isa_aryptr() != NULL && !t->is_aryptr()->is_not_null_free()) {
 620       // Speculate on varargs Object array being not null-free (and therefore also not flattened)
 621       const TypePtr* spec_type = t->speculative();
 622       spec_type = (spec_type != NULL && spec_type->isa_aryptr() != NULL) ? spec_type : t->is_aryptr();
 623       spec_type = spec_type->remove_speculative()->is_aryptr()->cast_to_not_null_free();
 624       spec_type = TypeOopPtr::make(TypePtr::BotPTR, Type::Offset::bottom, TypeOopPtr::InstanceBot, spec_type);
 625       Node* cast = _gvn.transform(new CheckCastPPNode(control(), parm, t->join_speculative(spec_type)));
 626       replace_in_map(parm, cast);
 627     }
 628   }
 629 
 630   entry_map = map();  // capture any changes performed by method setup code
 631   assert(jvms()->endoff() == map()->req(), "map matches JVMS layout");
 632 
 633   // We begin parsing as if we have just encountered a jump to the
 634   // method entry.
 635   Block* entry_block = start_block();
 636   assert(entry_block->start() == (is_osr_parse() ? osr_bci() : 0), "");
 637   set_map_clone(entry_map);
 638   merge_common(entry_block, entry_block->next_path_num());
 639 
 640 #ifndef PRODUCT
 641   BytecodeParseHistogram *parse_histogram_obj = new (C->env()->arena()) BytecodeParseHistogram(this, C);
 642   set_parse_histogram( parse_histogram_obj );
 643 #endif
 644 
 645   // Parse all the basic blocks.
 646   do_all_blocks();
 647 
 648   C->set_default_node_notes(caller_nn);
 649 


 792 void Parse::build_exits() {
 793   // make a clone of caller to prevent sharing of side-effects
 794   _exits.set_map(_exits.clone_map());
 795   _exits.clean_stack(_exits.sp());
 796   _exits.sync_jvms();
 797 
 798   RegionNode* region = new RegionNode(1);
 799   record_for_igvn(region);
 800   gvn().set_type_bottom(region);
 801   _exits.set_control(region);
 802 
 803   // Note:  iophi and memphi are not transformed until do_exits.
 804   Node* iophi  = new PhiNode(region, Type::ABIO);
 805   Node* memphi = new PhiNode(region, Type::MEMORY, TypePtr::BOTTOM);
 806   gvn().set_type_bottom(iophi);
 807   gvn().set_type_bottom(memphi);
 808   _exits.set_i_o(iophi);
 809   _exits.set_all_memory(memphi);
 810 
 811   // Add a return value to the exit state.  (Do not push it yet.)
 812   if (tf()->range_sig()->cnt() > TypeFunc::Parms) {
 813     const Type* ret_type = tf()->range_sig()->field_at(TypeFunc::Parms);
 814     if (ret_type->isa_int()) {
 815       BasicType ret_bt = method()->return_type()->basic_type();
 816       if (ret_bt == T_BOOLEAN ||
 817           ret_bt == T_CHAR ||
 818           ret_bt == T_BYTE ||
 819           ret_bt == T_SHORT) {
 820         ret_type = TypeInt::INT;
 821       }
 822     }
 823 
 824     // Don't "bind" an unloaded return klass to the ret_phi. If the klass
 825     // becomes loaded during the subsequent parsing, the loaded and unloaded
 826     // types will not join when we transform and push in do_exits().
 827     const TypeOopPtr* ret_oop_type = ret_type->isa_oopptr();
 828     if (ret_oop_type && !ret_oop_type->klass()->is_loaded()) {
 829       ret_type = TypeOopPtr::BOTTOM;
 830     }
 831     if ((_caller->has_method() || tf()->returns_value_type_as_fields()) &&
 832         ret_type->is_valuetypeptr() && ret_type->value_klass()->is_scalarizable() && !ret_type->maybe_null()) {
 833       // Scalarize value type return when inlining or with multiple return values
 834       ret_type = TypeValueType::make(ret_type->value_klass());
 835     }
 836     int         ret_size = type2size[ret_type->basic_type()];
 837     Node*       ret_phi  = new PhiNode(region, ret_type);
 838     gvn().set_type_bottom(ret_phi);
 839     _exits.ensure_stack(ret_size);
 840     assert((int)(tf()->range_sig()->cnt() - TypeFunc::Parms) == ret_size, "good tf range");
 841     assert(method()->return_type()->size() == ret_size, "tf agrees w/ method");
 842     _exits.set_argument(0, ret_phi);  // here is where the parser finds it
 843     // Note:  ret_phi is not yet pushed, until do_exits.
 844   }
 845 }
 846 

 847 //----------------------------build_start_state-------------------------------
 848 // Construct a state which contains only the incoming arguments from an
 849 // unknown caller.  The method & bci will be NULL & InvocationEntryBci.
 850 JVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) {
 851   int        arg_size = tf->domain_sig()->cnt();
 852   int        max_size = MAX2(arg_size, (int)tf->range_cc()->cnt());
 853   JVMState*  jvms     = new (this) JVMState(max_size - TypeFunc::Parms);
 854   SafePointNode* map  = new SafePointNode(max_size, NULL);
 855   map->set_jvms(jvms);
 856   jvms->set_map(map);
 857   record_for_igvn(map);
 858   assert(arg_size == TypeFunc::Parms + (is_osr_compilation() ? 1 : method()->arg_size()), "correct arg_size");
 859   Node_Notes* old_nn = default_node_notes();
 860   if (old_nn != NULL && has_method()) {
 861     Node_Notes* entry_nn = old_nn->clone(this);
 862     JVMState* entry_jvms = new(this) JVMState(method(), old_nn->jvms());
 863     entry_jvms->set_offsets(0);
 864     entry_jvms->set_bci(entry_bci());
 865     entry_nn->set_jvms(entry_jvms);
 866     set_default_node_notes(entry_nn);
 867   }
 868   PhaseGVN& gvn = *initial_gvn();
 869   uint j = 0;
 870   ExtendedSignature sig_cc = ExtendedSignature(method()->get_sig_cc(), SigEntryFilter());
 871   for (uint i = 0; i < (uint)arg_size; i++) {
 872     const Type* t = tf->domain_sig()->field_at(i);
 873     Node* parm = NULL;
 874     if (has_scalarized_args() && t->is_valuetypeptr() && !t->maybe_null()) {
 875       // Value type arguments are not passed by reference: we get an argument per
 876       // field of the value type. Build ValueTypeNodes from the value type arguments.
 877       GraphKit kit(jvms, &gvn);
 878       kit.set_control(map->control());
 879       Node* old_mem = map->memory();
 880       // Use immutable memory for value type loads and restore it below
 881       // TODO make sure value types are always loaded from immutable memory
 882       kit.set_all_memory(C->immutable_memory());
 883       parm = ValueTypeNode::make_from_multi(&kit, start, sig_cc, t->value_klass(), j, true);
 884       map->set_control(kit.control());
 885       map->set_memory(old_mem);
 886     } else {
 887       parm = gvn.transform(new ParmNode(start, j++));
 888       BasicType bt = t->basic_type();
 889       while (i >= TypeFunc::Parms && !is_osr_compilation() && SigEntry::next_is_reserved(sig_cc, bt, true)) {
 890         j += type2size[bt]; // Skip reserved arguments
 891       }
 892     }
 893     map->init_req(i, parm);
 894     // Record all these guys for later GVN.
 895     record_for_igvn(parm);
 896   }
 897   for (; j < map->req(); j++) {
 898     map->init_req(j, top());
 899   }
 900   assert(jvms->argoff() == TypeFunc::Parms, "parser gets arguments here");
 901   set_default_node_notes(old_nn);


 902   return jvms;
 903 }
 904 
 905 //-----------------------------make_node_notes---------------------------------
 906 Node_Notes* Parse::make_node_notes(Node_Notes* caller_nn) {
 907   if (caller_nn == NULL)  return NULL;
 908   Node_Notes* nn = caller_nn->clone(C);
 909   JVMState* caller_jvms = nn->jvms();
 910   JVMState* jvms = new (C) JVMState(method(), caller_jvms);
 911   jvms->set_offsets(0);
 912   jvms->set_bci(_entry_bci);
 913   nn->set_jvms(jvms);
 914   return nn;
 915 }
 916 
 917 
 918 //--------------------------return_values--------------------------------------
 919 void Compile::return_values(JVMState* jvms) {
 920   GraphKit kit(jvms);
 921   Node* ret = new ReturnNode(TypeFunc::Parms,
 922                              kit.control(),
 923                              kit.i_o(),
 924                              kit.reset_memory(),
 925                              kit.frameptr(),
 926                              kit.returnadr());
 927   // Add zero or 1 return values
 928   int ret_size = tf()->range_sig()->cnt() - TypeFunc::Parms;
 929   if (ret_size > 0) {
 930     kit.inc_sp(-ret_size);  // pop the return value(s)
 931     kit.sync_jvms();
 932     Node* res = kit.argument(0);
 933     if (tf()->returns_value_type_as_fields()) {
 934       // Multiple return values (value type fields): add as many edges
 935       // to the Return node as returned values.
 936       assert(res->is_ValueType(), "what else supports multi value return?");
 937       ValueTypeNode* vt = res->as_ValueType();
 938       ret->add_req_batch(NULL, tf()->range_cc()->cnt() - TypeFunc::Parms);
 939       if (vt->is_allocated(&kit.gvn()) && !StressValueTypeReturnedAsFields) {
 940         ret->init_req(TypeFunc::Parms, vt->get_oop());
 941       } else {
 942         ret->init_req(TypeFunc::Parms, vt->tagged_klass(kit.gvn()));
 943       }
 944       const Array<SigEntry>* sig_array = vt->type()->value_klass()->extended_sig();
 945       GrowableArray<SigEntry> sig = GrowableArray<SigEntry>(sig_array->length());
 946       sig.appendAll(sig_array);
 947       ExtendedSignature sig_cc = ExtendedSignature(&sig, SigEntryFilter());
 948       uint idx = TypeFunc::Parms+1;
 949       vt->pass_fields(&kit, ret, sig_cc, idx);
 950     } else {
 951       ret->add_req(res);
 952       // Note:  The second dummy edge is not needed by a ReturnNode.
 953     }
 954   }
 955   // bind it to root
 956   root()->add_req(ret);
 957   record_for_igvn(ret);
 958   initial_gvn()->transform_no_reclaim(ret);
 959 }
 960 
 961 //------------------------rethrow_exceptions-----------------------------------
 962 // Bind all exception states in the list into a single RethrowNode.
 963 void Compile::rethrow_exceptions(JVMState* jvms) {
 964   GraphKit kit(jvms);
 965   if (!kit.has_exceptions())  return;  // nothing to generate
 966   // Load my combined exception state into the kit, with all phis transformed:
 967   SafePointNode* ex_map = kit.combine_and_pop_all_exception_states();
 968   Node* ex_oop = kit.use_exception_state(ex_map);
 969   RethrowNode* exit = new RethrowNode(kit.control(),
 970                                       kit.i_o(), kit.reset_memory(),
 971                                       kit.frameptr(), kit.returnadr(),
 972                                       // like a return but with exception input
 973                                       ex_oop);


1054   //    publishes the reference to the newly constructed object. Rather
1055   //    than wait for the publication, we simply block the writes here.
1056   //    Rather than put a barrier on only those writes which are required
1057   //    to complete, we force all writes to complete.
1058   //
1059   // 2. On PPC64, also add MemBarRelease for constructors which write
1060   //    volatile fields. As support_IRIW_for_not_multiple_copy_atomic_cpu
1061   //    is set on PPC64, no sync instruction is issued after volatile
1062   //    stores. We want to guarantee the same behavior as on platforms
1063   //    with total store order, although this is not required by the Java
1064   //    memory model. So as with finals, we add a barrier here.
1065   //
1066   // 3. Experimental VM option is used to force the barrier if any field
1067   //    was written out in the constructor.
1068   //
1069   // "All bets are off" unless the first publication occurs after a
1070   // normal return from the constructor.  We do not attempt to detect
1071   // such unusual early publications.  But no barrier is needed on
1072   // exceptional returns, since they cannot publish normally.
1073   //
1074   if (method()->is_object_constructor_or_class_initializer() &&
1075         (wrote_final() ||
1076            PPC64_ONLY(wrote_volatile() ||)
1077            (AlwaysSafeConstructors && wrote_fields()))) {
1078     _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
1079 
1080     // If Memory barrier is created for final fields write
1081     // and allocation node does not escape the initialize method,
1082     // then barrier introduced by allocation node can be removed.
1083     if (DoEscapeAnalysis && alloc_with_final()) {
1084       AllocateNode *alloc = AllocateNode::Ideal_allocation(alloc_with_final(), &_gvn);
1085       alloc->compute_MemBar_redundancy(method());
1086     }
1087     if (PrintOpto && (Verbose || WizardMode)) {
1088       method()->print_name();
1089       tty->print_cr(" writes finals and needs a memory barrier");
1090     }
1091   }
1092 
1093   // Any method can write a @Stable field; insert memory barriers
1094   // after those also. Can't bind predecessor allocation node (if any)
1095   // with barrier because allocation doesn't always dominate
1096   // MemBarRelease.
1097   if (wrote_stable()) {
1098     _exits.insert_mem_bar(Op_MemBarRelease);
1099     if (PrintOpto && (Verbose || WizardMode)) {
1100       method()->print_name();
1101       tty->print_cr(" writes @Stable and needs a memory barrier");
1102     }
1103   }
1104 
1105   for (MergeMemStream mms(_exits.merged_memory()); mms.next_non_empty(); ) {
1106     // transform each slice of the original memphi:
1107     mms.set_memory(_gvn.transform(mms.memory()));
1108   }
1109   // Clean up input MergeMems created by transforming the slices
1110   _gvn.transform(_exits.merged_memory());
1111 
1112   if (tf()->range_sig()->cnt() > TypeFunc::Parms) {
1113     const Type* ret_type = tf()->range_sig()->field_at(TypeFunc::Parms);
1114     Node*       ret_phi  = _gvn.transform( _exits.argument(0) );
1115     if (!_exits.control()->is_top() && _gvn.type(ret_phi)->empty()) {
1116       // In case of concurrent class loading, the type we set for the
1117       // ret_phi in build_exits() may have been too optimistic and the
1118       // ret_phi may be top now.
1119       // Otherwise, we've encountered an error and have to mark the method as
1120       // not compilable. Just using an assertion instead would be dangerous
1121       // as this could lead to an infinite compile loop in non-debug builds.
1122       {
1123         if (C->env()->system_dictionary_modification_counter_changed()) {
1124           C->record_failure(C2Compiler::retry_class_loading_during_parsing());
1125         } else {
1126           C->record_method_not_compilable("Can't determine return type.");
1127         }
1128       }
1129       return;
1130     }
1131     if (ret_type->isa_int()) {
1132       BasicType ret_bt = method()->return_type()->basic_type();
1133       ret_phi = mask_int_value(ret_phi, ret_bt, &_gvn);


1195 }
1196 
1197 //-----------------------------create_entry_map-------------------------------
1198 // Initialize our parser map to contain the types at method entry.
1199 // For OSR, the map contains a single RawPtr parameter.
1200 // Initial monitor locking for sync. methods is performed by do_method_entry.
1201 SafePointNode* Parse::create_entry_map() {
1202   // Check for really stupid bail-out cases.
1203   uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
1204   if (len >= 32760) {
1205     C->record_method_not_compilable("too many local variables");
1206     return NULL;
1207   }
1208 
1209   // clear current replaced nodes that are of no use from here on (map was cloned in build_exits).
1210   _caller->map()->delete_replaced_nodes();
1211 
1212   // If this is an inlined method, we may have to do a receiver null check.
1213   if (_caller->has_method() && is_normal_parse() && !method()->is_static()) {
1214     GraphKit kit(_caller);
1215     kit.null_check_receiver_before_call(method(), false);
1216     _caller = kit.transfer_exceptions_into_jvms();
1217     if (kit.stopped()) {
1218       _exits.add_exception_states_from(_caller);
1219       _exits.set_jvms(_caller);
1220       return NULL;
1221     }
1222   }
1223 
1224   assert(method() != NULL, "parser must have a method");
1225 
1226   // Create an initial safepoint to hold JVM state during parsing
1227   JVMState* jvms = new (C) JVMState(method(), _caller->has_method() ? _caller : NULL);
1228   set_map(new SafePointNode(len, jvms));
1229   jvms->set_map(map());
1230   record_for_igvn(map());
1231   assert(jvms->endoff() == len, "correct jvms sizing");
1232 
1233   SafePointNode* inmap = _caller->map();
1234   assert(inmap != NULL, "must have inmap");
1235   // In case of null check on receiver above
1236   map()->transfer_replaced_nodes_from(inmap, _new_idx);
1237 
1238   uint i;
1239 
1240   // Pass thru the predefined input parameters.
1241   for (i = 0; i < TypeFunc::Parms; i++) {
1242     map()->init_req(i, inmap->in(i));
1243   }
1244 
1245   if (depth() == 1) {
1246     assert(map()->memory()->Opcode() == Op_Parm, "");
1247     // Insert the memory aliasing node
1248     set_all_memory(reset_memory());
1249   }
1250   assert(merged_memory(), "");
1251 
1252   // Now add the locals which are initially bound to arguments:
1253   uint arg_size = tf()->domain_sig()->cnt();
1254   ensure_stack(arg_size - TypeFunc::Parms);  // OSR methods have funny args
1255   for (i = TypeFunc::Parms; i < arg_size; i++) {
1256     map()->init_req(i, inmap->argument(_caller, i - TypeFunc::Parms));
1257   }
1258 
1259   // Clear out the rest of the map (locals and stack)
1260   for (i = arg_size; i < len; i++) {
1261     map()->init_req(i, top());
1262   }
1263 
1264   SafePointNode* entry_map = stop();
1265   return entry_map;
1266 }
1267 
1268 //-----------------------------do_method_entry--------------------------------
1269 // Emit any code needed in the pseudo-block before BCI zero.
1270 // The main thing to do is lock the receiver of a synchronized method.
1271 void Parse::do_method_entry() {
1272   set_parse_bci(InvocationEntryBci); // Pseudo-BCP
1273   set_sp(0);                         // Java Stack Pointer


1692 //--------------------handle_missing_successor---------------------------------
1693 void Parse::handle_missing_successor(int target_bci) {
1694 #ifndef PRODUCT
1695   Block* b = block();
1696   int trap_bci = b->flow()->has_trap()? b->flow()->trap_bci(): -1;
1697   tty->print_cr("### Missing successor at bci:%d for block #%d (trap_bci:%d)", target_bci, b->rpo(), trap_bci);
1698 #endif
1699   ShouldNotReachHere();
1700 }
1701 
1702 //--------------------------merge_common---------------------------------------
1703 void Parse::merge_common(Parse::Block* target, int pnum) {
1704   if (TraceOptoParse) {
1705     tty->print("Merging state at block #%d bci:%d", target->rpo(), target->start());
1706   }
1707 
1708   // Zap extra stack slots to top
1709   assert(sp() == target->start_sp(), "");
1710   clean_stack(sp());
1711 
1712   // Check for merge conflicts involving value types
1713   JVMState* old_jvms = map()->jvms();
1714   int old_bci = bci();
1715   JVMState* tmp_jvms = old_jvms->clone_shallow(C);
1716   tmp_jvms->set_should_reexecute(true);
1717   map()->set_jvms(tmp_jvms);
1718   // Execution needs to restart a the next bytecode (entry of next
1719   // block)
1720   if (target->is_merged() ||
1721       pnum > PhiNode::Input ||
1722       target->is_handler() ||
1723       target->is_loop_head()) {
1724     set_parse_bci(target->start());
1725     for (uint j = TypeFunc::Parms; j < map()->req(); j++) {
1726       Node* n = map()->in(j);                 // Incoming change to target state.
1727       const Type* t = NULL;
1728       if (tmp_jvms->is_loc(j)) {
1729         t = target->local_type_at(j - tmp_jvms->locoff());
1730       } else if (tmp_jvms->is_stk(j) && j < (uint)sp() + tmp_jvms->stkoff()) {
1731         t = target->stack_type_at(j - tmp_jvms->stkoff());
1732       }
1733       if (t != NULL && t != Type::BOTTOM) {
1734         if (n->is_ValueType() && !t->isa_valuetype()) {
1735           // Allocate value type in src block to be able to merge it with oop in target block
1736           map()->set_req(j, ValueTypePtrNode::make_from_value_type(this, n->as_ValueType(), true));
1737         }
1738         assert(!t->isa_valuetype() || n->is_ValueType(), "inconsistent typeflow info");
1739       }
1740     }
1741   }
1742   map()->set_jvms(old_jvms);
1743   set_parse_bci(old_bci);
1744 
1745   if (!target->is_merged()) {   // No prior mapping at this bci
1746     if (TraceOptoParse) { tty->print(" with empty state");  }
1747 
1748     // If this path is dead, do not bother capturing it as a merge.
1749     // It is "as if" we had 1 fewer predecessors from the beginning.
1750     if (stopped()) {
1751       if (TraceOptoParse)  tty->print_cr(", but path is dead and doesn't count");
1752       return;
1753     }
1754 
1755     // Make a region if we know there are multiple or unpredictable inputs.
1756     // (Also, if this is a plain fall-through, we might see another region,
1757     // which must not be allowed into this block's map.)
1758     if (pnum > PhiNode::Input         // Known multiple inputs.
1759         || target->is_handler()       // These have unpredictable inputs.
1760         || target->is_loop_head()     // Known multiple inputs
1761         || control()->is_Region()) {  // We must hide this guy.
1762 
1763       int current_bci = bci();
1764       set_parse_bci(target->start()); // Set target bci


1778       gvn().set_type(r, Type::CONTROL);
1779       record_for_igvn(r);
1780       // zap all inputs to NULL for debugging (done in Node(uint) constructor)
1781       // for (int j = 1; j < edges+1; j++) { r->init_req(j, NULL); }
1782       r->init_req(pnum, control());
1783       set_control(r);
1784       set_parse_bci(current_bci); // Restore bci
1785     }
1786 
1787     // Convert the existing Parser mapping into a mapping at this bci.
1788     store_state_to(target);
1789     assert(target->is_merged(), "do not come here twice");
1790 
1791   } else {                      // Prior mapping at this bci
1792     if (TraceOptoParse) {  tty->print(" with previous state"); }
1793 #ifdef ASSERT
1794     if (target->is_SEL_head()) {
1795       target->mark_merged_backedge(block());
1796     }
1797 #endif
1798 
1799     // We must not manufacture more phis if the target is already parsed.
1800     bool nophi = target->is_parsed();
1801 
1802     SafePointNode* newin = map();// Hang on to incoming mapping
1803     Block* save_block = block(); // Hang on to incoming block;
1804     load_state_from(target);    // Get prior mapping
1805 
1806     assert(newin->jvms()->locoff() == jvms()->locoff(), "JVMS layouts agree");
1807     assert(newin->jvms()->stkoff() == jvms()->stkoff(), "JVMS layouts agree");
1808     assert(newin->jvms()->monoff() == jvms()->monoff(), "JVMS layouts agree");
1809     assert(newin->jvms()->endoff() == jvms()->endoff(), "JVMS layouts agree");
1810 
1811     // Iterate over my current mapping and the old mapping.
1812     // Where different, insert Phi functions.
1813     // Use any existing Phi functions.
1814     assert(control()->is_Region(), "must be merging to a region");
1815     RegionNode* r = control()->as_Region();
1816 
1817     // Compute where to merge into
1818     // Merge incoming control path
1819     r->init_req(pnum, newin->control());
1820 
1821     if (pnum == 1) {            // Last merge for this Region?
1822       if (!block()->flow()->is_irreducible_entry()) {
1823         Node* result = _gvn.transform_no_reclaim(r);
1824         if (r != result && TraceOptoParse) {
1825           tty->print_cr("Block #%d replace %d with %d", block()->rpo(), r->_idx, result->_idx);
1826         }
1827       }
1828       record_for_igvn(r);
1829     }
1830 
1831     // Update all the non-control inputs to map:
1832     assert(TypeFunc::Parms == newin->jvms()->locoff(), "parser map should contain only youngest jvms");
1833     bool check_elide_phi = target->is_SEL_backedge(save_block);
1834     bool last_merge = (pnum == PhiNode::Input);
1835     for (uint j = 1; j < newin->req(); j++) {
1836       Node* m = map()->in(j);   // Current state of target.
1837       Node* n = newin->in(j);   // Incoming change to target state.
1838       PhiNode* phi;
1839       if (m->is_Phi() && m->as_Phi()->region() == r) {
1840         phi = m->as_Phi();
1841       } else if (m->is_ValueType() && m->as_ValueType()->has_phi_inputs(r)){
1842         phi = m->as_ValueType()->get_oop()->as_Phi();
1843       } else {
1844         phi = NULL;
1845       }
1846       if (m != n) {             // Different; must merge
1847         switch (j) {
1848         // Frame pointer and Return Address never changes
1849         case TypeFunc::FramePtr:// Drop m, use the original value
1850         case TypeFunc::ReturnAdr:
1851           break;
1852         case TypeFunc::Memory:  // Merge inputs to the MergeMem node
1853           assert(phi == NULL, "the merge contains phis, not vice versa");
1854           merge_memory_edges(n->as_MergeMem(), pnum, nophi);
1855           continue;
1856         default:                // All normal stuff
1857           if (phi == NULL) {
1858             const JVMState* jvms = map()->jvms();
1859             if (EliminateNestedLocks &&
1860                 jvms->is_mon(j) && jvms->is_monitor_box(j)) {
1861               // BoxLock nodes are not commoning.
1862               // Use old BoxLock node as merged box.
1863               assert(newin->jvms()->is_monitor_box(j), "sanity");
1864               // This assert also tests that nodes are BoxLock.
1865               assert(BoxLockNode::same_slot(n, m), "sanity");
1866               C->gvn_replace_by(n, m);
1867             } else if (!check_elide_phi || !target->can_elide_SEL_phi(j)) {
1868               phi = ensure_phi(j, nophi);
1869             }
1870           }
1871           break;
1872         }
1873       }
1874       // At this point, n might be top if:
1875       //  - there is no phi (because TypeFlow detected a conflict), or
1876       //  - the corresponding control edges is top (a dead incoming path)
1877       // It is a bug if we create a phi which sees a garbage value on a live path.
1878 
1879       // Merging two value types?
1880       if (phi != NULL && n->is_ValueType()) {
1881         // Reload current state because it may have been updated by ensure_phi
1882         m = map()->in(j);
1883         ValueTypeNode* vtm = m->as_ValueType(); // Current value type
1884         ValueTypeNode* vtn = n->as_ValueType(); // Incoming value type
1885         assert(vtm->get_oop() == phi, "Value type should have Phi input");
1886         if (TraceOptoParse) {
1887 #ifdef ASSERT
1888           tty->print_cr("\nMerging value types");
1889           tty->print_cr("Current:");
1890           vtm->dump(2);
1891           tty->print_cr("Incoming:");
1892           vtn->dump(2);
1893           tty->cr();
1894 #endif
1895         }
1896         // Do the merge
1897         vtm->merge_with(&_gvn, vtn, pnum, last_merge);
1898         if (last_merge) {
1899           map()->set_req(j, _gvn.transform_no_reclaim(vtm));
1900           record_for_igvn(vtm);
1901         }
1902       } else if (phi != NULL) {
1903         assert(n != top() || r->in(pnum) == top(), "live value must not be garbage");
1904         assert(phi->region() == r, "");
1905         phi->set_req(pnum, n);  // Then add 'n' to the merge
1906         if (last_merge) {
1907           // Last merge for this Phi.
1908           // So far, Phis have had a reasonable type from ciTypeFlow.
1909           // Now _gvn will join that with the meet of current inputs.
1910           // BOTTOM is never permissible here, 'cause pessimistically
1911           // Phis of pointers cannot lose the basic pointer type.
1912           debug_only(const Type* bt1 = phi->bottom_type());
1913           assert(bt1 != Type::BOTTOM, "should not be building conflict phis");
1914           map()->set_req(j, _gvn.transform_no_reclaim(phi));
1915           debug_only(const Type* bt2 = phi->bottom_type());
1916           assert(bt2->higher_equal_speculative(bt1), "must be consistent with type-flow");
1917           record_for_igvn(phi);
1918         }
1919       }
1920     } // End of for all values to be merged
1921 
1922     if (last_merge && !r->in(0)) {         // The occasional useless Region

1923       assert(control() == r, "");
1924       set_control(r->nonnull_req());
1925     }
1926 
1927     map()->merge_replaced_nodes_with(newin);
1928 
1929     // newin has been subsumed into the lazy merge, and is now dead.
1930     set_block(save_block);
1931 
1932     stop();                     // done with this guy, for now
1933   }
1934 
1935   if (TraceOptoParse) {
1936     tty->print_cr(" on path %d", pnum);
1937   }
1938 
1939   // Done with this parser state.
1940   assert(stopped(), "");
1941 }
1942 


2054 
2055   // Add new path to the region.
2056   uint pnum = r->req();
2057   r->add_req(NULL);
2058 
2059   for (uint i = 1; i < map->req(); i++) {
2060     Node* n = map->in(i);
2061     if (i == TypeFunc::Memory) {
2062       // Ensure a phi on all currently known memories.
2063       for (MergeMemStream mms(n->as_MergeMem()); mms.next_non_empty(); ) {
2064         Node* phi = mms.memory();
2065         if (phi->is_Phi() && phi->as_Phi()->region() == r) {
2066           assert(phi->req() == pnum, "must be same size as region");
2067           phi->add_req(NULL);
2068         }
2069       }
2070     } else {
2071       if (n->is_Phi() && n->as_Phi()->region() == r) {
2072         assert(n->req() == pnum, "must be same size as region");
2073         n->add_req(NULL);
2074       } else if (n->is_ValueType() && n->as_ValueType()->has_phi_inputs(r)) {
2075         n->as_ValueType()->add_new_path(r);
2076       }
2077     }
2078   }
2079 
2080   return pnum;
2081 }
2082 
2083 //------------------------------ensure_phi-------------------------------------
2084 // Turn the idx'th entry of the current map into a Phi
2085 PhiNode *Parse::ensure_phi(int idx, bool nocreate) {
2086   SafePointNode* map = this->map();
2087   Node* region = map->control();
2088   assert(region->is_Region(), "");
2089 
2090   Node* o = map->in(idx);
2091   assert(o != NULL, "");
2092 
2093   if (o == top())  return NULL; // TOP always merges into TOP
2094 
2095   if (o->is_Phi() && o->as_Phi()->region() == region) {
2096     return o->as_Phi();
2097   }
2098   ValueTypeBaseNode* vt = o->isa_ValueType();
2099   if (vt != NULL && vt->has_phi_inputs(region)) {
2100     return vt->get_oop()->as_Phi();
2101   }
2102 
2103   // Now use a Phi here for merging
2104   assert(!nocreate, "Cannot build a phi for a block already parsed.");
2105   const JVMState* jvms = map->jvms();
2106   const Type* t = NULL;
2107   if (jvms->is_loc(idx)) {
2108     t = block()->local_type_at(idx - jvms->locoff());
2109   } else if (jvms->is_stk(idx)) {
2110     t = block()->stack_type_at(idx - jvms->stkoff());
2111   } else if (jvms->is_mon(idx)) {
2112     assert(!jvms->is_monitor_box(idx), "no phis for boxes");
2113     t = TypeInstPtr::BOTTOM; // this is sufficient for a lock object
2114   } else if ((uint)idx < TypeFunc::Parms) {
2115     t = o->bottom_type();  // Type::RETURN_ADDRESS or such-like.
2116   } else {
2117     assert(false, "no type information for this phi");
2118   }
2119 
2120   // If the type falls to bottom, then this must be a local that
2121   // is already dead or is mixing ints and oops or some such.
2122   // Forcing it to top makes it go dead.
2123   if (t == Type::BOTTOM) {
2124     map->set_req(idx, top());
2125     return NULL;
2126   }
2127 
2128   // Do not create phis for top either.
2129   // A top on a non-null control flow must be an unused even after the.phi.
2130   if (t == Type::TOP || t == Type::HALF) {
2131     map->set_req(idx, top());
2132     return NULL;
2133   }
2134 
2135   if (vt != NULL) {
2136     // Value types are merged by merging their field values.
2137     // Create a cloned ValueTypeNode with phi inputs that
2138     // represents the merged value type and update the map.
2139     vt = vt->clone_with_phis(&_gvn, region);
2140     map->set_req(idx, vt);
2141     return vt->get_oop()->as_Phi();
2142   } else {
2143     PhiNode* phi = PhiNode::make(region, o, t);
2144     gvn().set_type(phi, t);
2145     if (C->do_escape_analysis()) record_for_igvn(phi);
2146     map->set_req(idx, phi);
2147     return phi;
2148   }
2149 }
2150 
2151 //--------------------------ensure_memory_phi----------------------------------
2152 // Turn the idx'th slice of the current memory into a Phi
2153 PhiNode *Parse::ensure_memory_phi(int idx, bool nocreate) {
2154   MergeMemNode* mem = merged_memory();
2155   Node* region = control();
2156   assert(region->is_Region(), "");
2157 
2158   Node *o = (idx == Compile::AliasIdxBot)? mem->base_memory(): mem->memory_at(idx);
2159   assert(o != NULL && o != top(), "");
2160 
2161   PhiNode* phi;
2162   if (o->is_Phi() && o->as_Phi()->region() == region) {
2163     phi = o->as_Phi();
2164     if (phi == mem->base_memory() && idx >= Compile::AliasIdxRaw) {
2165       // clone the shared base memory phi to make a new memory split
2166       assert(!nocreate, "Cannot build a phi for a block already parsed.");
2167       const Type* t = phi->bottom_type();
2168       const TypePtr* adr_type = C->get_adr_type(idx);


2321   Node* cnt = make_load(control(), cnt_adr, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
2322   Node* decr = _gvn.transform(new SubINode(cnt, makecon(TypeInt::ONE)));
2323   store_to_memory(control(), cnt_adr, decr, T_INT, adr_type, MemNode::unordered);
2324   Node *chk   = _gvn.transform(new CmpINode(decr, makecon(TypeInt::ZERO)));
2325   Node* tst   = _gvn.transform(new BoolNode(chk, BoolTest::gt));
2326   { BuildCutout unless(this, tst, PROB_ALWAYS);
2327     uncommon_trap(Deoptimization::Reason_tenured,
2328                   Deoptimization::Action_make_not_entrant);
2329   }
2330 }
2331 
2332 //------------------------------return_current---------------------------------
2333 // Append current _map to _exit_return
2334 void Parse::return_current(Node* value) {
2335   if (RegisterFinalizersAtInit &&
2336       method()->intrinsic_id() == vmIntrinsics::_Object_init) {
2337     call_register_finalizer();
2338   }
2339 
2340   // Do not set_parse_bci, so that return goo is credited to the return insn.
2341   // vreturn can trigger an allocation so vreturn can throw. Setting
2342   // the bci here breaks exception handling. Commenting this out
2343   // doesn't seem to break anything.
2344   //  set_bci(InvocationEntryBci);
2345   if (method()->is_synchronized() && GenerateSynchronizationCode) {
2346     shared_unlock(_synch_lock->box_node(), _synch_lock->obj_node());
2347   }
2348   if (C->env()->dtrace_method_probes()) {
2349     make_dtrace_method_exit(method());
2350   }

















2351   // frame pointer is always same, already captured
2352   if (value != NULL) {



2353     Node* phi = _exits.argument(0);
2354     const Type* return_type = phi->bottom_type();
2355     const TypeOopPtr* tr = return_type->isa_oopptr();
2356     if (return_type->isa_valuetype()) {
2357       // Value type is returned as fields, make sure it is scalarized
2358       if (!value->is_ValueType()) {
2359         value = ValueTypeNode::make_from_oop(this, value, return_type->value_klass());
2360       }
2361       if (!_caller->has_method()) {
2362         // Value type is returned as fields from root method, make
2363         // sure all non-flattened value type fields are allocated.
2364         assert(tf()->returns_value_type_as_fields(), "must be returned as fields");
2365         value = value->as_ValueType()->allocate_fields(this);
2366       }
2367     } else if (value->is_ValueType()) {
2368       // Value type is returned as oop, make sure it is allocated
2369       assert(tr && tr->can_be_value_type(), "must return a value type pointer");
2370       value = ValueTypePtrNode::make_from_value_type(this, value->as_ValueType());
2371     } else if (tr && tr->isa_instptr() && tr->klass()->is_loaded() && tr->klass()->is_interface()) {
2372       // If returning oops to an interface-return, there is a silent free
2373       // cast from oop to interface allowed by the Verifier. Make it explicit here.
2374       const TypeInstPtr* tp = value->bottom_type()->isa_instptr();
2375       if (tp && tp->klass()->is_loaded() && !tp->klass()->is_interface()) {
2376         // sharpen the type eagerly; this eases certain assert checking
2377         if (tp->higher_equal(TypeInstPtr::NOTNULL)) {
2378           tr = tr->join_speculative(TypeInstPtr::NOTNULL)->is_instptr();
2379         }
2380         value = _gvn.transform(new CheckCastPPNode(0, value, tr));
2381       }
2382     } else {
2383       // Handle returns of oop-arrays to an arrays-of-interface return
2384       const TypeInstPtr* phi_tip;
2385       const TypeInstPtr* val_tip;
2386       Type::get_arrays_base_elements(return_type, value->bottom_type(), &phi_tip, &val_tip);
2387       if (phi_tip != NULL && phi_tip->is_loaded() && phi_tip->klass()->is_interface() &&
2388           val_tip != NULL && val_tip->is_loaded() && !val_tip->klass()->is_interface()) {
2389         value = _gvn.transform(new CheckCastPPNode(0, value, return_type));
2390       }
2391     }
2392     phi->add_req(value);
2393   }
2394 
2395   SafePointNode* exit_return = _exits.map();
2396   exit_return->in( TypeFunc::Control  )->add_req( control() );
2397   exit_return->in( TypeFunc::I_O      )->add_req( i_o    () );
2398   Node *mem = exit_return->in( TypeFunc::Memory   );
2399   for (MergeMemStream mms(mem->as_MergeMem(), merged_memory()); mms.next_non_empty2(); ) {
2400     if (mms.is_empty()) {
2401       // get a copy of the base memory, and patch just this one input
2402       const TypePtr* adr_type = mms.adr_type(C);
2403       Node* phi = mms.force_memory()->as_Phi()->slice_memory(adr_type);
2404       assert(phi->as_Phi()->region() == mms.base_memory()->in(0), "");
2405       gvn().set_type_bottom(phi);
2406       phi->del_req(phi->req()-1);  // prepare to re-patch
2407       mms.set_memory(phi);
2408     }
2409     mms.memory()->add_req(mms.memory2());
2410   }
2411 
2412   if (_first_return) {
2413     _exits.map()->transfer_replaced_nodes_from(map(), _new_idx);
2414     _first_return = false;
2415   } else {
2416     _exits.map()->merge_replaced_nodes_with(map());
2417   }
2418 
2419   stop_and_kill_map();          // This CFG path dies here
2420 }
2421 
2422 
2423 //------------------------------add_safepoint----------------------------------
2424 void Parse::add_safepoint() {
2425   // See if we can avoid this safepoint.  No need for a SafePoint immediately
2426   // after a Call (except Leaf Call) or another SafePoint.
2427   Node *proj = control();
2428   bool add_poll_param = SafePointNode::needs_polling_address_input();
2429   uint parms = add_poll_param ? TypeFunc::Parms+1 : TypeFunc::Parms;


< prev index next >