src/cpu/x86/vm/icBuffer_x86.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/cpu/x86/vm/icBuffer_x86.cpp Mon Oct 31 17:46:18 2016
--- new/src/cpu/x86/vm/icBuffer_x86.cpp Mon Oct 31 17:46:18 2016
*** 31,46 ****
--- 31,52 ----
#include "memory/resourceArea.hpp"
#include "nativeInst_x86.hpp"
#include "oops/oop.inline.hpp"
int InlineCacheBuffer::ic_stub_code_size() {
return NativeMovConstReg::instruction_size +
NativeJump::instruction_size +
1;
// so that code_end can be set in CodeBuffer
// 64bit 16 = 5 + 10 bytes + 1 byte
// 32bit 11 = 10 bytes + 1 byte
+ // Worst case, if destination is not a near call:
+ // lea rax, lit1
+ // lea scratch, lit2
+ // jmp scratch
+
+ // Best case
+ // lea rax, lit1
+ // jmp lit2
+
+ int best = NativeMovConstReg::instruction_size + NativeJump::instruction_size;
+ int worst = 2 * NativeMovConstReg::instruction_size + 3;
+ return MAX2(best, worst);
}
void InlineCacheBuffer::assemble_ic_buffer_code(address code_begin, void* cached_value, address entry_point) {
*** 57,74 ****
--- 63,95 ----
}
address InlineCacheBuffer::ic_buffer_entry_point(address code_begin) {
NativeMovConstReg* move = nativeMovConstReg_at(code_begin); // creation also verifies the object
! NativeJump* jump = nativeJump_at(move->next_instruction_address());
! address jmp = move->next_instruction_address();
+ NativeInstruction* ni = nativeInstruction_at(jmp);
+ if (ni->is_jump()) {
+ NativeJump* jump = nativeJump_at(jmp);
return jump->jump_destination();
+ } else {
+ assert(ni->is_far_jump(), "unexpected instruction");
+ NativeFarJump* jump = nativeFarJump_at(jmp);
+ return jump->jump_destination();
+ }
}
void* InlineCacheBuffer::ic_buffer_cached_value(address code_begin) {
// creation also verifies the object
NativeMovConstReg* move = nativeMovConstReg_at(code_begin);
// Verifies the jump
! NativeJump* jump = nativeJump_at(move->next_instruction_address());
! address jmp = move->next_instruction_address();
+ NativeInstruction* ni = nativeInstruction_at(jmp);
+ if (ni->is_jump()) {
+ NativeJump* jump = nativeJump_at(jmp);
+ } else {
+ assert(ni->is_far_jump(), "unexpected instruction");
+ NativeFarJump* jump = nativeFarJump_at(jmp);
+ }
void* o = (void*)move->data();
return o;
}
src/cpu/x86/vm/icBuffer_x86.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File