comparison src/share/vm/opto/graphKit.cpp @ 3284:286c498ae0d4

Merge
author kvn
date Fri, 29 Apr 2011 11:15:30 -0700
parents 149bb459be66 5d046bf49ce7
children bad7ecd0b6ed
comparison
equal deleted inserted replaced
3283:01fd6090fdd8 3284:286c498ae0d4
1451 1451
1452 return st; 1452 return st;
1453 } 1453 }
1454 1454
1455 1455
1456 void GraphKit::pre_barrier(Node* ctl, 1456 void GraphKit::pre_barrier(bool do_load,
1457 Node* ctl,
1457 Node* obj, 1458 Node* obj,
1458 Node* adr, 1459 Node* adr,
1459 uint adr_idx, 1460 uint adr_idx,
1460 Node* val, 1461 Node* val,
1461 const TypeOopPtr* val_type, 1462 const TypeOopPtr* val_type,
1463 Node* pre_val,
1462 BasicType bt) { 1464 BasicType bt) {
1465
1463 BarrierSet* bs = Universe::heap()->barrier_set(); 1466 BarrierSet* bs = Universe::heap()->barrier_set();
1464 set_control(ctl); 1467 set_control(ctl);
1465 switch (bs->kind()) { 1468 switch (bs->kind()) {
1466 case BarrierSet::G1SATBCT: 1469 case BarrierSet::G1SATBCT:
1467 case BarrierSet::G1SATBCTLogging: 1470 case BarrierSet::G1SATBCTLogging:
1468 g1_write_barrier_pre(obj, adr, adr_idx, val, val_type, bt); 1471 g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
1469 break; 1472 break;
1470 1473
1471 case BarrierSet::CardTableModRef: 1474 case BarrierSet::CardTableModRef:
1472 case BarrierSet::CardTableExtension: 1475 case BarrierSet::CardTableExtension:
1473 case BarrierSet::ModRef: 1476 case BarrierSet::ModRef:
1526 assert(bt == T_OBJECT, "sanity"); 1529 assert(bt == T_OBJECT, "sanity");
1527 assert(val != NULL, "not dead path"); 1530 assert(val != NULL, "not dead path");
1528 uint adr_idx = C->get_alias_index(adr_type); 1531 uint adr_idx = C->get_alias_index(adr_type);
1529 assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" ); 1532 assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
1530 1533
1531 pre_barrier(control(), obj, adr, adr_idx, val, val_type, bt); 1534 pre_barrier(true /* do_load */,
1535 control(), obj, adr, adr_idx, val, val_type,
1536 NULL /* pre_val */,
1537 bt);
1538
1532 Node* store = store_to_memory(control(), adr, val, bt, adr_idx); 1539 Node* store = store_to_memory(control(), adr, val, bt, adr_idx);
1533 post_barrier(control(), store, obj, adr, adr_idx, val, bt, use_precise); 1540 post_barrier(control(), store, obj, adr, adr_idx, val, bt, use_precise);
1534 return store; 1541 return store;
1535 } 1542 }
1536 1543
3477 // Final sync IdealKit and GraphKit. 3484 // Final sync IdealKit and GraphKit.
3478 final_sync(ideal); 3485 final_sync(ideal);
3479 } 3486 }
3480 3487
3481 // G1 pre/post barriers 3488 // G1 pre/post barriers
3482 void GraphKit::g1_write_barrier_pre(Node* obj, 3489 void GraphKit::g1_write_barrier_pre(bool do_load,
3490 Node* obj,
3483 Node* adr, 3491 Node* adr,
3484 uint alias_idx, 3492 uint alias_idx,
3485 Node* val, 3493 Node* val,
3486 const TypeOopPtr* val_type, 3494 const TypeOopPtr* val_type,
3495 Node* pre_val,
3487 BasicType bt) { 3496 BasicType bt) {
3497
3498 // Some sanity checks
3499 // Note: val is unused in this routine.
3500
3501 if (do_load) {
3502 // We need to generate the load of the previous value
3503 assert(obj != NULL, "must have a base");
3504 assert(adr != NULL, "where are loading from?");
3505 assert(pre_val == NULL, "loaded already?");
3506 assert(val_type != NULL, "need a type");
3507 } else {
3508 // In this case both val_type and alias_idx are unused.
3509 assert(pre_val != NULL, "must be loaded already");
3510 assert(pre_val->bottom_type()->basic_type() == T_OBJECT, "or we shouldn't be here");
3511 }
3512 assert(bt == T_OBJECT, "or we shouldn't be here");
3513
3488 IdealKit ideal(this, true); 3514 IdealKit ideal(this, true);
3489 3515
3490 Node* tls = __ thread(); // ThreadLocalStorage 3516 Node* tls = __ thread(); // ThreadLocalStorage
3491 3517
3492 Node* no_ctrl = NULL; 3518 Node* no_ctrl = NULL;
3504 PtrQueue::byte_offset_of_active()); 3530 PtrQueue::byte_offset_of_active());
3505 const int index_offset = in_bytes(JavaThread::satb_mark_queue_offset() + // 656 3531 const int index_offset = in_bytes(JavaThread::satb_mark_queue_offset() + // 656
3506 PtrQueue::byte_offset_of_index()); 3532 PtrQueue::byte_offset_of_index());
3507 const int buffer_offset = in_bytes(JavaThread::satb_mark_queue_offset() + // 652 3533 const int buffer_offset = in_bytes(JavaThread::satb_mark_queue_offset() + // 652
3508 PtrQueue::byte_offset_of_buf()); 3534 PtrQueue::byte_offset_of_buf());
3535
3509 // Now the actual pointers into the thread 3536 // Now the actual pointers into the thread
3510
3511 // set_control( ctl);
3512
3513 Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset)); 3537 Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset));
3514 Node* buffer_adr = __ AddP(no_base, tls, __ ConX(buffer_offset)); 3538 Node* buffer_adr = __ AddP(no_base, tls, __ ConX(buffer_offset));
3515 Node* index_adr = __ AddP(no_base, tls, __ ConX(index_offset)); 3539 Node* index_adr = __ AddP(no_base, tls, __ ConX(index_offset));
3516 3540
3517 // Now some of the values 3541 // Now some of the values
3518
3519 Node* marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw); 3542 Node* marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw);
3520 3543
3521 // if (!marking) 3544 // if (!marking)
3522 __ if_then(marking, BoolTest::ne, zero); { 3545 __ if_then(marking, BoolTest::ne, zero); {
3523 Node* index = __ load(__ ctrl(), index_adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw); 3546 Node* index = __ load(__ ctrl(), index_adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw);
3524 3547
3525 const Type* t1 = adr->bottom_type(); 3548 if (do_load) {
3526 const Type* t2 = val->bottom_type();
3527
3528 Node* orig = __ load(no_ctrl, adr, val_type, bt, alias_idx);
3529 // if (orig != NULL)
3530 __ if_then(orig, BoolTest::ne, null()); {
3531 Node* buffer = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw);
3532
3533 // load original value 3549 // load original value
3534 // alias_idx correct?? 3550 // alias_idx correct??
3551 pre_val = __ load(no_ctrl, adr, val_type, bt, alias_idx);
3552 }
3553
3554 // if (pre_val != NULL)
3555 __ if_then(pre_val, BoolTest::ne, null()); {
3556 Node* buffer = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw);
3535 3557
3536 // is the queue for this thread full? 3558 // is the queue for this thread full?
3537 __ if_then(index, BoolTest::ne, zero, likely); { 3559 __ if_then(index, BoolTest::ne, zero, likely); {
3538 3560
3539 // decrement the index 3561 // decrement the index
3543 // We could refine the type for what it's worth 3565 // We could refine the type for what it's worth
3544 // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue); 3566 // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue);
3545 next_indexX = _gvn.transform( new (C, 2) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) ); 3567 next_indexX = _gvn.transform( new (C, 2) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) );
3546 #endif 3568 #endif
3547 3569
3548 // Now get the buffer location we will log the original value into and store it 3570 // Now get the buffer location we will log the previous value into and store it
3549 Node *log_addr = __ AddP(no_base, buffer, next_indexX); 3571 Node *log_addr = __ AddP(no_base, buffer, next_indexX);
3550 __ store(__ ctrl(), log_addr, orig, T_OBJECT, Compile::AliasIdxRaw); 3572 __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw);
3551
3552 // update the index 3573 // update the index
3553 __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw); 3574 __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw);
3554 3575
3555 } __ else_(); { 3576 } __ else_(); {
3556 3577
3557 // logging buffer is full, call the runtime 3578 // logging buffer is full, call the runtime
3558 const TypeFunc *tf = OptoRuntime::g1_wb_pre_Type(); 3579 const TypeFunc *tf = OptoRuntime::g1_wb_pre_Type();
3559 __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", orig, tls); 3580 __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", pre_val, tls);
3560 } __ end_if(); // (!index) 3581 } __ end_if(); // (!index)
3561 } __ end_if(); // (orig != NULL) 3582 } __ end_if(); // (pre_val != NULL)
3562 } __ end_if(); // (!marking) 3583 } __ end_if(); // (!marking)
3563 3584
3564 // Final sync IdealKit and GraphKit. 3585 // Final sync IdealKit and GraphKit.
3565 final_sync(ideal); 3586 final_sync(ideal);
3566 } 3587 }