88 Address as_Address(AddressLiteral adr); 89 Address as_Address(ArrayAddress adr); 90 91 // Support for NULL-checks 92 // 93 // Generates code that causes a NULL OS exception if the content of reg is NULL. 94 // If the accessed location is M[reg + offset] and the offset is known, provide the 95 // offset. No explicit code generation is needed if the offset is within a certain 96 // range (0 <= offset <= page_size). 97 98 void null_check(Register reg, int offset = -1); 99 static bool needs_explicit_null_check(intptr_t offset); 100 static bool uses_implicit_null_check(void* address); 101 102 void test_klass_is_value(Register klass, Register temp_reg, Label& is_value); 103 104 void test_field_is_flattenable(Register flags, Register temp_reg, Label& is_flattenable); 105 void test_field_is_not_flattenable(Register flags, Register temp_reg, Label& notFlattenable); 106 void test_field_is_flattened(Register flags, Register temp_reg, Label& is_flattened); 107 108 // Check klass/oops is flat value type array (oop->_klass->_layout_helper & vt_bit) 109 void test_flat_array_klass(Register klass, Register temp_reg, Label& is_flat_array); 110 void test_flat_array_oop(Register oop, Register temp_reg, Label& is_flat_array); 111 112 // Required platform-specific helpers for Label::patch_instructions. 113 // They _shadow_ the declarations in AbstractAssembler, which are undefined. 114 void pd_patch_instruction(address branch, address target, const char* file, int line) { 115 unsigned char op = branch[0]; 116 assert(op == 0xE8 /* call */ || 117 op == 0xE9 /* jmp */ || 118 op == 0xEB /* short jmp */ || 119 (op & 0xF0) == 0x70 /* short jcc */ || 120 op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ || 121 op == 0xC7 && branch[1] == 0xF8 /* xbegin */, 122 "Invalid opcode at patch point"); 123 124 if (op == 0xEB || (op & 0xF0) == 0x70) { 125 // short offset operators (jmp and jcc) 126 char* disp = (char*) &branch[1]; 127 int imm8 = target - (address) &disp[1]; 128 guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d", file, line); 129 *disp = imm8; 130 } else { 310 void reset_last_Java_frame(bool clear_fp); 311 312 // jobjects 313 void clear_jweak_tag(Register possibly_jweak); 314 void resolve_jobject(Register value, Register thread, Register tmp); 315 316 // C 'boolean' to Java boolean: x == 0 ? 0 : 1 317 void c2bool(Register x); 318 319 // C++ bool manipulation 320 321 void movbool(Register dst, Address src); 322 void movbool(Address dst, bool boolconst); 323 void movbool(Address dst, Register src); 324 void testbool(Register dst); 325 326 void resolve_oop_handle(Register result, Register tmp = rscratch2); 327 void load_mirror(Register mirror, Register method, Register tmp = rscratch2); 328 329 // oop manipulations 330 void load_klass(Register dst, Register src); 331 void store_klass(Register dst, Register src); 332 333 void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src, 334 Register tmp1, Register thread_tmp); 335 void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src, 336 Register tmp1, Register tmp2); 337 338 // Resolves obj access. Result is placed in the same register. 339 // All other registers are preserved. 340 void resolve(DecoratorSet decorators, Register obj); 341 342 void load_heap_oop(Register dst, Address src, Register tmp1 = noreg, 343 Register thread_tmp = noreg, DecoratorSet decorators = 0); 344 void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg, 345 Register thread_tmp = noreg, DecoratorSet decorators = 0); 346 void store_heap_oop(Address dst, Register src, Register tmp1 = noreg, 347 Register tmp2 = noreg, DecoratorSet decorators = 0); 348 349 // Used for storing NULL. All other oop constants should be | 88 Address as_Address(AddressLiteral adr); 89 Address as_Address(ArrayAddress adr); 90 91 // Support for NULL-checks 92 // 93 // Generates code that causes a NULL OS exception if the content of reg is NULL. 94 // If the accessed location is M[reg + offset] and the offset is known, provide the 95 // offset. No explicit code generation is needed if the offset is within a certain 96 // range (0 <= offset <= page_size). 97 98 void null_check(Register reg, int offset = -1); 99 static bool needs_explicit_null_check(intptr_t offset); 100 static bool uses_implicit_null_check(void* address); 101 102 void test_klass_is_value(Register klass, Register temp_reg, Label& is_value); 103 104 void test_field_is_flattenable(Register flags, Register temp_reg, Label& is_flattenable); 105 void test_field_is_not_flattenable(Register flags, Register temp_reg, Label& notFlattenable); 106 void test_field_is_flattened(Register flags, Register temp_reg, Label& is_flattened); 107 108 // Check oops array storage properties, i.e. flattened and/or null-free 109 void test_flattened_array_oop(Register oop, Register temp_reg, Label&is_flattened_array); 110 void test_null_free_array_oop(Register oop, Register temp_reg, Label&is_null_free_array); 111 112 // Required platform-specific helpers for Label::patch_instructions. 113 // They _shadow_ the declarations in AbstractAssembler, which are undefined. 114 void pd_patch_instruction(address branch, address target, const char* file, int line) { 115 unsigned char op = branch[0]; 116 assert(op == 0xE8 /* call */ || 117 op == 0xE9 /* jmp */ || 118 op == 0xEB /* short jmp */ || 119 (op & 0xF0) == 0x70 /* short jcc */ || 120 op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ || 121 op == 0xC7 && branch[1] == 0xF8 /* xbegin */, 122 "Invalid opcode at patch point"); 123 124 if (op == 0xEB || (op & 0xF0) == 0x70) { 125 // short offset operators (jmp and jcc) 126 char* disp = (char*) &branch[1]; 127 int imm8 = target - (address) &disp[1]; 128 guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d", file, line); 129 *disp = imm8; 130 } else { 310 void reset_last_Java_frame(bool clear_fp); 311 312 // jobjects 313 void clear_jweak_tag(Register possibly_jweak); 314 void resolve_jobject(Register value, Register thread, Register tmp); 315 316 // C 'boolean' to Java boolean: x == 0 ? 0 : 1 317 void c2bool(Register x); 318 319 // C++ bool manipulation 320 321 void movbool(Register dst, Address src); 322 void movbool(Address dst, bool boolconst); 323 void movbool(Address dst, Register src); 324 void testbool(Register dst); 325 326 void resolve_oop_handle(Register result, Register tmp = rscratch2); 327 void load_mirror(Register mirror, Register method, Register tmp = rscratch2); 328 329 // oop manipulations 330 void load_metadata(Register dst, Register src); 331 void load_storage_props(Register dst, Register src); 332 void load_klass(Register dst, Register src); 333 void store_klass(Register dst, Register src); 334 335 void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src, 336 Register tmp1, Register thread_tmp); 337 void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src, 338 Register tmp1, Register tmp2); 339 340 // Resolves obj access. Result is placed in the same register. 341 // All other registers are preserved. 342 void resolve(DecoratorSet decorators, Register obj); 343 344 void load_heap_oop(Register dst, Address src, Register tmp1 = noreg, 345 Register thread_tmp = noreg, DecoratorSet decorators = 0); 346 void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg, 347 Register thread_tmp = noreg, DecoratorSet decorators = 0); 348 void store_heap_oop(Address dst, Register src, Register tmp1 = noreg, 349 Register tmp2 = noreg, DecoratorSet decorators = 0); 350 351 // Used for storing NULL. All other oop constants should be |