1 /* |
1 /* |
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
2542 if (sharpened_klass != NULL && sharpened_klass->is_loaded()) { |
2542 if (sharpened_klass != NULL && sharpened_klass->is_loaded()) { |
2543 const TypeOopPtr* tjp = TypeOopPtr::make_from_klass(sharpened_klass); |
2543 const TypeOopPtr* tjp = TypeOopPtr::make_from_klass(sharpened_klass); |
2544 |
2544 |
2545 #ifndef PRODUCT |
2545 #ifndef PRODUCT |
2546 if (C->print_intrinsics() || C->print_inlining()) { |
2546 if (C->print_intrinsics() || C->print_inlining()) { |
2547 tty->print(" from base type: "); adr_type->dump(); |
2547 tty->print(" from base type: "); adr_type->dump(); tty->cr(); |
2548 tty->print(" sharpened value: "); tjp->dump(); |
2548 tty->print(" sharpened value: "); tjp->dump(); tty->cr(); |
2549 } |
2549 } |
2550 #endif |
2550 #endif |
2551 // Sharpen the value type. |
2551 // Sharpen the value type. |
2552 return tjp; |
2552 return tjp; |
2553 } |
2553 } |
2630 val = is_store ? argument(3) : NULL; |
2630 val = is_store ? argument(3) : NULL; |
2631 } |
2631 } |
2632 |
2632 |
2633 // Can base be NULL? Otherwise, always on-heap access. |
2633 // Can base be NULL? Otherwise, always on-heap access. |
2634 bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop)); |
2634 bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop)); |
|
2635 if (can_access_non_heap && type == T_OBJECT) { |
|
2636 return false; // off-heap oop accesses are not supported |
|
2637 } |
2635 |
2638 |
2636 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); |
2639 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); |
2637 |
2640 |
2638 // Try to categorize the address. |
2641 // Try to categorize the address. |
2639 Compile::AliasType* alias_type = C->alias_type(adr_type); |
2642 Compile::AliasType* alias_type = C->alias_type(adr_type); |
2774 val = _gvn.transform(new (C) CastX2PNode(val)); |
2777 val = _gvn.transform(new (C) CastX2PNode(val)); |
2775 break; |
2778 break; |
2776 } |
2779 } |
2777 |
2780 |
2778 MemNode::MemOrd mo = is_volatile ? MemNode::release : MemNode::unordered; |
2781 MemNode::MemOrd mo = is_volatile ? MemNode::release : MemNode::unordered; |
2779 if (type != T_OBJECT ) { |
2782 if (type == T_OBJECT ) { |
|
2783 (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched); |
|
2784 } else { |
2780 (void) store_to_memory(control(), adr, val, type, adr_type, mo, is_volatile, unaligned, mismatched); |
2785 (void) store_to_memory(control(), adr, val, type, adr_type, mo, is_volatile, unaligned, mismatched); |
2781 } else { |
|
2782 // Possibly an oop being stored to Java heap or native memory |
|
2783 if (!can_access_non_heap) { |
|
2784 // oop to Java heap. |
|
2785 (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched); |
|
2786 } else { |
|
2787 // We can't tell at compile time if we are storing in the Java heap or outside |
|
2788 // of it. So we need to emit code to conditionally do the proper type of |
|
2789 // store. |
|
2790 |
|
2791 IdealKit ideal(this); |
|
2792 #define __ ideal. |
|
2793 // QQQ who knows what probability is here?? |
|
2794 __ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); { |
|
2795 // Sync IdealKit and graphKit. |
|
2796 sync_kit(ideal); |
|
2797 Node* st = store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched); |
|
2798 // Update IdealKit memory. |
|
2799 __ sync_kit(this); |
|
2800 } __ else_(); { |
|
2801 __ store(__ ctrl(), adr, val, type, alias_type->index(), mo, is_volatile, mismatched); |
|
2802 } __ end_if(); |
|
2803 // Final sync IdealKit and GraphKit. |
|
2804 final_sync(ideal); |
|
2805 #undef __ |
|
2806 } |
|
2807 } |
2786 } |
2808 } |
2787 } |
2809 |
2788 |
2810 if (is_volatile) { |
2789 if (is_volatile) { |
2811 if (!is_store) { |
2790 if (!is_store) { |