src/share/vm/opto/library_call.cpp

changeset 8656
7ca49bca3c2a
parent 8655
0de3b29d549d
child 8856
ac27a9c85bea
child 8903
9575483cce09
equal deleted inserted replaced
8655:0de3b29d549d 8656:7ca49bca3c2a
2628 ptr = ConvL2X(ptr); // adjust Java long to machine word 2628 ptr = ConvL2X(ptr); // adjust Java long to machine word
2629 adr = make_unsafe_address(NULL, ptr); 2629 adr = make_unsafe_address(NULL, ptr);
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.
2634 bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop));
2635
2633 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); 2636 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr();
2634 2637
2635 // Try to categorize the address. If it comes up as TypeJavaPtr::BOTTOM, 2638 // Try to categorize the address.
2636 // there was not enough information to nail it down.
2637 Compile::AliasType* alias_type = C->alias_type(adr_type); 2639 Compile::AliasType* alias_type = C->alias_type(adr_type);
2638 assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); 2640 assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here");
2639 2641
2640 // Only field, array element or unknown locations are supported. 2642 if (alias_type->adr_type() == TypeInstPtr::KLASS ||
2641 if (alias_type->adr_type() != TypeRawPtr::BOTTOM && 2643 alias_type->adr_type() == TypeAryPtr::RANGE) {
2642 alias_type->adr_type() != TypeOopPtr::BOTTOM && 2644 return false; // not supported
2643 alias_type->basic_type() == T_ILLEGAL) {
2644 return false;
2645 } 2645 }
2646 2646
2647 bool mismatched = false; 2647 bool mismatched = false;
2648 BasicType bt = alias_type->basic_type(); 2648 BasicType bt = alias_type->basic_type();
2649 if (bt != T_ILLEGAL) { 2649 if (bt != T_ILLEGAL) {
2650 assert(alias_type->adr_type()->is_oopptr(), "should be on-heap access");
2650 if (bt == T_BYTE && adr_type->isa_aryptr()) { 2651 if (bt == T_BYTE && adr_type->isa_aryptr()) {
2651 // Alias type doesn't differentiate between byte[] and boolean[]). 2652 // Alias type doesn't differentiate between byte[] and boolean[]).
2652 // Use address type to get the element type. 2653 // Use address type to get the element type.
2653 bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); 2654 bt = adr_type->is_aryptr()->elem()->array_element_basic_type();
2654 } 2655 }
2660 // Don't intrinsify mismatched object accesses 2661 // Don't intrinsify mismatched object accesses
2661 return false; 2662 return false;
2662 } 2663 }
2663 mismatched = (bt != type); 2664 mismatched = (bt != type);
2664 } 2665 }
2666
2667 assert(!mismatched || alias_type->adr_type()->is_oopptr(), "off-heap access can't be mismatched");
2665 2668
2666 // First guess at the value type. 2669 // First guess at the value type.
2667 const Type *value_type = Type::get_const_basic_type(type); 2670 const Type *value_type = Type::get_const_basic_type(type);
2668 2671
2669 // We will need memory barriers unless we can determine a unique 2672 // We will need memory barriers unless we can determine a unique
2775 MemNode::MemOrd mo = is_volatile ? MemNode::release : MemNode::unordered; 2778 MemNode::MemOrd mo = is_volatile ? MemNode::release : MemNode::unordered;
2776 if (type != T_OBJECT ) { 2779 if (type != T_OBJECT ) {
2777 (void) store_to_memory(control(), adr, val, type, adr_type, mo, is_volatile, unaligned, mismatched); 2780 (void) store_to_memory(control(), adr, val, type, adr_type, mo, is_volatile, unaligned, mismatched);
2778 } else { 2781 } else {
2779 // Possibly an oop being stored to Java heap or native memory 2782 // Possibly an oop being stored to Java heap or native memory
2780 if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) { 2783 if (!can_access_non_heap) {
2781 // oop to Java heap. 2784 // oop to Java heap.
2782 (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched); 2785 (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched);
2783 } else { 2786 } else {
2784 // We can't tell at compile time if we are storing in the Java heap or outside 2787 // We can't tell at compile time if we are storing in the Java heap or outside
2785 // of it. So we need to emit code to conditionally do the proper type of 2788 // of it. So we need to emit code to conditionally do the proper type of

mercurial