110
111 class NativeCall: public NativeInstruction {
112 public:
113 enum Intel_specific_constants {
114 instruction_code = 0xE8,
115 instruction_size = 5,
116 instruction_offset = 0,
117 displacement_offset = 1,
118 return_address_offset = 5
119 };
120
121 static int byte_size() { return instruction_size; }
122 address instruction_address() const { return addr_at(instruction_offset); }
123 address next_instruction_address() const { return addr_at(return_address_offset); }
124 int displacement() const { return (jint) int_at(displacement_offset); }
125 address displacement_address() const { return addr_at(displacement_offset); }
126 address return_address() const { return addr_at(return_address_offset); }
127 address destination() const;
128 void set_destination(address dest) {
129 intptr_t disp = dest - return_address();
130 guarantee(disp == (intptr_t)(jint)disp, "must be 32-bit offset");
131 set_int_at(displacement_offset, (int)(dest - return_address()));
132 }
133 // Returns whether the 4-byte displacement operand is 4-byte aligned.
134 bool is_displacement_aligned();
135 void set_destination_mt_safe(address dest);
136
137 void verify_alignment() { assert(is_displacement_aligned(), "displacement of call is not aligned"); }
138 void verify();
139 void print();
140
141 // Creation
142 inline friend NativeCall* nativeCall_at(address address);
143 inline friend NativeCall* nativeCall_before(address return_address);
144
145 static bool is_call_at(address instr) {
146 return ((*instr) & 0xFF) == NativeCall::instruction_code;
147 }
148
149 static bool is_call_before(address return_address) {
150 return is_call_at(return_address - NativeCall::return_address_offset);
|
110
111 class NativeCall: public NativeInstruction {
112 public:
113 enum Intel_specific_constants {
114 instruction_code = 0xE8,
115 instruction_size = 5,
116 instruction_offset = 0,
117 displacement_offset = 1,
118 return_address_offset = 5
119 };
120
121 static int byte_size() { return instruction_size; }
122 address instruction_address() const { return addr_at(instruction_offset); }
123 address next_instruction_address() const { return addr_at(return_address_offset); }
124 int displacement() const { return (jint) int_at(displacement_offset); }
125 address displacement_address() const { return addr_at(displacement_offset); }
126 address return_address() const { return addr_at(return_address_offset); }
127 address destination() const;
128 void set_destination(address dest) {
129 intptr_t disp = dest - return_address();
130 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()));
131 set_int_at(displacement_offset, (int)(dest - return_address()));
132 }
133 // Returns whether the 4-byte displacement operand is 4-byte aligned.
134 bool is_displacement_aligned();
135 void set_destination_mt_safe(address dest);
136
137 void verify_alignment() { assert(is_displacement_aligned(), "displacement of call is not aligned"); }
138 void verify();
139 void print();
140
141 // Creation
142 inline friend NativeCall* nativeCall_at(address address);
143 inline friend NativeCall* nativeCall_before(address return_address);
144
145 static bool is_call_at(address instr) {
146 return ((*instr) & 0xFF) == NativeCall::instruction_code;
147 }
148
149 static bool is_call_before(address return_address) {
150 return is_call_at(return_address - NativeCall::return_address_offset);
|