1225 #ifndef PRODUCT
1226 if (PrintEliminateAllocations) {
1227 tty->print("++++ Eliminated: %d ", boxing->_idx);
1228 boxing->method()->print_short_name(tty);
1229 tty->cr();
1230 }
1231 #endif
1232
1233 return true;
1234 }
1235
1236 //---------------------------set_eden_pointers-------------------------
1237 void PhaseMacroExpand::set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr) {
1238 if (UseTLAB) { // Private allocation: load from TLS
1239 Node* thread = transform_later(new ThreadLocalNode());
1240 int tlab_top_offset = in_bytes(JavaThread::tlab_top_offset());
1241 int tlab_end_offset = in_bytes(JavaThread::tlab_end_offset());
1242 eden_top_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_top_offset);
1243 eden_end_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_end_offset);
1244 } else { // Shared allocation: load from globals
1245 CollectedHeap* ch = Universe::heap();
1246 address top_adr = (address)ch->top_addr();
1247 address end_adr = (address)ch->end_addr();
1248 eden_top_adr = makecon(TypeRawPtr::make(top_adr));
1249 eden_end_adr = basic_plus_adr(eden_top_adr, end_adr - top_adr);
1250 }
1251 }
1252
1253
1254 Node* PhaseMacroExpand::make_load(Node* ctl, Node* mem, Node* base, int offset, const Type* value_type, BasicType bt) {
1255 Node* adr = basic_plus_adr(base, offset);
1256 const TypePtr* adr_type = adr->bottom_type()->is_ptr();
1257 Node* value = LoadNode::make(_igvn, ctl, mem, adr, adr_type, value_type, bt, MemNode::unordered);
1258 transform_later(value);
1259 return value;
1260 }
1261
1262
1263 Node* PhaseMacroExpand::make_store(Node* ctl, Node* mem, Node* base, int offset, Node* value, BasicType bt) {
1264 Node* adr = basic_plus_adr(base, offset);
1265 mem = StoreNode::make(_igvn, ctl, mem, adr, NULL, value, bt, MemNode::unordered);
1340 // We need a Region and corresponding Phi's to merge the slow-path and fast-path results.
1341 // they will not be used if "always_slow" is set
1342 enum { slow_result_path = 1, fast_result_path = 2 };
1343 Node *result_region = NULL;
1344 Node *result_phi_rawmem = NULL;
1345 Node *result_phi_rawoop = NULL;
1346 Node *result_phi_i_o = NULL;
1347
1348 // The initial slow comparison is a size check, the comparison
1349 // we want to do is a BoolTest::gt
1350 bool always_slow = false;
1351 int tv = _igvn.find_int_con(initial_slow_test, -1);
1352 if (tv >= 0) {
1353 always_slow = (tv == 1);
1354 initial_slow_test = NULL;
1355 } else {
1356 initial_slow_test = BoolNode::make_predicate(initial_slow_test, &_igvn);
1357 }
1358
1359 if (C->env()->dtrace_alloc_probes() ||
1360 !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc())) {
1361 // Force slow-path allocation
1362 always_slow = true;
1363 initial_slow_test = NULL;
1364 }
1365
1366
1367 enum { too_big_or_final_path = 1, need_gc_path = 2 };
1368 Node *slow_region = NULL;
1369 Node *toobig_false = ctrl;
1370
1371 assert (initial_slow_test == NULL || !always_slow, "arguments must be consistent");
1372 // generate the initial test if necessary
1373 if (initial_slow_test != NULL ) {
1374 slow_region = new RegionNode(3);
1375
1376 // Now make the initial failure test. Usually a too-big test but
1377 // might be a TRUE for finalizers or a fancy class check for
1378 // newInstance0.
1379 IfNode *toobig_iff = new IfNode(ctrl, initial_slow_test, PROB_MIN, COUNT_UNKNOWN);
1380 transform_later(toobig_iff);
|
1225 #ifndef PRODUCT
1226 if (PrintEliminateAllocations) {
1227 tty->print("++++ Eliminated: %d ", boxing->_idx);
1228 boxing->method()->print_short_name(tty);
1229 tty->cr();
1230 }
1231 #endif
1232
1233 return true;
1234 }
1235
1236 //---------------------------set_eden_pointers-------------------------
1237 void PhaseMacroExpand::set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr) {
1238 if (UseTLAB) { // Private allocation: load from TLS
1239 Node* thread = transform_later(new ThreadLocalNode());
1240 int tlab_top_offset = in_bytes(JavaThread::tlab_top_offset());
1241 int tlab_end_offset = in_bytes(JavaThread::tlab_end_offset());
1242 eden_top_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_top_offset);
1243 eden_end_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_end_offset);
1244 } else { // Shared allocation: load from globals
1245 CollectedHeap* ch = GC::gc()->heap();
1246 address top_adr = (address)ch->top_addr();
1247 address end_adr = (address)ch->end_addr();
1248 eden_top_adr = makecon(TypeRawPtr::make(top_adr));
1249 eden_end_adr = basic_plus_adr(eden_top_adr, end_adr - top_adr);
1250 }
1251 }
1252
1253
1254 Node* PhaseMacroExpand::make_load(Node* ctl, Node* mem, Node* base, int offset, const Type* value_type, BasicType bt) {
1255 Node* adr = basic_plus_adr(base, offset);
1256 const TypePtr* adr_type = adr->bottom_type()->is_ptr();
1257 Node* value = LoadNode::make(_igvn, ctl, mem, adr, adr_type, value_type, bt, MemNode::unordered);
1258 transform_later(value);
1259 return value;
1260 }
1261
1262
1263 Node* PhaseMacroExpand::make_store(Node* ctl, Node* mem, Node* base, int offset, Node* value, BasicType bt) {
1264 Node* adr = basic_plus_adr(base, offset);
1265 mem = StoreNode::make(_igvn, ctl, mem, adr, NULL, value, bt, MemNode::unordered);
1340 // We need a Region and corresponding Phi's to merge the slow-path and fast-path results.
1341 // they will not be used if "always_slow" is set
1342 enum { slow_result_path = 1, fast_result_path = 2 };
1343 Node *result_region = NULL;
1344 Node *result_phi_rawmem = NULL;
1345 Node *result_phi_rawoop = NULL;
1346 Node *result_phi_i_o = NULL;
1347
1348 // The initial slow comparison is a size check, the comparison
1349 // we want to do is a BoolTest::gt
1350 bool always_slow = false;
1351 int tv = _igvn.find_int_con(initial_slow_test, -1);
1352 if (tv >= 0) {
1353 always_slow = (tv == 1);
1354 initial_slow_test = NULL;
1355 } else {
1356 initial_slow_test = BoolNode::make_predicate(initial_slow_test, &_igvn);
1357 }
1358
1359 if (C->env()->dtrace_alloc_probes() ||
1360 !UseTLAB && (!GC::gc()->heap()->supports_inline_contig_alloc())) {
1361 // Force slow-path allocation
1362 always_slow = true;
1363 initial_slow_test = NULL;
1364 }
1365
1366
1367 enum { too_big_or_final_path = 1, need_gc_path = 2 };
1368 Node *slow_region = NULL;
1369 Node *toobig_false = ctrl;
1370
1371 assert (initial_slow_test == NULL || !always_slow, "arguments must be consistent");
1372 // generate the initial test if necessary
1373 if (initial_slow_test != NULL ) {
1374 slow_region = new RegionNode(3);
1375
1376 // Now make the initial failure test. Usually a too-big test but
1377 // might be a TRUE for finalizers or a fancy class check for
1378 // newInstance0.
1379 IfNode *toobig_iff = new IfNode(ctrl, initial_slow_test, PROB_MIN, COUNT_UNKNOWN);
1380 transform_later(toobig_iff);
|