< prev index next >

src/share/vm/opto/library_call.cpp

Print this page

        

*** 2628,2654 **** ptr = ConvL2X(ptr); // adjust Java long to machine word adr = make_unsafe_address(NULL, ptr); val = is_store ? argument(3) : NULL; } const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); ! // Try to categorize the address. If it comes up as TypeJavaPtr::BOTTOM, ! // there was not enough information to nail it down. Compile::AliasType* alias_type = C->alias_type(adr_type); assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); ! // Only field, array element or unknown locations are supported. ! if (alias_type->adr_type() != TypeRawPtr::BOTTOM && ! alias_type->adr_type() != TypeOopPtr::BOTTOM && ! alias_type->basic_type() == T_ILLEGAL) { ! return false; } bool mismatched = false; BasicType bt = alias_type->basic_type(); if (bt != T_ILLEGAL) { if (bt == T_BYTE && adr_type->isa_aryptr()) { // Alias type doesn't differentiate between byte[] and boolean[]). // Use address type to get the element type. bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); } --- 2628,2655 ---- ptr = ConvL2X(ptr); // adjust Java long to machine word adr = make_unsafe_address(NULL, ptr); val = is_store ? argument(3) : NULL; } + // Can base be NULL? Otherwise, always on-heap access. + bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop)); + const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); ! // Try to categorize the address. Compile::AliasType* alias_type = C->alias_type(adr_type); assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); ! if (alias_type->adr_type() == TypeInstPtr::KLASS || ! alias_type->adr_type() == TypeAryPtr::RANGE) { ! return false; // not supported } bool mismatched = false; BasicType bt = alias_type->basic_type(); if (bt != T_ILLEGAL) { + assert(alias_type->adr_type()->is_oopptr(), "should be on-heap access"); if (bt == T_BYTE && adr_type->isa_aryptr()) { // Alias type doesn't differentiate between byte[] and boolean[]). // Use address type to get the element type. bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); }
*** 2661,2670 **** --- 2662,2673 ---- return false; } mismatched = (bt != type); } + assert(!mismatched || alias_type->adr_type()->is_oopptr(), "off-heap access can't be mismatched"); + // First guess at the value type. const Type *value_type = Type::get_const_basic_type(type); // We will need memory barriers unless we can determine a unique // alias category for this reference. (Note: If for some reason
*** 2775,2785 **** MemNode::MemOrd mo = is_volatile ? MemNode::release : MemNode::unordered; if (type != T_OBJECT ) { (void) store_to_memory(control(), adr, val, type, adr_type, mo, is_volatile, unaligned, mismatched); } else { // Possibly an oop being stored to Java heap or native memory ! if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) { // oop to Java heap. (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched); } else { // We can't tell at compile time if we are storing in the Java heap or outside // of it. So we need to emit code to conditionally do the proper type of --- 2778,2788 ---- MemNode::MemOrd mo = is_volatile ? MemNode::release : MemNode::unordered; if (type != T_OBJECT ) { (void) store_to_memory(control(), adr, val, type, adr_type, mo, is_volatile, unaligned, mismatched); } else { // Possibly an oop being stored to Java heap or native memory ! if (!can_access_non_heap) { // oop to Java heap. (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched); } else { // We can't tell at compile time if we are storing in the Java heap or outside // of it. So we need to emit code to conditionally do the proper type of
< prev index next >