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 #ifdef AMD64
130 intptr_t disp = dest - return_address();
131 guarantee(disp == (intptr_t)(jint)disp, "must be 32-bit offset");
132 #endif // AMD64
133 set_int_at(displacement_offset, (int)(dest - return_address()));
134 }
135 // Returns whether the 4-byte displacement operand is 4-byte aligned.
136 bool is_displacement_aligned();
137 void set_destination_mt_safe(address dest);
138
139 void verify_alignment() { assert(is_displacement_aligned(), "displacement of call is not aligned"); }
140 void verify();
141 void print();
142
143 // Creation
144 inline friend NativeCall* nativeCall_at(address address);
145 inline friend NativeCall* nativeCall_before(address return_address);
146
147 static bool is_call_at(address instr) {
148 return ((*instr) & 0xFF) == NativeCall::instruction_code;
149 }
150
151 static bool is_call_before(address return_address) {
|
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 #ifdef AMD64
130 intptr_t disp = dest - return_address();
131 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()));
132 #endif // AMD64
133 set_int_at(displacement_offset, (int)(dest - return_address()));
134 }
135 // Returns whether the 4-byte displacement operand is 4-byte aligned.
136 bool is_displacement_aligned();
137 void set_destination_mt_safe(address dest);
138
139 void verify_alignment() { assert(is_displacement_aligned(), "displacement of call is not aligned"); }
140 void verify();
141 void print();
142
143 // Creation
144 inline friend NativeCall* nativeCall_at(address address);
145 inline friend NativeCall* nativeCall_before(address return_address);
146
147 static bool is_call_at(address instr) {
148 return ((*instr) & 0xFF) == NativeCall::instruction_code;
149 }
150
151 static bool is_call_before(address return_address) {
|