< prev index next >

src/hotspot/share/opto/macro.cpp

Print this page

1640     rawmem = new ProjNode(call, TypeFunc::Memory);
1641     transform_later(rawmem);
1642   }
1643 }
1644 
1645 // Helper for PhaseMacroExpand::expand_allocate_common.
1646 // Initializes the newly-allocated storage.
1647 Node*
1648 PhaseMacroExpand::initialize_object(AllocateNode* alloc,
1649                                     Node* control, Node* rawmem, Node* object,
1650                                     Node* klass_node, Node* length,
1651                                     Node* size_in_bytes) {
1652   InitializeNode* init = alloc->initialization();
1653   // Store the klass & mark bits
1654   Node* mark_node = alloc->make_ideal_mark(&_igvn, object, control, rawmem);
1655   if (!mark_node->is_Con()) {
1656     transform_later(mark_node);
1657   }
1658   rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
1659 

1660   rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);

1661   int header_size = alloc->minimum_header_size();  // conservatively small
1662 
1663   // Array length
1664   if (length != NULL) {         // Arrays need length field
1665     rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1666     // conservatively small header size:
1667     header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1668     if (_igvn.type(klass_node)->isa_aryklassptr()) {   // we know the exact header size in most cases:
1669       BasicType elem = _igvn.type(klass_node)->is_klassptr()->as_instance_type()->isa_aryptr()->elem()->array_element_basic_type();
1670       if (is_reference_type(elem, true)) {
1671         elem = T_OBJECT;
1672       }
1673       header_size = Klass::layout_helper_header_size(Klass::array_layout_helper(elem));
1674     }
1675   }
1676 
1677   // Clear the object body, if necessary.
1678   if (init == NULL) {
1679     // The init has somehow disappeared; be cautious and clear everything.
1680     //

2147   Node* flock = lock->fastlock_node();
2148 
2149   assert(!box->as_BoxLock()->is_eliminated(), "sanity");
2150 
2151   // Make the merge point
2152   Node *region;
2153   Node *mem_phi;
2154   Node *slow_path;
2155 
2156   region  = new RegionNode(3);
2157   // create a Phi for the memory state
2158   mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
2159 
2160   // Optimize test; set region slot 2
2161   slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0);
2162   mem_phi->init_req(2, mem);
2163 
2164   // Make slow path call
2165   CallNode *call = make_slow_call((CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(),
2166                                   OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path,
2167                                   obj, box, NULL);
2168 
2169   call->extract_projections(&_callprojs, false /*separate_io_proj*/, false /*do_asserts*/);
2170 
2171   // Slow path can only throw asynchronous exceptions, which are always
2172   // de-opted.  So the compiler thinks the slow-call can never throw an
2173   // exception.  If it DOES throw an exception we would need the debug
2174   // info removed first (since if it throws there is no monitor).
2175   assert(_callprojs.fallthrough_ioproj == NULL && _callprojs.catchall_ioproj == NULL &&
2176          _callprojs.catchall_memproj == NULL && _callprojs.catchall_catchproj == NULL, "Unexpected projection from Lock");
2177 
2178   // Capture slow path
2179   // disconnect fall-through projection from call and create a new one
2180   // hook up users of fall-through projection to region
2181   Node *slow_ctrl = _callprojs.fallthrough_proj->clone();
2182   transform_later(slow_ctrl);
2183   _igvn.hash_delete(_callprojs.fallthrough_proj);
2184   _callprojs.fallthrough_proj->disconnect_inputs(C);
2185   region->init_req(1, slow_ctrl);
2186   // region inputs are now complete
2187   transform_later(region);

2207   assert(!box->as_BoxLock()->is_eliminated(), "sanity");
2208 
2209   // No need for a null check on unlock
2210 
2211   // Make the merge point
2212   Node *region;
2213   Node *mem_phi;
2214 
2215   region  = new RegionNode(3);
2216   // create a Phi for the memory state
2217   mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
2218 
2219   FastUnlockNode *funlock = new FastUnlockNode( ctrl, obj, box );
2220   funlock = transform_later( funlock )->as_FastUnlock();
2221   // Optimize test; set region slot 2
2222   Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0);
2223   Node *thread = transform_later(new ThreadLocalNode());
2224 
2225   CallNode *call = make_slow_call((CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(),
2226                                   CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C),
2227                                   "complete_monitor_unlocking_C", slow_path, obj, box, thread);
2228 
2229   call->extract_projections(&_callprojs, false /*separate_io_proj*/, false /*do_asserts*/);
2230   assert(_callprojs.fallthrough_ioproj == NULL && _callprojs.catchall_ioproj == NULL &&
2231          _callprojs.catchall_memproj == NULL && _callprojs.catchall_catchproj == NULL, "Unexpected projection from Lock");
2232 
2233   // No exceptions for unlocking
2234   // Capture slow path
2235   // disconnect fall-through projection from call and create a new one
2236   // hook up users of fall-through projection to region
2237   Node *slow_ctrl = _callprojs.fallthrough_proj->clone();
2238   transform_later(slow_ctrl);
2239   _igvn.hash_delete(_callprojs.fallthrough_proj);
2240   _callprojs.fallthrough_proj->disconnect_inputs(C);
2241   region->init_req(1, slow_ctrl);
2242   // region inputs are now complete
2243   transform_later(region);
2244   _igvn.replace_node(_callprojs.fallthrough_proj, region);
2245 
2246   Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory) );
2247   mem_phi->init_req(1, memproj );

