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