< prev index next >

src/hotspot/share/asm/assembler.cpp

Print this page
rev 52430 : 8213199: GC abstraction for Assembler::needs_explicit_null_check()

*** 24,33 **** --- 24,34 ---- #include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" + #include "gc/shared/collectedHeap.hpp" #include "runtime/atomic.hpp" #include "runtime/icache.hpp" #include "runtime/os.hpp" #include "runtime/thread.hpp"
*** 305,327 **** return code_section()->outer()->code_string(str); } return NULL; } ! bool MacroAssembler::needs_explicit_null_check(intptr_t offset) { // Exception handler checks the nmethod's implicit null checks table // only when this method returns false. #ifdef _LP64 if (UseCompressedOops && Universe::narrow_oop_base() != NULL) { ! assert (Universe::heap() != NULL, "java heap should be initialized"); ! // The first page after heap_base is unmapped and ! // the 'offset' is equal to [heap_base + offset] for ! // narrow oop implicit null checks. ! uintptr_t base = (uintptr_t)Universe::narrow_oop_base(); ! if ((uintptr_t)offset >= base) { ! // Normalize offset for the next check. ! offset = (intptr_t)(pointer_delta((void*)offset, (void*)base, 1)); } } #endif ! return offset < 0 || os::vm_page_size() <= offset; } --- 306,339 ---- return code_section()->outer()->code_string(str); } return NULL; } ! bool MacroAssembler::uses_implicit_null_check(void* address) { // Exception handler checks the nmethod's implicit null checks table // only when this method returns false. + intptr_t int_address = reinterpret_cast<intptr_t>(address); + intptr_t cell_header_size = Universe::heap()->cell_header_size(); + size_t region_size = os::vm_page_size() + cell_header_size; #ifdef _LP64 if (UseCompressedOops && Universe::narrow_oop_base() != NULL) { ! // A SEGV can legitimately happen in C2 code at address ! // (heap_base + offset) if Matcher::narrow_oop_use_complex_address ! // is configured to allow narrow oops field loads to be implicitly ! // null checked ! intptr_t start = ((intptr_t)Universe::narrow_oop_base()) - cell_header_size; ! intptr_t end = start + region_size; ! if (int_address >= start && int_address < end) { ! return true; } } #endif ! intptr_t start = -cell_header_size; ! intptr_t end = start + region_size; ! return int_address >= start && int_address < end; ! } ! ! bool MacroAssembler::needs_explicit_null_check(intptr_t offset) { ! // Check if offset is outside of [-cell_header_size, os::vm_page_size) ! return offset < -Universe::heap()->cell_header_size() || ! offset >= os::vm_page_size(); }
< prev index next >