Mercurial > hg > truffle
comparison src/share/vm/opto/graphKit.cpp @ 12355:cefad50507d8
Merge with hs25-b53
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 11 Oct 2013 10:38:03 +0200 |
parents | 6b0fd0964b87 d8d059e90ec1 |
children | 096c224171c4 |
comparison
equal
deleted
inserted
replaced
12058:ccb4f2af2319 | 12355:cefad50507d8 |
---|---|
1499 ShouldNotReachHere(); | 1499 ShouldNotReachHere(); |
1500 | 1500 |
1501 } | 1501 } |
1502 } | 1502 } |
1503 | 1503 |
1504 bool GraphKit::can_move_pre_barrier() const { | |
1505 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1506 switch (bs->kind()) { | |
1507 case BarrierSet::G1SATBCT: | |
1508 case BarrierSet::G1SATBCTLogging: | |
1509 return true; // Can move it if no safepoint | |
1510 | |
1511 case BarrierSet::CardTableModRef: | |
1512 case BarrierSet::CardTableExtension: | |
1513 case BarrierSet::ModRef: | |
1514 return true; // There is no pre-barrier | |
1515 | |
1516 case BarrierSet::Other: | |
1517 default : | |
1518 ShouldNotReachHere(); | |
1519 } | |
1520 return false; | |
1521 } | |
1522 | |
1504 void GraphKit::post_barrier(Node* ctl, | 1523 void GraphKit::post_barrier(Node* ctl, |
1505 Node* store, | 1524 Node* store, |
1506 Node* obj, | 1525 Node* obj, |
1507 Node* adr, | 1526 Node* adr, |
1508 uint adr_idx, | 1527 uint adr_idx, |
3549 assert(pre_val == NULL, "loaded already?"); | 3568 assert(pre_val == NULL, "loaded already?"); |
3550 assert(val_type != NULL, "need a type"); | 3569 assert(val_type != NULL, "need a type"); |
3551 } else { | 3570 } else { |
3552 // In this case both val_type and alias_idx are unused. | 3571 // In this case both val_type and alias_idx are unused. |
3553 assert(pre_val != NULL, "must be loaded already"); | 3572 assert(pre_val != NULL, "must be loaded already"); |
3573 // Nothing to be done if pre_val is null. | |
3574 if (pre_val->bottom_type() == TypePtr::NULL_PTR) return; | |
3554 assert(pre_val->bottom_type()->basic_type() == T_OBJECT, "or we shouldn't be here"); | 3575 assert(pre_val->bottom_type()->basic_type() == T_OBJECT, "or we shouldn't be here"); |
3555 } | 3576 } |
3556 assert(bt == T_OBJECT, "or we shouldn't be here"); | 3577 assert(bt == T_OBJECT, "or we shouldn't be here"); |
3557 | 3578 |
3558 IdealKit ideal(this, true); | 3579 IdealKit ideal(this, true); |
3593 Node* index = __ load(__ ctrl(), index_adr, TypeX_X, index_bt, Compile::AliasIdxRaw); | 3614 Node* index = __ load(__ ctrl(), index_adr, TypeX_X, index_bt, Compile::AliasIdxRaw); |
3594 | 3615 |
3595 if (do_load) { | 3616 if (do_load) { |
3596 // load original value | 3617 // load original value |
3597 // alias_idx correct?? | 3618 // alias_idx correct?? |
3598 pre_val = __ load(no_ctrl, adr, val_type, bt, alias_idx); | 3619 pre_val = __ load(__ ctrl(), adr, val_type, bt, alias_idx); |
3599 } | 3620 } |
3600 | 3621 |
3601 // if (pre_val != NULL) | 3622 // if (pre_val != NULL) |
3602 __ if_then(pre_val, BoolTest::ne, null()); { | 3623 __ if_then(pre_val, BoolTest::ne, null()); { |
3603 Node* buffer = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw); | 3624 Node* buffer = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw); |
3802 const TypePtr* value_field_type = string_type->add_offset(value_offset); | 3823 const TypePtr* value_field_type = string_type->add_offset(value_offset); |
3803 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, | 3824 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, |
3804 TypeAry::make(TypeInt::CHAR,TypeInt::POS), | 3825 TypeAry::make(TypeInt::CHAR,TypeInt::POS), |
3805 ciTypeArrayKlass::make(T_CHAR), true, 0); | 3826 ciTypeArrayKlass::make(T_CHAR), true, 0); |
3806 int value_field_idx = C->get_alias_index(value_field_type); | 3827 int value_field_idx = C->get_alias_index(value_field_type); |
3807 return make_load(ctrl, basic_plus_adr(str, str, value_offset), | 3828 Node* load = make_load(ctrl, basic_plus_adr(str, str, value_offset), |
3808 value_type, T_OBJECT, value_field_idx); | 3829 value_type, T_OBJECT, value_field_idx); |
3830 // String.value field is known to be @Stable. | |
3831 if (UseImplicitStableValues) { | |
3832 load = cast_array_to_stable(load, value_type); | |
3833 } | |
3834 return load; | |
3809 } | 3835 } |
3810 | 3836 |
3811 void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) { | 3837 void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) { |
3812 int offset_offset = java_lang_String::offset_offset_in_bytes(); | 3838 int offset_offset = java_lang_String::offset_offset_in_bytes(); |
3813 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), | 3839 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), |
3821 void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { | 3847 void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { |
3822 int value_offset = java_lang_String::value_offset_in_bytes(); | 3848 int value_offset = java_lang_String::value_offset_in_bytes(); |
3823 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), | 3849 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), |
3824 false, NULL, 0); | 3850 false, NULL, 0); |
3825 const TypePtr* value_field_type = string_type->add_offset(value_offset); | 3851 const TypePtr* value_field_type = string_type->add_offset(value_offset); |
3826 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, | 3852 |
3827 TypeAry::make(TypeInt::CHAR,TypeInt::POS), | 3853 store_oop_to_object(ctrl, str, basic_plus_adr(str, value_offset), value_field_type, |
3828 ciTypeArrayKlass::make(T_CHAR), true, 0); | 3854 value, TypeAryPtr::CHARS, T_OBJECT); |
3829 int value_field_idx = C->get_alias_index(value_field_type); | |
3830 store_to_memory(ctrl, basic_plus_adr(str, value_offset), | |
3831 value, T_OBJECT, value_field_idx); | |
3832 } | 3855 } |
3833 | 3856 |
3834 void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) { | 3857 void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) { |
3835 int count_offset = java_lang_String::count_offset_in_bytes(); | 3858 int count_offset = java_lang_String::count_offset_in_bytes(); |
3836 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), | 3859 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), |
3838 const TypePtr* count_field_type = string_type->add_offset(count_offset); | 3861 const TypePtr* count_field_type = string_type->add_offset(count_offset); |
3839 int count_field_idx = C->get_alias_index(count_field_type); | 3862 int count_field_idx = C->get_alias_index(count_field_type); |
3840 store_to_memory(ctrl, basic_plus_adr(str, count_offset), | 3863 store_to_memory(ctrl, basic_plus_adr(str, count_offset), |
3841 value, T_INT, count_field_idx); | 3864 value, T_INT, count_field_idx); |
3842 } | 3865 } |
3866 | |
3867 Node* GraphKit::cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type) { | |
3868 // Reify the property as a CastPP node in Ideal graph to comply with monotonicity | |
3869 // assumption of CCP analysis. | |
3870 return _gvn.transform(new(C) CastPPNode(ary, ary_type->cast_to_stable(true))); | |
3871 } |