78 MacroAssembler(CodeBuffer* code) : Assembler(code) {}
79
80 // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
81 // The implementation is only non-empty for the InterpreterMacroAssembler,
82 // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
83 virtual void check_and_handle_popframe(Register java_thread);
84 virtual void check_and_handle_earlyret(Register java_thread);
85
86 Address as_Address(AddressLiteral adr);
87 Address as_Address(ArrayAddress adr);
88
89 // Support for NULL-checks
90 //
91 // Generates code that causes a NULL OS exception if the content of reg is NULL.
92 // If the accessed location is M[reg + offset] and the offset is known, provide the
93 // offset. No explicit code generation is needed if the offset is within a certain
94 // range (0 <= offset <= page_size).
95
96 void null_check(Register reg, int offset = -1);
97 static bool needs_explicit_null_check(intptr_t offset);
98
99 // Required platform-specific helpers for Label::patch_instructions.
100 // They _shadow_ the declarations in AbstractAssembler, which are undefined.
101 void pd_patch_instruction(address branch, address target, const char* file, int line) {
102 unsigned char op = branch[0];
103 assert(op == 0xE8 /* call */ ||
104 op == 0xE9 /* jmp */ ||
105 op == 0xEB /* short jmp */ ||
106 (op & 0xF0) == 0x70 /* short jcc */ ||
107 op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ ||
108 op == 0xC7 && branch[1] == 0xF8 /* xbegin */,
109 "Invalid opcode at patch point");
110
111 if (op == 0xEB || (op & 0xF0) == 0x70) {
112 // short offset operators (jmp and jcc)
113 char* disp = (char*) &branch[1];
114 int imm8 = target - (address) &disp[1];
115 guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d", file, line);
116 *disp = imm8;
|
78 MacroAssembler(CodeBuffer* code) : Assembler(code) {}
79
80 // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
81 // The implementation is only non-empty for the InterpreterMacroAssembler,
82 // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
83 virtual void check_and_handle_popframe(Register java_thread);
84 virtual void check_and_handle_earlyret(Register java_thread);
85
86 Address as_Address(AddressLiteral adr);
87 Address as_Address(ArrayAddress adr);
88
89 // Support for NULL-checks
90 //
91 // Generates code that causes a NULL OS exception if the content of reg is NULL.
92 // If the accessed location is M[reg + offset] and the offset is known, provide the
93 // offset. No explicit code generation is needed if the offset is within a certain
94 // range (0 <= offset <= page_size).
95
96 void null_check(Register reg, int offset = -1);
97 static bool needs_explicit_null_check(intptr_t offset);
98 static bool uses_implicit_null_check(void* address);
99
100 // Required platform-specific helpers for Label::patch_instructions.
101 // They _shadow_ the declarations in AbstractAssembler, which are undefined.
102 void pd_patch_instruction(address branch, address target, const char* file, int line) {
103 unsigned char op = branch[0];
104 assert(op == 0xE8 /* call */ ||
105 op == 0xE9 /* jmp */ ||
106 op == 0xEB /* short jmp */ ||
107 (op & 0xF0) == 0x70 /* short jcc */ ||
108 op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ ||
109 op == 0xC7 && branch[1] == 0xF8 /* xbegin */,
110 "Invalid opcode at patch point");
111
112 if (op == 0xEB || (op & 0xF0) == 0x70) {
113 // short offset operators (jmp and jcc)
114 char* disp = (char*) &branch[1];
115 int imm8 = target - (address) &disp[1];
116 guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d", file, line);
117 *disp = imm8;
|