84 // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code. 85 // The implementation is only non-empty for the InterpreterMacroAssembler, 86 // as only the interpreter handles PopFrame and ForceEarlyReturn requests. 87 virtual void check_and_handle_popframe(Register java_thread); 88 virtual void check_and_handle_earlyret(Register java_thread); 89 90 Address as_Address(AddressLiteral adr); 91 Address as_Address(ArrayAddress adr); 92 93 // Support for NULL-checks 94 // 95 // Generates code that causes a NULL OS exception if the content of reg is NULL. 96 // If the accessed location is M[reg + offset] and the offset is known, provide the 97 // offset. No explicit code generation is needed if the offset is within a certain 98 // range (0 <= offset <= page_size). 99 100 void null_check(Register reg, int offset = -1); 101 static bool needs_explicit_null_check(intptr_t offset); 102 static bool uses_implicit_null_check(void* address); 103 104 void test_klass_is_value(Register klass, Register temp_reg, Label& is_value); 105 106 void test_field_is_flattenable(Register flags, Register temp_reg, Label& is_flattenable); 107 void test_field_is_not_flattenable(Register flags, Register temp_reg, Label& notFlattenable); 108 void test_field_is_flattened(Register flags, Register temp_reg, Label& is_flattened); 109 110 // Check oops array storage properties, i.e. flattened and/or null-free 111 void test_flattened_array_oop(Register oop, Register temp_reg, Label&is_flattened_array); 112 void test_null_free_array_oop(Register oop, Register temp_reg, Label&is_null_free_array); 113 114 // Required platform-specific helpers for Label::patch_instructions. 115 // They _shadow_ the declarations in AbstractAssembler, which are undefined. 116 void pd_patch_instruction(address branch, address target, const char* file, int line) { 117 unsigned char op = branch[0]; 118 assert(op == 0xE8 /* call */ || 119 op == 0xE9 /* jmp */ || 120 op == 0xEB /* short jmp */ || 121 (op & 0xF0) == 0x70 /* short jcc */ || 122 op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ || 123 op == 0xC7 && branch[1] == 0xF8 /* xbegin */, 124 "Invalid opcode at patch point"); 327 void testbool(Register dst); 328 329 void resolve_oop_handle(Register result, Register tmp = rscratch2); 330 void resolve_weak_handle(Register result, Register tmp); 331 void load_mirror(Register mirror, Register method, Register tmp = rscratch2); 332 void load_method_holder_cld(Register rresult, Register rmethod); 333 334 void load_method_holder(Register holder, Register method); 335 336 // oop manipulations 337 void load_metadata(Register dst, Register src); 338 void load_storage_props(Register dst, Register src); 339 void load_klass(Register dst, Register src); 340 void store_klass(Register dst, Register src); 341 342 void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src, 343 Register tmp1, Register thread_tmp); 344 void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src, 345 Register tmp1, Register tmp2, Register tmp3 = noreg); 346 347 // Resolves obj access. Result is placed in the same register. 348 // All other registers are preserved. 349 void resolve(DecoratorSet decorators, Register obj); 350 351 void load_heap_oop(Register dst, Address src, Register tmp1 = noreg, 352 Register thread_tmp = noreg, DecoratorSet decorators = 0); 353 void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg, 354 Register thread_tmp = noreg, DecoratorSet decorators = 0); 355 void store_heap_oop(Address dst, Register src, Register tmp1 = noreg, 356 Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0); 357 358 // Used for storing NULL. All other oop constants should be 359 // stored using routines that take a jobject. 360 void store_heap_oop_null(Address dst); 361 362 void load_prototype_header(Register dst, Register src); 363 364 #ifdef _LP64 365 void store_klass_gap(Register dst, Register src); 366 515 516 void empty_FPU_stack(); 517 518 void push_IU_state(); 519 void pop_IU_state(); 520 521 void push_FPU_state(); 522 void pop_FPU_state(); 523 524 void push_CPU_state(); 525 void pop_CPU_state(); 526 527 // Round up to a power of two 528 void round_to(Register reg, int modulus); 529 530 // Callee saved registers handling 531 void push_callee_saved_registers(); 532 void pop_callee_saved_registers(); 533 534 // allocation 535 void eden_allocate( 536 Register thread, // Current thread 537 Register obj, // result: pointer to object after successful allocation 538 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise 539 int con_size_in_bytes, // object size in bytes if known at compile time 540 Register t1, // temp register 541 Label& slow_case // continuation point if fast allocation fails 542 ); 543 void tlab_allocate( 544 Register thread, // Current thread 545 Register obj, // result: pointer to object after successful allocation 546 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise 547 int con_size_in_bytes, // object size in bytes if known at compile time 548 Register t1, // temp register 549 Register t2, // temp register 550 Label& slow_case // continuation point if fast allocation fails 551 ); 552 void zero_memory(Register address, Register length_in_bytes, int offset_in_bytes, Register temp); 553 554 // interface method calling 555 void lookup_interface_method(Register recv_klass, 556 Register intf_klass, 557 RegisterOrConstant itable_index, 558 Register method_result, 559 Register scan_temp, 560 Label& no_such_interface, 561 bool return_method = true); 562 563 // virtual method calling 564 void lookup_virtual_method(Register recv_klass, 565 RegisterOrConstant vtable_index, 566 Register method_result); 567 568 // Test sub_klass against super_klass, with fast and slow paths. 569 570 // The fast path produces a tri-state answer: yes / no / maybe-slow. 571 // One of the three labels can be NULL, meaning take the fall-through. 572 // If super_check_offset is -1, the value is loaded up from super_klass. | 84 // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code. 85 // The implementation is only non-empty for the InterpreterMacroAssembler, 86 // as only the interpreter handles PopFrame and ForceEarlyReturn requests. 87 virtual void check_and_handle_popframe(Register java_thread); 88 virtual void check_and_handle_earlyret(Register java_thread); 89 90 Address as_Address(AddressLiteral adr); 91 Address as_Address(ArrayAddress adr); 92 93 // Support for NULL-checks 94 // 95 // Generates code that causes a NULL OS exception if the content of reg is NULL. 96 // If the accessed location is M[reg + offset] and the offset is known, provide the 97 // offset. No explicit code generation is needed if the offset is within a certain 98 // range (0 <= offset <= page_size). 99 100 void null_check(Register reg, int offset = -1); 101 static bool needs_explicit_null_check(intptr_t offset); 102 static bool uses_implicit_null_check(void* address); 103 104 // valueKlass queries, kills temp_reg 105 void test_klass_is_value(Register klass, Register temp_reg, Label& is_value); 106 void test_klass_is_empty_value(Register klass, Register temp_reg, Label& is_empty_value); 107 // For field "index" within "klass", return value_klass ... 108 void get_empty_value_oop(Register klass, Register temp_reg, Register obj); 109 110 void test_field_is_flattenable(Register flags, Register temp_reg, Label& is_flattenable); 111 void test_field_is_not_flattenable(Register flags, Register temp_reg, Label& notFlattenable); 112 void test_field_is_flattened(Register flags, Register temp_reg, Label& is_flattened); 113 114 // Check oops array storage properties, i.e. flattened and/or null-free 115 void test_flattened_array_oop(Register oop, Register temp_reg, Label&is_flattened_array); 116 void test_null_free_array_oop(Register oop, Register temp_reg, Label&is_null_free_array); 117 118 // Required platform-specific helpers for Label::patch_instructions. 119 // They _shadow_ the declarations in AbstractAssembler, which are undefined. 120 void pd_patch_instruction(address branch, address target, const char* file, int line) { 121 unsigned char op = branch[0]; 122 assert(op == 0xE8 /* call */ || 123 op == 0xE9 /* jmp */ || 124 op == 0xEB /* short jmp */ || 125 (op & 0xF0) == 0x70 /* short jcc */ || 126 op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ || 127 op == 0xC7 && branch[1] == 0xF8 /* xbegin */, 128 "Invalid opcode at patch point"); 331 void testbool(Register dst); 332 333 void resolve_oop_handle(Register result, Register tmp = rscratch2); 334 void resolve_weak_handle(Register result, Register tmp); 335 void load_mirror(Register mirror, Register method, Register tmp = rscratch2); 336 void load_method_holder_cld(Register rresult, Register rmethod); 337 338 void load_method_holder(Register holder, Register method); 339 340 // oop manipulations 341 void load_metadata(Register dst, Register src); 342 void load_storage_props(Register dst, Register src); 343 void load_klass(Register dst, Register src); 344 void store_klass(Register dst, Register src); 345 346 void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src, 347 Register tmp1, Register thread_tmp); 348 void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src, 349 Register tmp1, Register tmp2, Register tmp3 = noreg); 350 351 void access_value_copy(DecoratorSet decorators, Register src, Register dst, Register value_klass); 352 353 // value type data payload offsets... 354 void first_field_offset(Register value_klass, Register offset); 355 void data_for_oop(Register oop, Register data, Register value_klass); 356 357 358 // Resolves obj access. Result is placed in the same register. 359 // All other registers are preserved. 360 void resolve(DecoratorSet decorators, Register obj); 361 362 void load_heap_oop(Register dst, Address src, Register tmp1 = noreg, 363 Register thread_tmp = noreg, DecoratorSet decorators = 0); 364 void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg, 365 Register thread_tmp = noreg, DecoratorSet decorators = 0); 366 void store_heap_oop(Address dst, Register src, Register tmp1 = noreg, 367 Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0); 368 369 // Used for storing NULL. All other oop constants should be 370 // stored using routines that take a jobject. 371 void store_heap_oop_null(Address dst); 372 373 void load_prototype_header(Register dst, Register src); 374 375 #ifdef _LP64 376 void store_klass_gap(Register dst, Register src); 377 526 527 void empty_FPU_stack(); 528 529 void push_IU_state(); 530 void pop_IU_state(); 531 532 void push_FPU_state(); 533 void pop_FPU_state(); 534 535 void push_CPU_state(); 536 void pop_CPU_state(); 537 538 // Round up to a power of two 539 void round_to(Register reg, int modulus); 540 541 // Callee saved registers handling 542 void push_callee_saved_registers(); 543 void pop_callee_saved_registers(); 544 545 // allocation 546 547 // Object / value buffer allocation... 548 // Allocate instance of klass, assumes klass initialized by caller 549 // new_obj prefers to be rax 550 // Kills t1 and t2, perserves klass, return allocation in new_obj (rsi on LP64) 551 virtual void allocate_instance(Register klass, Register new_obj, 552 Register t1, Register t2, 553 bool clear_fields, Label& alloc_failed); 554 555 void eden_allocate( 556 Register thread, // Current thread 557 Register obj, // result: pointer to object after successful allocation 558 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise 559 int con_size_in_bytes, // object size in bytes if known at compile time 560 Register t1, // temp register 561 Label& slow_case // continuation point if fast allocation fails 562 ); 563 void tlab_allocate( 564 Register thread, // Current thread 565 Register obj, // result: pointer to object after successful allocation 566 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise 567 int con_size_in_bytes, // object size in bytes if known at compile time 568 Register t1, // temp register 569 Register t2, // temp register 570 Label& slow_case // continuation point if fast allocation fails 571 ); 572 void zero_memory(Register address, Register length_in_bytes, int offset_in_bytes, Register temp); 573 574 // For field "index" within "klass", return value_klass ... 575 void get_value_field_klass(Register klass, Register index, Register value_klass); 576 577 // interface method calling 578 void lookup_interface_method(Register recv_klass, 579 Register intf_klass, 580 RegisterOrConstant itable_index, 581 Register method_result, 582 Register scan_temp, 583 Label& no_such_interface, 584 bool return_method = true); 585 586 // virtual method calling 587 void lookup_virtual_method(Register recv_klass, 588 RegisterOrConstant vtable_index, 589 Register method_result); 590 591 // Test sub_klass against super_klass, with fast and slow paths. 592 593 // The fast path produces a tri-state answer: yes / no / maybe-slow. 594 // One of the three labels can be NULL, meaning take the fall-through. 595 // If super_check_offset is -1, the value is loaded up from super_klass. |