hotspot/src/share/vm/opto/graphKit.cpp
changeset 17383 3665c0901a0d
parent 17111 77f553b98e63
child 18505 51e4bfb89d40
equal deleted inserted replaced
17382:bba473b81ec0 17383:3665c0901a0d
   331   JVMState* ex_jvms = ex_map->_jvms;
   331   JVMState* ex_jvms = ex_map->_jvms;
   332   assert(ex_jvms->same_calls_as(phi_map->_jvms), "consistent call chains");
   332   assert(ex_jvms->same_calls_as(phi_map->_jvms), "consistent call chains");
   333   assert(ex_jvms->stkoff() == phi_map->_jvms->stkoff(), "matching locals");
   333   assert(ex_jvms->stkoff() == phi_map->_jvms->stkoff(), "matching locals");
   334   assert(ex_jvms->sp() == phi_map->_jvms->sp(), "matching stack sizes");
   334   assert(ex_jvms->sp() == phi_map->_jvms->sp(), "matching stack sizes");
   335   assert(ex_jvms->monoff() == phi_map->_jvms->monoff(), "matching JVMS");
   335   assert(ex_jvms->monoff() == phi_map->_jvms->monoff(), "matching JVMS");
       
   336   assert(ex_jvms->scloff() == phi_map->_jvms->scloff(), "matching scalar replaced objects");
   336   assert(ex_map->req() == phi_map->req(), "matching maps");
   337   assert(ex_map->req() == phi_map->req(), "matching maps");
   337   uint tos = ex_jvms->stkoff() + ex_jvms->sp();
   338   uint tos = ex_jvms->stkoff() + ex_jvms->sp();
   338   Node*         hidden_merge_mark = root();
   339   Node*         hidden_merge_mark = root();
   339   Node*         region  = phi_map->control();
   340   Node*         region  = phi_map->control();
   340   MergeMemNode* phi_mem = phi_map->merged_memory();
   341   MergeMemNode* phi_mem = phi_map->merged_memory();
   407         phi_map->set_req(i, dst);
   408         phi_map->set_req(i, dst);
   408         // Prepare to append interesting stuff onto the new phi:
   409         // Prepare to append interesting stuff onto the new phi:
   409         while (dst->req() > orig_width)  dst->del_req(dst->req()-1);
   410         while (dst->req() > orig_width)  dst->del_req(dst->req()-1);
   410       } else {
   411       } else {
   411         assert(dst->is_Phi(), "nobody else uses a hidden region");
   412         assert(dst->is_Phi(), "nobody else uses a hidden region");
   412         phi = (PhiNode*)dst;
   413         phi = dst->as_Phi();
   413       }
   414       }
   414       if (add_multiple && src->in(0) == ex_control) {
   415       if (add_multiple && src->in(0) == ex_control) {
   415         // Both are phis.
   416         // Both are phis.
   416         add_n_reqs(dst, src);
   417         add_n_reqs(dst, src);
   417       } else {
   418       } else {
  1436   if (require_atomic_access && bt == T_LONG) {
  1437   if (require_atomic_access && bt == T_LONG) {
  1437     ld = LoadLNode::make_atomic(C, ctl, mem, adr, adr_type, t);
  1438     ld = LoadLNode::make_atomic(C, ctl, mem, adr, adr_type, t);
  1438   } else {
  1439   } else {
  1439     ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt);
  1440     ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt);
  1440   }
  1441   }
  1441   return _gvn.transform(ld);
  1442   ld = _gvn.transform(ld);
       
  1443   if ((bt == T_OBJECT) && C->do_escape_analysis() || C->eliminate_boxing()) {
       
  1444     // Improve graph before escape analysis and boxing elimination.
       
  1445     record_for_igvn(ld);
       
  1446   }
       
  1447   return ld;
  1442 }
  1448 }
  1443 
  1449 
  1444 Node* GraphKit::store_to_memory(Node* ctl, Node* adr, Node *val, BasicType bt,
  1450 Node* GraphKit::store_to_memory(Node* ctl, Node* adr, Node *val, BasicType bt,
  1445                                 int adr_idx,
  1451                                 int adr_idx,
  1446                                 bool require_atomic_access) {
  1452                                 bool require_atomic_access) {
  3142   // since GC and deoptimization can happened.
  3148   // since GC and deoptimization can happened.
  3143   Node *mem = reset_memory();
  3149   Node *mem = reset_memory();
  3144   set_all_memory(mem); // Create new memory state
  3150   set_all_memory(mem); // Create new memory state
  3145 
  3151 
  3146   AllocateNode* alloc
  3152   AllocateNode* alloc
  3147     = new (C) AllocateNode(C, AllocateNode::alloc_type(),
  3153     = new (C) AllocateNode(C, AllocateNode::alloc_type(Type::TOP),
  3148                            control(), mem, i_o(),
  3154                            control(), mem, i_o(),
  3149                            size, klass_node,
  3155                            size, klass_node,
  3150                            initial_slow_test);
  3156                            initial_slow_test);
  3151 
  3157 
  3152   return set_output_for_allocation(alloc, oop_type);
  3158   return set_output_for_allocation(alloc, oop_type);
  3283   Node *mem = reset_memory();
  3289   Node *mem = reset_memory();
  3284   set_all_memory(mem); // Create new memory state
  3290   set_all_memory(mem); // Create new memory state
  3285 
  3291 
  3286   // Create the AllocateArrayNode and its result projections
  3292   // Create the AllocateArrayNode and its result projections
  3287   AllocateArrayNode* alloc
  3293   AllocateArrayNode* alloc
  3288     = new (C) AllocateArrayNode(C, AllocateArrayNode::alloc_type(),
  3294     = new (C) AllocateArrayNode(C, AllocateArrayNode::alloc_type(TypeInt::INT),
  3289                                 control(), mem, i_o(),
  3295                                 control(), mem, i_o(),
  3290                                 size, klass_node,
  3296                                 size, klass_node,
  3291                                 initial_slow_test,
  3297                                 initial_slow_test,
  3292                                 length);
  3298                                 length);
  3293 
  3299 
  3324 // Given an oop pointer or raw pointer, see if it feeds from an AllocateNode.
  3330 // Given an oop pointer or raw pointer, see if it feeds from an AllocateNode.
  3325 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
  3331 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
  3326   if (ptr == NULL) {     // reduce dumb test in callers
  3332   if (ptr == NULL) {     // reduce dumb test in callers
  3327     return NULL;
  3333     return NULL;
  3328   }
  3334   }
  3329   if (ptr->is_CheckCastPP()) {  // strip a raw-to-oop cast
  3335   ptr = ptr->uncast();  // strip a raw-to-oop cast
  3330     ptr = ptr->in(1);
  3336   if (ptr == NULL)  return NULL;
  3331     if (ptr == NULL)  return NULL;
  3337 
  3332   }
       
  3333   if (ptr->is_Proj()) {
  3338   if (ptr->is_Proj()) {
  3334     Node* allo = ptr->in(0);
  3339     Node* allo = ptr->in(0);
  3335     if (allo != NULL && allo->is_Allocate()) {
  3340     if (allo != NULL && allo->is_Allocate()) {
  3336       return allo->as_Allocate();
  3341       return allo->as_Allocate();
  3337     }
  3342     }
  3367   for (DUIterator_Fast imax, i = rawoop->fast_outs(imax); i < imax; i++) {
  3372   for (DUIterator_Fast imax, i = rawoop->fast_outs(imax); i < imax; i++) {
  3368     Node* init = rawoop->fast_out(i);
  3373     Node* init = rawoop->fast_out(i);
  3369     if (init->is_Initialize()) {
  3374     if (init->is_Initialize()) {
  3370       assert(init->as_Initialize()->allocation() == this, "2-way link");
  3375       assert(init->as_Initialize()->allocation() == this, "2-way link");
  3371       return init->as_Initialize();
  3376       return init->as_Initialize();
  3372     }
       
  3373   }
       
  3374   return NULL;
       
  3375 }
       
  3376 
       
  3377 // Trace Allocate -> Proj[Parm] -> MemBarStoreStore
       
  3378 MemBarStoreStoreNode* AllocateNode::storestore() {
       
  3379   ProjNode* rawoop = proj_out(AllocateNode::RawAddress);
       
  3380   if (rawoop == NULL)  return NULL;
       
  3381   for (DUIterator_Fast imax, i = rawoop->fast_outs(imax); i < imax; i++) {
       
  3382     Node* storestore = rawoop->fast_out(i);
       
  3383     if (storestore->is_MemBarStoreStore()) {
       
  3384       return storestore->as_MemBarStoreStore();
       
  3385     }
  3377     }
  3386   }
  3378   }
  3387   return NULL;
  3379   return NULL;
  3388 }
  3380 }
  3389 
  3381