152
153 class NativeCall: public NativeInstruction {
154 public:
155 enum Intel_specific_constants {
156 instruction_code = 0xE8,
157 instruction_size = 5,
158 instruction_offset = 0,
159 displacement_offset = 1,
160 return_address_offset = 5
161 };
162
163 address instruction_address() const { return addr_at(instruction_offset); }
164 address next_instruction_address() const { return addr_at(return_address_offset); }
165 int displacement() const { return (jint) int_at(displacement_offset); }
166 address displacement_address() const { return addr_at(displacement_offset); }
167 address return_address() const { return addr_at(return_address_offset); }
168 address destination() const;
169 void set_destination(address dest) {
170 #ifdef AMD64
171 intptr_t disp = dest - return_address();
172 guarantee(disp == (intptr_t)(jint)disp, "must be 32-bit offset");
173 #endif // AMD64
174 set_int_at(displacement_offset, (int)(dest - return_address()));
175 }
176 // Returns whether the 4-byte displacement operand is 4-byte aligned.
177 bool is_displacement_aligned();
178 void set_destination_mt_safe(address dest);
179
180 void verify_alignment() { assert(is_displacement_aligned(), "displacement of call is not aligned"); }
181 void verify();
182 void print();
183
184 // Creation
185 inline friend NativeCall* nativeCall_at(address address);
186 inline friend NativeCall* nativeCall_before(address return_address);
187
188 static bool is_call_at(address instr) {
189 return ((*instr) & 0xFF) == NativeCall::instruction_code;
190 }
191
192 static bool is_call_before(address return_address) {
|
152
153 class NativeCall: public NativeInstruction {
154 public:
155 enum Intel_specific_constants {
156 instruction_code = 0xE8,
157 instruction_size = 5,
158 instruction_offset = 0,
159 displacement_offset = 1,
160 return_address_offset = 5
161 };
162
163 address instruction_address() const { return addr_at(instruction_offset); }
164 address next_instruction_address() const { return addr_at(return_address_offset); }
165 int displacement() const { return (jint) int_at(displacement_offset); }
166 address displacement_address() const { return addr_at(displacement_offset); }
167 address return_address() const { return addr_at(return_address_offset); }
168 address destination() const;
169 void set_destination(address dest) {
170 #ifdef AMD64
171 intptr_t disp = dest - return_address();
172 guarantee(disp == (intptr_t)(jint)disp, "must be 32-bit offset: " INTPTR_FORMAT ", dest: " INTPTR_FORMAT ", ret_pc: " INTPTR_FORMAT, disp, p2i(dest), p2i(return_address()));
173 #endif // AMD64
174 set_int_at(displacement_offset, (int)(dest - return_address()));
175 }
176 // Returns whether the 4-byte displacement operand is 4-byte aligned.
177 bool is_displacement_aligned();
178 void set_destination_mt_safe(address dest);
179
180 void verify_alignment() { assert(is_displacement_aligned(), "displacement of call is not aligned"); }
181 void verify();
182 void print();
183
184 // Creation
185 inline friend NativeCall* nativeCall_at(address address);
186 inline friend NativeCall* nativeCall_before(address return_address);
187
188 static bool is_call_at(address instr) {
189 return ((*instr) & 0xFF) == NativeCall::instruction_code;
190 }
191
192 static bool is_call_before(address return_address) {
|