1640     rawmem = new ProjNode(call, TypeFunc::Memory);
1641     transform_later(rawmem);
1642   }
1643 }
1644 
1645 // Helper for PhaseMacroExpand::expand_allocate_common.
1646 // Initializes the newly-allocated storage.
1647 Node*
1648 PhaseMacroExpand::initialize_object(AllocateNode* alloc,
1649                                     Node* control, Node* rawmem, Node* object,
1650                                     Node* klass_node, Node* length,
1651                                     Node* size_in_bytes) {
1652   InitializeNode* init = alloc->initialization();
1653   // Store the klass & mark bits
1654   Node* mark_node = alloc->make_ideal_mark(&_igvn, object, control, rawmem);
1655   if (!mark_node->is_Con()) {
1656     transform_later(mark_node);
1657   }
1658   rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
1659 
1660 #ifndef _LP64
1661   rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);
1662 #endif
1663   int header_size = alloc->minimum_header_size();  // conservatively small
1664 
1665   // Array length
1666   if (length != NULL) {         // Arrays need length field
1667     rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1668     // conservatively small header size:
1669     header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1670     if (_igvn.type(klass_node)->isa_aryklassptr()) {   // we know the exact header size in most cases:
1671       BasicType elem = _igvn.type(klass_node)->is_klassptr()->as_instance_type()->isa_aryptr()->elem()->array_element_basic_type();
1672       if (is_reference_type(elem, true)) {
1673         elem = T_OBJECT;
1674       }
1675       header_size = Klass::layout_helper_header_size(Klass::array_layout_helper(elem));
1676     }
1677   }
1678 
1679   // Clear the object body, if necessary.
1680   if (init == NULL) {
1681     // The init has somehow disappeared; be cautious and clear everything.
1682     //

2149   Node* flock = lock->fastlock_node();
2150 
2151   assert(!box->as_BoxLock()->is_eliminated(), "sanity");
2152 
2153   // Make the merge point
2154   Node *region;
2155   Node *mem_phi;
2156   Node *slow_path;
2157 
2158   region  = new RegionNode(3);
2159   // create a Phi for the memory state
2160   mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
2161 
2162   // Optimize test; set region slot 2
2163   slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0);
2164   mem_phi->init_req(2, mem);
2165 
2166   // Make slow path call
2167   CallNode *call = make_slow_call((CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(),
2168                                   OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path,
2169                                   obj, NULL, NULL);
2170 
2171   call->extract_projections(&_callprojs, false /*separate_io_proj*/, false /*do_asserts*/);
2172 
2173   // Slow path can only throw asynchronous exceptions, which are always
2174   // de-opted.  So the compiler thinks the slow-call can never throw an
2175   // exception.  If it DOES throw an exception we would need the debug
2176   // info removed first (since if it throws there is no monitor).
2177   assert(_callprojs.fallthrough_ioproj == NULL && _callprojs.catchall_ioproj == NULL &&
2178          _callprojs.catchall_memproj == NULL && _callprojs.catchall_catchproj == NULL, "Unexpected projection from Lock");
2179 
2180   // Capture slow path
2181   // disconnect fall-through projection from call and create a new one
2182   // hook up users of fall-through projection to region
2183   Node *slow_ctrl = _callprojs.fallthrough_proj->clone();
2184   transform_later(slow_ctrl);
2185   _igvn.hash_delete(_callprojs.fallthrough_proj);
2186   _callprojs.fallthrough_proj->disconnect_inputs(C);
2187   region->init_req(1, slow_ctrl);
2188   // region inputs are now complete
2189   transform_later(region);

2209   assert(!box->as_BoxLock()->is_eliminated(), "sanity");
2210 
2211   // No need for a null check on unlock
2212 
2213   // Make the merge point
2214   Node *region;
2215   Node *mem_phi;
2216 
2217   region  = new RegionNode(3);
2218   // create a Phi for the memory state
2219   mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
2220 
2221   FastUnlockNode *funlock = new FastUnlockNode( ctrl, obj, box );
2222   funlock = transform_later( funlock )->as_FastUnlock();
2223   // Optimize test; set region slot 2
2224   Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0);
2225   Node *thread = transform_later(new ThreadLocalNode());
2226 
2227   CallNode *call = make_slow_call((CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(),
2228                                   CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C),
2229                                   "complete_monitor_unlocking_C", slow_path, obj, thread, NULL);
2230 
2231   call->extract_projections(&_callprojs, false /*separate_io_proj*/, false /*do_asserts*/);
2232   assert(_callprojs.fallthrough_ioproj == NULL && _callprojs.catchall_ioproj == NULL &&
2233          _callprojs.catchall_memproj == NULL && _callprojs.catchall_catchproj == NULL, "Unexpected projection from Lock");
2234 
2235   // No exceptions for unlocking
2236   // Capture slow path
2237   // disconnect fall-through projection from call and create a new one
2238   // hook up users of fall-through projection to region
2239   Node *slow_ctrl = _callprojs.fallthrough_proj->clone();
2240   transform_later(slow_ctrl);
2241   _igvn.hash_delete(_callprojs.fallthrough_proj);
2242   _callprojs.fallthrough_proj->disconnect_inputs(C);
2243   region->init_req(1, slow_ctrl);
2244   // region inputs are now complete
2245   transform_later(region);
2246   _igvn.replace_node(_callprojs.fallthrough_proj, region);
2247 
2248   Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory) );
2249   mem_phi->init_req(1, memproj );
< prev index next >