aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortwisti <none@none>2010-08-25 05:27:54 -0700
committertwisti <none@none>2010-08-25 05:27:54 -0700
commitc6865e24e0444bd5fdb6fb1e3117108765b29efc (patch)
treeb36d0c2b2e59e67b7b9b2c52b66f14eddb9e4182 /src
parent6d5fe3805a03867db608a887106167fbb79099a4 (diff)
6978355: renaming for 6961697
Summary: This is the renaming part of 6961697 to keep the actual changes small for review. Reviewed-by: kvn, never
Diffstat (limited to 'src')
-rw-r--r--src/cpu/sparc/vm/assembler_sparc.cpp4
-rw-r--r--src/cpu/sparc/vm/codeBuffer_sparc.hpp4
-rw-r--r--src/cpu/sparc/vm/frame_sparc.cpp7
-rw-r--r--src/cpu/sparc/vm/jniFastGetField_sparc.cpp20
-rw-r--r--src/cpu/sparc/vm/nativeInst_sparc.cpp18
-rw-r--r--src/cpu/sparc/vm/sparc.ad58
-rw-r--r--src/cpu/x86/vm/frame_x86.cpp10
-rw-r--r--src/cpu/x86/vm/frame_x86.inline.hpp2
-rw-r--r--src/cpu/x86/vm/jniFastGetField_x86_32.cpp36
-rw-r--r--src/cpu/x86/vm/jniFastGetField_x86_64.cpp14
-rw-r--r--src/cpu/x86/vm/vm_version_x86.cpp3
-rw-r--r--src/cpu/x86/vm/x86_32.ad150
-rw-r--r--src/cpu/x86/vm/x86_64.ad196
-rw-r--r--src/os/solaris/dtrace/generateJvmOffsets.cpp3
-rw-r--r--src/os/solaris/dtrace/libjvm_db.c4
-rw-r--r--src/os_cpu/windows_x86/vm/os_windows_x86.cpp6
-rw-r--r--src/os_cpu/windows_x86/vm/windows_x86_32.ad5
-rw-r--r--src/os_cpu/windows_x86/vm/windows_x86_64.ad5
-rw-r--r--src/share/vm/adlc/output_c.cpp2
-rw-r--r--src/share/vm/asm/codeBuffer.cpp53
-rw-r--r--src/share/vm/asm/codeBuffer.hpp63
-rw-r--r--src/share/vm/c1/c1_Compilation.cpp3
-rw-r--r--src/share/vm/c1/c1_Runtime1.cpp3
-rw-r--r--src/share/vm/c1/c1_Runtime1.hpp4
-rw-r--r--src/share/vm/ci/ciMethod.cpp14
-rw-r--r--src/share/vm/code/codeBlob.cpp67
-rw-r--r--src/share/vm/code/codeBlob.hpp59
-rw-r--r--src/share/vm/code/codeCache.cpp16
-rw-r--r--src/share/vm/code/exceptionHandlerTable.cpp6
-rw-r--r--src/share/vm/code/nmethod.cpp84
-rw-r--r--src/share/vm/code/nmethod.hpp14
-rw-r--r--src/share/vm/code/pcDesc.cpp2
-rw-r--r--src/share/vm/code/relocInfo.cpp14
-rw-r--r--src/share/vm/code/scopeDesc.cpp4
-rw-r--r--src/share/vm/code/stubs.cpp8
-rw-r--r--src/share/vm/code/vtableStubs.cpp2
-rw-r--r--src/share/vm/compiler/compileBroker.cpp10
-rw-r--r--src/share/vm/compiler/disassembler.cpp10
-rw-r--r--src/share/vm/interpreter/interpreter.hpp4
-rw-r--r--src/share/vm/interpreter/interpreterRuntime.cpp18
-rw-r--r--src/share/vm/opto/compile.cpp8
-rw-r--r--src/share/vm/opto/graphKit.cpp2
-rw-r--r--src/share/vm/opto/lcm.cpp5
-rw-r--r--src/share/vm/opto/library_call.cpp3
-rw-r--r--src/share/vm/opto/output.cpp21
-rw-r--r--src/share/vm/opto/stringopts.cpp2
-rw-r--r--src/share/vm/prims/jvmtiCodeBlobEvents.cpp5
-rw-r--r--src/share/vm/prims/jvmtiExport.cpp4
-rw-r--r--src/share/vm/prims/methodHandles.cpp3
-rw-r--r--src/share/vm/runtime/compilationPolicy.cpp2
-rw-r--r--src/share/vm/runtime/frame.cpp4
-rw-r--r--src/share/vm/runtime/icache.cpp4
-rw-r--r--src/share/vm/runtime/rframe.cpp4
-rw-r--r--src/share/vm/runtime/sharedRuntime.cpp36
-rw-r--r--src/share/vm/runtime/sharedRuntime.hpp31
-rw-r--r--src/share/vm/runtime/stubRoutines.cpp10
-rw-r--r--src/share/vm/runtime/vmStructs.cpp3
57 files changed, 546 insertions, 606 deletions
diff --git a/src/cpu/sparc/vm/assembler_sparc.cpp b/src/cpu/sparc/vm/assembler_sparc.cpp
index 123948396..e84e92a41 100644
--- a/src/cpu/sparc/vm/assembler_sparc.cpp
+++ b/src/cpu/sparc/vm/assembler_sparc.cpp
@@ -4192,7 +4192,7 @@ static void check_index(int ind) {
static void generate_satb_log_enqueue(bool with_frame) {
BufferBlob* bb = BufferBlob::create("enqueue_with_frame", EnqueueCodeSize);
- CodeBuffer buf(bb->instructions_begin(), bb->instructions_size());
+ CodeBuffer buf(bb);
MacroAssembler masm(&buf);
address start = masm.pc();
Register pre_val;
@@ -4421,7 +4421,7 @@ static u_char* dirty_card_log_enqueue_end = 0;
// This gets to assume that o0 contains the object address.
static void generate_dirty_card_log_enqueue(jbyte* byte_map_base) {
BufferBlob* bb = BufferBlob::create("dirty_card_enqueue", EnqueueCodeSize*2);
- CodeBuffer buf(bb->instructions_begin(), bb->instructions_size());
+ CodeBuffer buf(bb);
MacroAssembler masm(&buf);
address start = masm.pc();
diff --git a/src/cpu/sparc/vm/codeBuffer_sparc.hpp b/src/cpu/sparc/vm/codeBuffer_sparc.hpp
index a4025cc90..258ff281e 100644
--- a/src/cpu/sparc/vm/codeBuffer_sparc.hpp
+++ b/src/cpu/sparc/vm/codeBuffer_sparc.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,5 +30,5 @@ public:
// Heuristic for pre-packing the pt/pn bit of a predicted branch.
bool is_backward_branch(Label& L) {
- return L.is_bound() && code_end() <= locator_address(L.loc());
+ return L.is_bound() && insts_end() <= locator_address(L.loc());
}
diff --git a/src/cpu/sparc/vm/frame_sparc.cpp b/src/cpu/sparc/vm/frame_sparc.cpp
index 5e5731557..1ee91aeda 100644
--- a/src/cpu/sparc/vm/frame_sparc.cpp
+++ b/src/cpu/sparc/vm/frame_sparc.cpp
@@ -253,11 +253,12 @@ bool frame::safe_for_sender(JavaThread *thread) {
}
// Could just be some random pointer within the codeBlob
- if (!sender.cb()->instructions_contains(sender_pc)) return false;
+ if (!sender.cb()->code_contains(sender_pc)) {
+ return false;
+ }
// We should never be able to see an adapter if the current frame is something from code cache
-
- if ( sender_blob->is_adapter_blob()) {
+ if (sender_blob->is_adapter_blob()) {
return false;
}
diff --git a/src/cpu/sparc/vm/jniFastGetField_sparc.cpp b/src/cpu/sparc/vm/jniFastGetField_sparc.cpp
index 7bb12c1ad..f390efff1 100644
--- a/src/cpu/sparc/vm/jniFastGetField_sparc.cpp
+++ b/src/cpu/sparc/vm/jniFastGetField_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,10 +50,10 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
default: ShouldNotReachHere();
}
ResourceMark rm;
- BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
- address fast_entry = b->instructions_begin();
- CodeBuffer cbuf(fast_entry, b->instructions_size());
+ BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+ CodeBuffer cbuf(blob);
MacroAssembler* masm = new MacroAssembler(&cbuf);
+ address fast_entry = __ pc();
Label label1, label2;
@@ -129,10 +129,10 @@ address JNI_FastGetField::generate_fast_get_int_field() {
address JNI_FastGetField::generate_fast_get_long_field() {
const char *name = "jni_fast_GetLongField";
ResourceMark rm;
- BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
- address fast_entry = b->instructions_begin();
- CodeBuffer cbuf(fast_entry, b->instructions_size());
+ BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+ CodeBuffer cbuf(blob);
MacroAssembler* masm = new MacroAssembler(&cbuf);
+ address fast_entry = __ pc();
Label label1, label2;
@@ -201,10 +201,10 @@ address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
default: ShouldNotReachHere();
}
ResourceMark rm;
- BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
- address fast_entry = b->instructions_begin();
- CodeBuffer cbuf(fast_entry, b->instructions_size());
+ BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+ CodeBuffer cbuf(blob);
MacroAssembler* masm = new MacroAssembler(&cbuf);
+ address fast_entry = __ pc();
Label label1, label2;
diff --git a/src/cpu/sparc/vm/nativeInst_sparc.cpp b/src/cpu/sparc/vm/nativeInst_sparc.cpp
index 37b4bb891..3c578c95e 100644
--- a/src/cpu/sparc/vm/nativeInst_sparc.cpp
+++ b/src/cpu/sparc/vm/nativeInst_sparc.cpp
@@ -193,17 +193,17 @@ void NativeCall::test() {
a->call( a->pc(), relocInfo::none );
a->delayed()->nop();
- nc = nativeCall_at( cb.code_begin() );
+ nc = nativeCall_at( cb.insts_begin() );
nc->print();
nc = nativeCall_overwriting_at( nc->next_instruction_address() );
for (idx = 0; idx < ARRAY_SIZE(offsets); idx++) {
- nc->set_destination( cb.code_begin() + offsets[idx] );
- assert(nc->destination() == (cb.code_begin() + offsets[idx]), "check unit test");
+ nc->set_destination( cb.insts_begin() + offsets[idx] );
+ assert(nc->destination() == (cb.insts_begin() + offsets[idx]), "check unit test");
nc->print();
}
- nc = nativeCall_before( cb.code_begin() + 8 );
+ nc = nativeCall_before( cb.insts_begin() + 8 );
nc->print();
VM_Version::revert();
@@ -368,7 +368,7 @@ void NativeMovConstReg::test() {
a->sethi(al2, O2);
a->add(O2, al2.low10(), O2);
- nm = nativeMovConstReg_at( cb.code_begin() );
+ nm = nativeMovConstReg_at( cb.insts_begin() );
nm->print();
nm = nativeMovConstReg_at( nm->next_instruction_address() );
@@ -480,7 +480,7 @@ void NativeMovConstRegPatching::test() {
a->nop();
a->add(O2, al2.low10(), O2);
- nm = nativeMovConstRegPatching_at( cb.code_begin() );
+ nm = nativeMovConstRegPatching_at( cb.insts_begin() );
nm->print();
nm = nativeMovConstRegPatching_at( nm->next_instruction_address() );
@@ -616,7 +616,7 @@ void NativeMovRegMem::test() {
a->sethi(al2, I3); a->add(I3, al2.low10(), I3);
a->stf( FloatRegisterImpl::S, F15, O0, I3 ); idx++;
- nm = nativeMovRegMem_at( cb.code_begin() );
+ nm = nativeMovRegMem_at( cb.insts_begin() );
nm->print();
nm->set_offset( low10(0) );
nm->print();
@@ -760,7 +760,7 @@ void NativeMovRegMemPatching::test() {
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->stf( FloatRegisterImpl::S, F15, O0, I3 ); idx++;
- nm = nativeMovRegMemPatching_at( cb.code_begin() );
+ nm = nativeMovRegMemPatching_at( cb.insts_begin() );
nm->print();
nm->set_offset( low10(0) );
nm->print();
@@ -849,7 +849,7 @@ void NativeJump::test() {
a->jmpl(I3, al.low10(), L3, RelocationHolder::none);
a->delayed()->nop();
- nj = nativeJump_at( cb.code_begin() );
+ nj = nativeJump_at( cb.insts_begin() );
nj->print();
nj = nativeJump_at( nj->next_instruction_address() );
diff --git a/src/cpu/sparc/vm/sparc.ad b/src/cpu/sparc/vm/sparc.ad
index 50c0b5429..fc18cf0ee 100644
--- a/src/cpu/sparc/vm/sparc.ad
+++ b/src/cpu/sparc/vm/sparc.ad
@@ -677,8 +677,7 @@ static inline void emit2_19(CodeBuffer &cbuf, int f30, int f29, int f25, int f22
(f20 << 20) |
(f19 << 19) |
(f0 << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
}
// Standard Sparc opcode form2 field breakdown
@@ -689,8 +688,7 @@ static inline void emit2_22(CodeBuffer &cbuf, int f30, int f25, int f22, int f0
(f25 << 25) |
(f22 << 22) |
(f0 << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
}
// Standard Sparc opcode form3 field breakdown
@@ -701,8 +699,7 @@ static inline void emit3(CodeBuffer &cbuf, int f30, int f25, int f19, int f14, i
(f14 << 14) |
(f5 << 5) |
(f0 << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
}
// Standard Sparc opcode form3 field breakdown
@@ -714,8 +711,7 @@ static inline void emit3_simm13(CodeBuffer &cbuf, int f30, int f25, int f19, int
(f14 << 14) |
(1 << 13) | // bit to indicate immediate-mode
(simm13<<0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
}
static inline void emit3_simm10(CodeBuffer &cbuf, int f30, int f25, int f19, int f14, int simm10 ) {
@@ -910,9 +906,7 @@ void emit_form3_mem_reg(CodeBuffer &cbuf, const MachNode* n, int primary, int te
instr |= disp & 0x1FFF;
}
- uint *code = (uint*)cbuf.code_end();
- *code = instr;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(instr);
#ifdef ASSERT
{
@@ -1532,7 +1526,7 @@ void emit_java_to_interp(CodeBuffer &cbuf ) {
// set (empty), G5
// jmp -1
- address mark = cbuf.inst_mark(); // get mark within main instrs section
+ address mark = cbuf.insts_mark(); // get mark within main instrs section
MacroAssembler _masm(&cbuf);
@@ -1632,7 +1626,7 @@ uint size_deopt_handler() {
// Emit exception handler code.
int emit_exception_handler(CodeBuffer& cbuf) {
Register temp_reg = G3;
- AddressLiteral exception_blob(OptoRuntime::exception_blob()->instructions_begin());
+ AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point());
MacroAssembler _masm(&cbuf);
address base =
@@ -2292,8 +2286,7 @@ encode %{
(0 << 13) | // select register move
($pcc$$constant << 11) | // cc1, cc0 bits for 'icc' or 'xcc'
($src$$reg << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
%}
enc_class enc_cmov_imm( cmpOp cmp, iRegI dst, immI11 src, immI pcc ) %{
@@ -2306,8 +2299,7 @@ encode %{
(1 << 13) | // select immediate move
($pcc$$constant << 11) | // cc1, cc0 bits for 'icc'
(simm11 << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
%}
enc_class enc_cmov_reg_f( cmpOpF cmp, iRegI dst, iRegI src, flagsRegF fcc ) %{
@@ -2319,8 +2311,7 @@ encode %{
(0 << 13) | // select register move
($fcc$$reg << 11) | // cc1, cc0 bits for fcc0-fcc3
($src$$reg << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
%}
enc_class enc_cmov_imm_f( cmpOp cmp, iRegI dst, immI11 src, flagsRegF fcc ) %{
@@ -2333,8 +2324,7 @@ encode %{
(1 << 13) | // select immediate move
($fcc$$reg << 11) | // cc1, cc0 bits for fcc0-fcc3
(simm11 << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
%}
enc_class enc_cmovf_reg( cmpOp cmp, regD dst, regD src, immI pcc ) %{
@@ -2347,8 +2337,7 @@ encode %{
($pcc$$constant << 11) | // cc1-cc0 bits for 'icc' or 'xcc'
($primary << 5) | // select single, double or quad
($src$$reg << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
%}
enc_class enc_cmovff_reg( cmpOpF cmp, flagsRegF fcc, regD dst, regD src ) %{
@@ -2360,8 +2349,7 @@ encode %{
($fcc$$reg << 11) | // cc2-cc0 bits for 'fccX'
($primary << 5) | // select single, double or quad
($src$$reg << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
%}
// Used by the MIN/MAX encodings. Same as a CMOV, but
@@ -2375,8 +2363,7 @@ encode %{
(0 << 13) | // select register move
(0 << 11) | // cc1, cc0 bits for 'icc'
($src$$reg << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
%}
enc_class enc_cmov_reg_minmax_long( iRegL dst, iRegL src ) %{
@@ -2388,8 +2375,7 @@ encode %{
(0 << 13) | // select register move
(0 << 11) | // cc1, cc0 bits for 'icc'
($src$$reg << 0);
- *((int*)(cbuf.code_end())) = op;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32(op);
%}
// Utility encoding for loading a 64 bit Pointer into a register
@@ -3055,7 +3041,7 @@ enc_class enc_Array_Equals(o0RegP ary1, o1RegP ary2, g3RegP tmp1, notemp_iRegI r
%}
enc_class enc_rethrow() %{
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
Register temp_reg = G3;
AddressLiteral rethrow_stub(OptoRuntime::rethrow_stub());
assert(temp_reg != reg_to_register_object(R_I0_num), "temp must not break oop_reg");
@@ -3076,23 +3062,17 @@ enc_class enc_Array_Equals(o0RegP ary1, o1RegP ary2, g3RegP tmp1, notemp_iRegI r
enc_class emit_mem_nop() %{
// Generates the instruction LDUXA [o6,g0],#0x82,g0
- unsigned int *code = (unsigned int*)cbuf.code_end();
- *code = (unsigned int)0xc0839040;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32((unsigned int) 0xc0839040);
%}
enc_class emit_fadd_nop() %{
// Generates the instruction FMOVS f31,f31
- unsigned int *code = (unsigned int*)cbuf.code_end();
- *code = (unsigned int)0xbfa0003f;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32((unsigned int) 0xbfa0003f);
%}
enc_class emit_br_nop() %{
// Generates the instruction BPN,PN .
- unsigned int *code = (unsigned int*)cbuf.code_end();
- *code = (unsigned int)0x00400000;
- cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+ cbuf.insts()->emit_int32((unsigned int) 0x00400000);
%}
enc_class enc_membar_acquire %{
diff --git a/src/cpu/x86/vm/frame_x86.cpp b/src/cpu/x86/vm/frame_x86.cpp
index cfc205397..a41ff1dbe 100644
--- a/src/cpu/x86/vm/frame_x86.cpp
+++ b/src/cpu/x86/vm/frame_x86.cpp
@@ -141,12 +141,12 @@ bool frame::safe_for_sender(JavaThread *thread) {
}
// Could just be some random pointer within the codeBlob
-
- if (!sender_blob->instructions_contains(sender_pc)) return false;
+ if (!sender_blob->code_contains(sender_pc)) {
+ return false;
+ }
// We should never be able to see an adapter if the current frame is something from code cache
-
- if ( sender_blob->is_adapter_blob()) {
+ if (sender_blob->is_adapter_blob()) {
return false;
}
@@ -340,7 +340,7 @@ void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp, bool
fr._unextended_sp = unextended_sp;
address original_pc = nm->get_original_pc(&fr);
- assert(nm->code_contains(original_pc), "original PC must be in nmethod");
+ assert(nm->insts_contains(original_pc), "original PC must be in nmethod");
assert(nm->is_method_handle_return(original_pc) == is_method_handle_return, "must be");
}
#endif
diff --git a/src/cpu/x86/vm/frame_x86.inline.hpp b/src/cpu/x86/vm/frame_x86.inline.hpp
index 8059ed5fe..0f4881c2b 100644
--- a/src/cpu/x86/vm/frame_x86.inline.hpp
+++ b/src/cpu/x86/vm/frame_x86.inline.hpp
@@ -63,7 +63,7 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address
address original_pc = nmethod::get_deopt_original_pc(this);
if (original_pc != NULL) {
_pc = original_pc;
- assert(((nmethod*)_cb)->code_contains(_pc), "original PC must be in nmethod");
+ assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod");
_deopt_state = is_deoptimized;
} else {
_deopt_state = not_deoptimized;
diff --git a/src/cpu/x86/vm/jniFastGetField_x86_32.cpp b/src/cpu/x86/vm/jniFastGetField_x86_32.cpp
index aa34d50a2..0a63657dc 100644
--- a/src/cpu/x86/vm/jniFastGetField_x86_32.cpp
+++ b/src/cpu/x86/vm/jniFastGetField_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,10 +54,10 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
default: ShouldNotReachHere();
}
ResourceMark rm;
- BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
- address fast_entry = b->instructions_begin();
- CodeBuffer cbuf(fast_entry, b->instructions_size());
+ BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+ CodeBuffer cbuf(blob);
MacroAssembler* masm = new MacroAssembler(&cbuf);
+ address fast_entry = __ pc();
Label slow;
@@ -135,11 +135,11 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
return fast_entry;
#else
switch (type) {
- case T_BOOLEAN: jni_fast_GetBooleanField_fp = (GetBooleanField_t)fast_entry; break;
- case T_BYTE: jni_fast_GetByteField_fp = (GetByteField_t)fast_entry; break;
- case T_CHAR: jni_fast_GetCharField_fp = (GetCharField_t)fast_entry; break;
- case T_SHORT: jni_fast_GetShortField_fp = (GetShortField_t)fast_entry; break;
- case T_INT: jni_fast_GetIntField_fp = (GetIntField_t)fast_entry;
+ case T_BOOLEAN: jni_fast_GetBooleanField_fp = (GetBooleanField_t) fast_entry; break;
+ case T_BYTE: jni_fast_GetByteField_fp = (GetByteField_t) fast_entry; break;
+ case T_CHAR: jni_fast_GetCharField_fp = (GetCharField_t) fast_entry; break;
+ case T_SHORT: jni_fast_GetShortField_fp = (GetShortField_t) fast_entry; break;
+ case T_INT: jni_fast_GetIntField_fp = (GetIntField_t) fast_entry; break;
}
return os::win32::fast_jni_accessor_wrapper(type);
#endif
@@ -168,10 +168,10 @@ address JNI_FastGetField::generate_fast_get_int_field() {
address JNI_FastGetField::generate_fast_get_long_field() {
const char *name = "jni_fast_GetLongField";
ResourceMark rm;
- BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
- address fast_entry = b->instructions_begin();
- CodeBuffer cbuf(fast_entry, b->instructions_size());
+ BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+ CodeBuffer cbuf(blob);
MacroAssembler* masm = new MacroAssembler(&cbuf);
+ address fast_entry = __ pc();
Label slow;
@@ -246,7 +246,7 @@ address JNI_FastGetField::generate_fast_get_long_field() {
#ifndef _WINDOWS
return fast_entry;
#else
- jni_fast_GetLongField_fp = (GetLongField_t)fast_entry;
+ jni_fast_GetLongField_fp = (GetLongField_t) fast_entry;
return os::win32::fast_jni_accessor_wrapper(T_LONG);
#endif
}
@@ -259,10 +259,10 @@ address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
default: ShouldNotReachHere();
}
ResourceMark rm;
- BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
- address fast_entry = b->instructions_begin();
- CodeBuffer cbuf(fast_entry, b->instructions_size());
+ BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+ CodeBuffer cbuf(blob);
MacroAssembler* masm = new MacroAssembler(&cbuf);
+ address fast_entry = __ pc();
Label slow_with_pop, slow;
@@ -348,8 +348,8 @@ address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
return fast_entry;
#else
switch (type) {
- case T_FLOAT: jni_fast_GetFloatField_fp = (GetFloatField_t)fast_entry; break;
- case T_DOUBLE: jni_fast_GetDoubleField_fp = (GetDoubleField_t)fast_entry;
+ case T_FLOAT: jni_fast_GetFloatField_fp = (GetFloatField_t) fast_entry; break;
+ case T_DOUBLE: jni_fast_GetDoubleField_fp = (GetDoubleField_t) fast_entry; break;
}
return os::win32::fast_jni_accessor_wrapper(type);
#endif
diff --git a/src/cpu/x86/vm/jniFastGetField_x86_64.cpp b/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
index 02da6a5ab..f07ae42e1 100644
--- a/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
+++ b/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,10 +58,10 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
default: ShouldNotReachHere();
}
ResourceMark rm;
- BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE);
- address fast_entry = b->instructions_begin();
- CodeBuffer cbuf(fast_entry, b->instructions_size());
+ BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
+ CodeBuffer cbuf(blob);
MacroAssembler* masm = new MacroAssembler(&cbuf);
+ address fast_entry = __ pc();
Label slow;
@@ -156,10 +156,10 @@ address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
default: ShouldNotReachHere();
}
ResourceMark rm;
- BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE);
- address fast_entry = b->instructions_begin();
- CodeBuffer cbuf(fast_entry, b->instructions_size());
+ BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
+ CodeBuffer cbuf(blob);
MacroAssembler* masm = new MacroAssembler(&cbuf);
+ address fast_entry = __ pc();
Label slow;
diff --git a/src/cpu/x86/vm/vm_version_x86.cpp b/src/cpu/x86/vm/vm_version_x86.cpp
index 9fb37169a..887e71b79 100644
--- a/src/cpu/x86/vm/vm_version_x86.cpp
+++ b/src/cpu/x86/vm/vm_version_x86.cpp
@@ -595,8 +595,7 @@ void VM_Version::initialize() {
if (stub_blob == NULL) {
vm_exit_during_initialization("Unable to allocate getPsrInfo_stub");
}
- CodeBuffer c(stub_blob->instructions_begin(),
- stub_blob->instructions_size());
+ CodeBuffer c(stub_blob);
VM_Version_StubGenerator g(&c);
getPsrInfo_stub = CAST_TO_FN_PTR(getPsrInfo_stub_t,
g.generate_getPsrInfo());
diff --git a/src/cpu/x86/vm/x86_32.ad b/src/cpu/x86/vm/x86_32.ad
index a9cdabf8f..b2efb1099 100644
--- a/src/cpu/x86/vm/x86_32.ad
+++ b/src/cpu/x86/vm/x86_32.ad
@@ -350,54 +350,46 @@ void MachBreakpointNode::format( PhaseRegAlloc *, outputStream* st ) const {
// EMIT_RM()
void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3) {
unsigned char c = (unsigned char)((f1 << 6) | (f2 << 3) | f3);
- *(cbuf.code_end()) = c;
- cbuf.set_code_end(cbuf.code_end() + 1);
+ cbuf.insts()->emit_int8(c);
}
// EMIT_CC()
void emit_cc(CodeBuffer &cbuf, int f1, int f2) {
unsigned char c = (unsigned char)( f1 | f2 );
- *(cbuf.code_end()) = c;
- cbuf.set_code_end(cbuf.code_end() + 1);
+ cbuf.insts()->emit_int8(c);
}
// EMIT_OPCODE()
void emit_opcode(CodeBuffer &cbuf, int code) {
- *(cbuf.code_end()) = (unsigned char)code;
- cbuf.set_code_end(cbuf.code_end() + 1);
+ cbuf.insts()->emit_int8((unsigned char) code);
}
// EMIT_OPCODE() w/ relocation information
void emit_opcode(CodeBuffer &cbuf, int code, relocInfo::relocType reloc, int offset = 0) {
- cbuf.relocate(cbuf.inst_mark() + offset, reloc);
+ cbuf.relocate(cbuf.insts_mark() + offset, reloc);
emit_opcode(cbuf, code);
}
// EMIT_D8()
void emit_d8(CodeBuffer &cbuf, int d8) {
- *(cbuf.code_end()) = (unsigned char)d8;
- cbuf.set_code_end(cbuf.code_end() + 1);
+ cbuf.insts()->emit_int8((unsigned char) d8);
}
// EMIT_D16()
void emit_d16(CodeBuffer &cbuf, int d16) {
- *((short *)(cbuf.code_end())) = d16;
- cbuf.set_code_end(cbuf.code_end() + 2);
+ cbuf.insts()->emit_int16(d16);
}
// EMIT_D32()
void emit_d32(CodeBuffer &cbuf, int d32) {
- *((int *)(cbuf.code_end())) = d32;
- cbuf.set_code_end(cbuf.code_end() + 4);
+ cbuf.insts()->emit_int32(d32);
}
// emit 32 bit value and construct relocation entry from relocInfo::relocType
void emit_d32_reloc(CodeBuffer &cbuf, int d32, relocInfo::relocType reloc,
int format) {
- cbuf.relocate(cbuf.inst_mark(), reloc, format);
-
- *((int *)(cbuf.code_end())) = d32;
- cbuf.set_code_end(cbuf.code_end() + 4);
+ cbuf.relocate(cbuf.insts_mark(), reloc, format);
+ cbuf.insts()->emit_int32(d32);
}
// emit 32 bit value and construct relocation entry from RelocationHolder
@@ -408,10 +400,8 @@ void emit_d32_reloc(CodeBuffer &cbuf, int d32, RelocationHolder const& rspec,
assert(oop(d32)->is_oop() && (ScavengeRootsInCode || !oop(d32)->is_scavengable()), "cannot embed scavengable oops in code");
}
#endif
- cbuf.relocate(cbuf.inst_mark(), rspec, format);
-
- *((int *)(cbuf.code_end())) = d32;
- cbuf.set_code_end(cbuf.code_end() + 4);
+ cbuf.relocate(cbuf.insts_mark(), rspec, format);
+ cbuf.insts()->emit_int32(d32);
}
// Access stack slot for load or store
@@ -613,7 +603,7 @@ void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
emit_rm(cbuf, 0x3, 0x05, ESP_enc);
emit_d32(cbuf, framesize);
}
- C->set_frame_complete(cbuf.code_end() - cbuf.code_begin());
+ C->set_frame_complete(cbuf.insts_size());
#ifdef ASSERT
if (VerifyStackAtCalls) {
@@ -695,7 +685,7 @@ void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
emit_opcode(cbuf, 0x58 | EBP_enc);
if( do_polling() && C->is_method_compilation() ) {
- cbuf.relocate(cbuf.code_end(), relocInfo::poll_return_type, 0);
+ cbuf.relocate(cbuf.insts_end(), relocInfo::poll_return_type, 0);
emit_opcode(cbuf,0x85);
emit_rm(cbuf, 0x0, EAX_enc, 0x5); // EAX
emit_d32(cbuf, (intptr_t)os::get_polling_page());
@@ -1211,9 +1201,9 @@ void emit_java_to_interp(CodeBuffer &cbuf ) {
// mov rbx,0
// jmp -1
- address mark = cbuf.inst_mark(); // get mark within main instrs section
+ address mark = cbuf.insts_mark(); // get mark within main instrs section
- // Note that the code buffer's inst_mark is always relative to insts.
+ // Note that the code buffer's insts_mark is always relative to insts.
// That's why we must use the macroassembler to generate a stub.
MacroAssembler _masm(&cbuf);
@@ -1228,7 +1218,7 @@ void emit_java_to_interp(CodeBuffer &cbuf ) {
__ jump(RuntimeAddress(__ pc()));
__ end_a_stub();
- // Update current stubs pointer and restore code_end.
+ // Update current stubs pointer and restore insts_end.
}
// size of call stub, compiled java to interpretor
uint size_java_to_interp() {
@@ -1254,7 +1244,7 @@ void MachUEPNode::format( PhaseRegAlloc *ra_, outputStream* st ) const {
void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
MacroAssembler masm(&cbuf);
#ifdef ASSERT
- uint code_size = cbuf.code_size();
+ uint insts_size = cbuf.insts_size();
#endif
masm.cmpptr(rax, Address(rcx, oopDesc::klass_offset_in_bytes()));
masm.jump_cc(Assembler::notEqual,
@@ -1266,7 +1256,7 @@ void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
nops_cnt += 1;
masm.nop(nops_cnt);
- assert(cbuf.code_size() - code_size == size(ra_), "checking code size of inline cache node");
+ assert(cbuf.insts_size() - insts_size == size(ra_), "checking code size of inline cache node");
}
uint MachUEPNode::size(PhaseRegAlloc *ra_) const {
@@ -1288,14 +1278,14 @@ uint size_exception_handler() {
// and call a VM stub routine.
int emit_exception_handler(CodeBuffer& cbuf) {
- // Note that the code buffer's inst_mark is always relative to insts.
+ // Note that the code buffer's insts_mark is always relative to insts.
// That's why we must use the macroassembler to generate a handler.
MacroAssembler _masm(&cbuf);
address base =
__ start_a_stub(size_exception_handler());
if (base == NULL) return 0; // CodeBuffer::expand failed
int offset = __ offset();
- __ jump(RuntimeAddress(OptoRuntime::exception_blob()->instructions_begin()));
+ __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));
assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
__ end_a_stub();
return offset;
@@ -1313,7 +1303,7 @@ uint size_deopt_handler() {
// Emit deopt handler code.
int emit_deopt_handler(CodeBuffer& cbuf) {
- // Note that the code buffer's inst_mark is always relative to insts.
+ // Note that the code buffer's insts_mark is always relative to insts.
// That's why we must use the macroassembler to generate a handler.
MacroAssembler _masm(&cbuf);
address base =
@@ -1728,12 +1718,12 @@ encode %{
enc_class Lbl (label labl) %{ // JMP, CALL
Label *l = $labl$$label;
- emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size()+4)) : 0);
+ emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0);
%}
enc_class LblShort (label labl) %{ // JMP, CALL
Label *l = $labl$$label;
- int disp = l ? (l->loc_pos() - (cbuf.code_size()+1)) : 0;
+ int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0;
assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
emit_d8(cbuf, disp);
%}
@@ -1764,13 +1754,13 @@ encode %{
Label *l = $labl$$label;
$$$emit8$primary;
emit_cc(cbuf, $secondary, $cop$$cmpcode);
- emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size()+4)) : 0);
+ emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0);
%}
enc_class JccShort (cmpOp cop, label labl) %{ // JCC
Label *l = $labl$$label;
emit_cc(cbuf, $primary, $cop$$cmpcode);
- int disp = l ? (l->loc_pos() - (cbuf.code_size()+1)) : 0;
+ int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0;
assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
emit_d8(cbuf, disp);
%}
@@ -1838,10 +1828,10 @@ encode %{
enc_class Java_To_Runtime (method meth) %{ // CALL Java_To_Runtime, Java_To_Runtime_Leaf
// This is the instruction starting address for relocation info.
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
// CALL directly to the runtime
- emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+ emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
runtime_call_Relocation::spec(), RELOC_IMM32 );
if (UseSSE >= 2) {
@@ -1871,12 +1861,12 @@ encode %{
enc_class pre_call_FPU %{
// If method sets FPU control word restore it here
- debug_only(int off0 = cbuf.code_size());
+ debug_only(int off0 = cbuf.insts_size());
if( Compile::current()->in_24_bit_fp_mode() ) {
MacroAssembler masm(&cbuf);
masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std()));
}
- debug_only(int off1 = cbuf.code_size());
+ debug_only(int off1 = cbuf.insts_size());
assert(off1 - off0 == pre_call_FPU_size(), "correct size prediction");
%}
@@ -1889,12 +1879,12 @@ encode %{
%}
enc_class preserve_SP %{
- debug_only(int off0 = cbuf.code_size());
+ debug_only(int off0 = cbuf.insts_size());
MacroAssembler _masm(&cbuf);
// RBP is preserved across all calls, even compiled calls.
// Use it to preserve RSP in places where the callee might change the SP.
__ movptr(rbp_mh_SP_save, rsp);
- debug_only(int off1 = cbuf.code_size());
+ debug_only(int off1 = cbuf.insts_size());
assert(off1 - off0 == preserve_SP_size(), "correct size prediction");
%}
@@ -1906,16 +1896,16 @@ encode %{
enc_class Java_Static_Call (method meth) %{ // JAVA STATIC CALL
// CALL to fixup routine. Fixup routine uses ScopeDesc info to determine
// who we intended to call.
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
if ( !_method ) {
- emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+ emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
runtime_call_Relocation::spec(), RELOC_IMM32 );
} else if(_optimized_virtual) {
- emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+ emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
opt_virtual_call_Relocation::spec(), RELOC_IMM32 );
} else {
- emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+ emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
static_call_Relocation::spec(), RELOC_IMM32 );
}
if( _method ) { // Emit stub for static call
@@ -1927,15 +1917,15 @@ encode %{
// !!!!!
// Generate "Mov EAX,0x00", placeholder instruction to load oop-info
// emit_call_dynamic_prologue( cbuf );
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0xB8 + EAX_enc); // mov EAX,-1
emit_d32_reloc(cbuf, (int)Universe::non_oop_word(), oop_Relocation::spec_for_immediate(), RELOC_IMM32);
- address virtual_call_oop_addr = cbuf.inst_mark();
+ address virtual_call_oop_addr = cbuf.insts_mark();
// CALL to fixup routine. Fixup routine uses ScopeDesc info to determine
// who we intended to call.
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
- emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+ emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
virtual_call_Relocation::spec(virtual_call_oop_addr), RELOC_IMM32 );
%}
@@ -1944,7 +1934,7 @@ encode %{
assert( -128 <= disp && disp <= 127, "compiled_code_offset isn't small");
// CALL *[EAX+in_bytes(methodOopDesc::from_compiled_code_entry_point_offset())]
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
emit_rm(cbuf, 0x01, $secondary, EAX_enc ); // R/M byte
emit_d8(cbuf, disp); // Displacement
@@ -1976,9 +1966,9 @@ encode %{
// emit_rm(cbuf, 0x3, EBP_enc, EBP_enc);
//
// // CALL to interpreter.
-// cbuf.set_inst_mark();
+// cbuf.set_insts_mark();
// $$$emit8$primary;
-// emit_d32_reloc(cbuf, ($labl$$label - (int)(cbuf.code_end()) - 4),
+// emit_d32_reloc(cbuf, ($labl$$label - (int)(cbuf.insts_end()) - 4),
// runtime_call_Relocation::spec(), RELOC_IMM32 );
// %}
@@ -2087,7 +2077,7 @@ encode %{
%}
enc_class Opc_MemImm_F(immF src) %{
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
emit_rm(cbuf, 0x0, $secondary, 0x5);
emit_float_constant(cbuf, $src$$constant);
@@ -2280,7 +2270,7 @@ encode %{
%}
enc_class set_instruction_start( ) %{
- cbuf.set_inst_mark(); // Mark start of opcode for reloc info in mem operand
+ cbuf.set_insts_mark(); // Mark start of opcode for reloc info in mem operand
%}
enc_class RegMem (eRegI ereg, memory mem) %{ // emit_reg_mem
@@ -2429,7 +2419,7 @@ encode %{
emit_opcode( cbuf, 0xD9 ); // FLD (i.e., push it)
emit_d8( cbuf, 0xC0-1+$src$$reg );
}
- cbuf.set_inst_mark(); // Mark start of opcode for reloc info in mem operand
+ cbuf.set_insts_mark(); // Mark start of opcode for reloc info in mem operand
emit_opcode(cbuf,$primary);
encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop);
%}
@@ -2474,7 +2464,7 @@ encode %{
emit_opcode(cbuf,0x1B);
emit_rm(cbuf, 0x3, tmpReg, tmpReg);
// AND $tmp,$y
- cbuf.set_inst_mark(); // Mark start of opcode for reloc info in mem operand
+ cbuf.set_insts_mark(); // Mark start of opcode for reloc info in mem operand
emit_opcode(cbuf,0x23);
int reg_encoding = tmpReg;
int base = $mem$$base;
@@ -3157,9 +3147,9 @@ encode %{
// PUSH src2.lo
emit_opcode(cbuf, 0x50+$src2$$reg );
// CALL directly to the runtime
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf,0xE8); // Call into runtime
- emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::ldiv) - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+ emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::ldiv) - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
// Restore stack
emit_opcode(cbuf, 0x83); // add SP, #framesize
emit_rm(cbuf, 0x3, 0x00, ESP_enc);
@@ -3176,9 +3166,9 @@ encode %{
// PUSH src2.lo
emit_opcode(cbuf, 0x50+$src2$$reg );
// CALL directly to the runtime
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf,0xE8); // Call into runtime
- emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::lrem ) - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+ emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::lrem ) - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
// Restore stack
emit_opcode(cbuf, 0x83); // add SP, #framesize
emit_rm(cbuf, 0x3, 0x00, ESP_enc);
@@ -3824,9 +3814,9 @@ encode %{
%}
enc_class enc_rethrow() %{
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0xE9); // jmp entry
- emit_d32_reloc(cbuf, (int)OptoRuntime::rethrow_stub() - ((int)cbuf.code_end())-4,
+ emit_d32_reloc(cbuf, (int)OptoRuntime::rethrow_stub() - ((int)cbuf.insts_end())-4,
runtime_call_Relocation::spec(), RELOC_IMM32 );
%}
@@ -3873,9 +3863,9 @@ encode %{
emit_opcode(cbuf,0xD9 ); // FLD ST(i)
emit_d8 (cbuf,0xC0-1+$src$$reg );
// CALL directly to the runtime
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf,0xE8); // Call into runtime
- emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+ emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
// Carry on here...
%}
@@ -3915,9 +3905,9 @@ encode %{
emit_opcode(cbuf,0xD9 ); // FLD ST(i)
emit_d8 (cbuf,0xC0-1+$src$$reg );
// CALL directly to the runtime
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf,0xE8); // Call into runtime
- emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+ emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
// Carry on here...
%}
@@ -3988,9 +3978,9 @@ encode %{
emit_d8(cbuf,0x04);
// CALL directly to the runtime
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf,0xE8); // Call into runtime
- emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+ emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
// Carry on here...
%}
@@ -4062,9 +4052,9 @@ encode %{
emit_d8(cbuf,0x08);
// CALL directly to the runtime
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf,0xE8); // Call into runtime
- emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+ emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
// Carry on here...
%}
@@ -4122,9 +4112,9 @@ encode %{
emit_d8(cbuf, $primary ? 0x8 : 0x4);
// CALL directly to the runtime
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf,0xE8); // Call into runtime
- emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+ emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
// Carry on here...
%}
@@ -4321,7 +4311,7 @@ encode %{
// so the memory operand is used twice in the encoding.
enc_class enc_storeL_volatile( memory mem, stackSlotL src ) %{
store_to_stackslot( cbuf, 0x0DF, 0x05, $src$$disp );
- cbuf.set_inst_mark(); // Mark start of FIST in case $mem has an oop
+ cbuf.set_insts_mark(); // Mark start of FIST in case $mem has an oop
emit_opcode(cbuf,0xDF);
int rm_byte_opcode = 0x07;
int base = $mem$$base;
@@ -4345,7 +4335,7 @@ encode %{
bool disp_is_oop = $src->disp_is_oop(); // disp-as-oop when working with static globals
encode_RegMem(cbuf, $tmp$$reg, base, index, scale, displace, disp_is_oop);
}
- cbuf.set_inst_mark(); // Mark start of MOVSD in case $mem has an oop
+ cbuf.set_insts_mark(); // Mark start of MOVSD in case $mem has an oop
{ // MOVSD $mem,$tmp ! atomic long store
emit_opcode(cbuf,0xF2);
emit_opcode(cbuf,0x0F);
@@ -4378,7 +4368,7 @@ encode %{
emit_opcode(cbuf,0x62);
emit_rm(cbuf, 0x3, $tmp$$reg, $tmp2$$reg);
}
- cbuf.set_inst_mark(); // Mark start of MOVSD in case $mem has an oop
+ cbuf.set_insts_mark(); // Mark start of MOVSD in case $mem has an oop
{ // MOVSD $mem,$tmp ! atomic long store
emit_opcode(cbuf,0xF2);
emit_opcode(cbuf,0x0F);
@@ -4399,7 +4389,7 @@ encode %{
// A better choice might be TESTB [spp + pagesize() - CacheLineSize()],0
enc_class Safepoint_Poll() %{
- cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_type, 0);
+ cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_type, 0);
emit_opcode(cbuf,0x85);
emit_rm (cbuf, 0x0, 0x7, 0x5);
emit_d32(cbuf, (intptr_t)os::get_polling_page());
@@ -12932,7 +12922,7 @@ instruct jmpConUCF2(cmpOpUCF2 cop, eFlagsRegUCF cmp, label labl) %{
bool ok = false;
if ($cop$$cmpcode == Assembler::notEqual) {
// the two jumps 6 bytes apart so the jump distances are too
- parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0;
+ parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
} else if ($cop$$cmpcode == Assembler::equal) {
parity_disp = 6;
ok = true;
@@ -12942,7 +12932,7 @@ instruct jmpConUCF2(cmpOpUCF2 cop, eFlagsRegUCF cmp, label labl) %{
emit_d32(cbuf, parity_disp);
$$$emit8$primary;
emit_cc(cbuf, $secondary, $cop$$cmpcode);
- int disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0;
+ int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
emit_d32(cbuf, disp);
%}
ins_pipe(pipe_jcc);
@@ -13128,7 +13118,7 @@ instruct jmpConUCF2_short(cmpOpUCF2 cop, eFlagsRegUCF cmp, label labl) %{
emit_cc(cbuf, $primary, Assembler::parity);
int parity_disp = -1;
if ($cop$$cmpcode == Assembler::notEqual) {
- parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+ parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
} else if ($cop$$cmpcode == Assembler::equal) {
parity_disp = 2;
} else {
@@ -13136,7 +13126,7 @@ instruct jmpConUCF2_short(cmpOpUCF2 cop, eFlagsRegUCF cmp, label labl) %{
}
emit_d8(cbuf, parity_disp);
emit_cc(cbuf, $primary, $cop$$cmpcode);
- int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+ int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
emit_d8(cbuf, disp);
assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp");
diff --git a/src/cpu/x86/vm/x86_64.ad b/src/cpu/x86/vm/x86_64.ad
index ba24322a9..b0f73012f 100644
--- a/src/cpu/x86/vm/x86_64.ad
+++ b/src/cpu/x86/vm/x86_64.ad
@@ -619,62 +619,48 @@ void MachBreakpointNode::format(PhaseRegAlloc*, outputStream* st) const
#endif
// EMIT_RM()
-void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3)
-{
+void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3) {
unsigned char c = (unsigned char) ((f1 << 6) | (f2 << 3) | f3);
- *(cbuf.code_end()) = c;
- cbuf.set_code_end(cbuf.code_end() + 1);
+ cbuf.insts()->emit_int8(c);
}
// EMIT_CC()
-void emit_cc(CodeBuffer &cbuf, int f1, int f2)
-{
+void emit_cc(CodeBuffer &cbuf, int f1, int f2) {
unsigned char c = (unsigned char) (f1 | f2);
- *(cbuf.code_end()) = c;
- cbuf.set_code_end(cbuf.code_end() + 1);
+ cbuf.insts()->emit_int8(c);
}
// EMIT_OPCODE()
-void emit_opcode(CodeBuffer &cbuf, int code)
-{
- *(cbuf.code_end()) = (unsigned char) code;
- cbuf.set_code_end(cbuf.code_end() + 1);
+void emit_opcode(CodeBuffer &cbuf, int code) {
+ cbuf.insts()->emit_int8((unsigned char) code);
}
// EMIT_OPCODE() w/ relocation information
void emit_opcode(CodeBuffer &cbuf,
int code, relocInfo::relocType reloc, int offset, int format)
{
- cbuf.relocate(cbuf.inst_mark() + offset, reloc, format);
+ cbuf.relocate(cbuf.insts_mark() + offset, reloc, format);
emit_opcode(cbuf, code);
}
// EMIT_D8()
-void emit_d8(CodeBuffer &cbuf, int d8)
-{
- *(cbuf.code_end()) = (unsigned char) d8;
- cbuf.set_code_end(cbuf.code_end() + 1);
+void emit_d8(CodeBuffer &cbuf, int d8) {
+ cbuf.insts()->emit_int8((unsigned char) d8);
}
// EMIT_D16()
-void emit_d16(CodeBuffer &cbuf, int d16)
-{
- *((short *)(cbuf.code_end())) = d16;
- cbuf.set_code_end(cbuf.code_end() + 2);
+void emit_d16(CodeBuffer &cbuf, int d16) {
+ cbuf.insts()->emit_int16(d16);
}
// EMIT_D32()
-void emit_d32(CodeBuffer &cbuf, int d32)
-{
- *((int *)(cbuf.code_end())) = d32;
- cbuf.set_code_end(cbuf.code_end() + 4);
+void emit_d32(CodeBuffer &cbuf, int d32) {
+ cbuf.insts()->emit_int32(d32);
}
// EMIT_D64()
-void emit_d64(CodeBuffer &cbuf, int64_t d64)
-{
- *((int64_t*) (cbuf.code_end())) = d64;
- cbuf.set_code_end(cbuf.code_end() + 8);
+void emit_d64(CodeBuffer &cbuf, int64_t d64) {
+ cbuf.insts()->emit_int64(d64);
}
// emit 32 bit value and construct relocation entry from relocInfo::relocType
@@ -684,32 +670,24 @@ void emit_d32_reloc(CodeBuffer& cbuf,
int format)
{
assert(reloc != relocInfo::external_word_type, "use 2-arg emit_d32_reloc");
- cbuf.relocate(cbuf.inst_mark(), reloc, format);
-
- *((int*) (cbuf.code_end())) = d32;
- cbuf.set_code_end(cbuf.code_end() + 4);
+ cbuf.relocate(cbuf.insts_mark(), reloc, format);
+ cbuf.insts()->emit_int32(d32);
}
// emit 32 bit value and construct relocation entry from RelocationHolder
-void emit_d32_reloc(CodeBuffer& cbuf,
- int d32,
- RelocationHolder const& rspec,
- int format)
-{
+void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, int format) {
#ifdef ASSERT
if (rspec.reloc()->type() == relocInfo::oop_type &&
d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
assert(oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code");
}
#endif
- cbuf.relocate(cbuf.inst_mark(), rspec, format);
-
- *((int* )(cbuf.code_end())) = d32;
- cbuf.set_code_end(cbuf.code_end() + 4);
+ cbuf.relocate(cbuf.insts_mark(), rspec, format);
+ cbuf.insts()->emit_int32(d32);
}
void emit_d32_reloc(CodeBuffer& cbuf, address addr) {
- address next_ip = cbuf.code_end() + 4;
+ address next_ip = cbuf.insts_end() + 4;
emit_d32_reloc(cbuf, (int) (addr - next_ip),
external_word_Relocation::spec(addr),
RELOC_DISP32);
@@ -717,23 +695,13 @@ void emit_d32_reloc(CodeBuffer& cbuf, address addr) {
// emit 64 bit value and construct relocation entry from relocInfo::relocType
-void emit_d64_reloc(CodeBuffer& cbuf,
- int64_t d64,
- relocInfo::relocType reloc,
- int format)
-{
- cbuf.relocate(cbuf.inst_mark(), reloc, format);
-
- *((int64_t*) (cbuf.code_end())) = d64;
- cbuf.set_code_end(cbuf.code_end() + 8);
+void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, relocInfo::relocType reloc, int format) {
+ cbuf.relocate(cbuf.insts_mark(), reloc, format);
+ cbuf.insts()->emit_int64(d64);
}
// emit 64 bit value and construct relocation entry from RelocationHolder
-void emit_d64_reloc(CodeBuffer& cbuf,
- int64_t d64,
- RelocationHolder const& rspec,
- int format)
-{
+void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec, int format) {
#ifdef ASSERT
if (rspec.reloc()->type() == relocInfo::oop_type &&
d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) {
@@ -741,10 +709,8 @@ void emit_d64_reloc(CodeBuffer& cbuf,
"cannot embed scavengable oops in code");
}
#endif
- cbuf.relocate(cbuf.inst_mark(), rspec, format);
-
- *((int64_t*) (cbuf.code_end())) = d64;
- cbuf.set_code_end(cbuf.code_end() + 8);
+ cbuf.relocate(cbuf.insts_mark(), rspec, format);
+ cbuf.insts()->emit_int64(d64);
}
// Access stack slot for load or store
@@ -966,7 +932,7 @@ void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const
}
}
- C->set_frame_complete(cbuf.code_end() - cbuf.code_begin());
+ C->set_frame_complete(cbuf.insts_size());
#ifdef ASSERT
if (VerifyStackAtCalls) {
@@ -1050,11 +1016,11 @@ void MachEpilogNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
if (do_polling() && C->is_method_compilation()) {
// testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes
// XXX reg_mem doesn't support RIP-relative addressing yet
- cbuf.set_inst_mark();
- cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_return_type, 0); // XXX
+ cbuf.set_insts_mark();
+ cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_return_type, 0); // XXX
emit_opcode(cbuf, 0x85); // testl
emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5
- // cbuf.inst_mark() is beginning of instruction
+ // cbuf.insts_mark() is beginning of instruction
emit_d32_reloc(cbuf, os::get_polling_page());
// relocInfo::poll_return_type,
}
@@ -1814,9 +1780,9 @@ void emit_java_to_interp(CodeBuffer& cbuf)
// movq rbx, 0
// jmp -5 # to self
- address mark = cbuf.inst_mark(); // get mark within main instrs section
+ address mark = cbuf.insts_mark(); // get mark within main instrs section
- // Note that the code buffer's inst_mark is always relative to insts.
+ // Note that the code buffer's insts_mark is always relative to insts.
// That's why we must use the macroassembler to generate a stub.
MacroAssembler _masm(&cbuf);
@@ -1830,7 +1796,7 @@ void emit_java_to_interp(CodeBuffer& cbuf)
// This is recognized as unresolved by relocs/nativeinst/ic code
__ jump(RuntimeAddress(__ pc()));
- // Update current stubs pointer and restore code_end.
+ // Update current stubs pointer and restore insts_end.
__ end_a_stub();
}
@@ -1868,7 +1834,7 @@ void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
{
MacroAssembler masm(&cbuf);
- uint code_size = cbuf.code_size();
+ uint insts_size = cbuf.insts_size();
if (UseCompressedOops) {
masm.load_klass(rscratch1, j_rarg0);
masm.cmpptr(rax, rscratch1);
@@ -1880,7 +1846,7 @@ void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
/* WARNING these NOPs are critical so that verified entry point is properly
4 bytes aligned for patching by NativeJump::patch_verified_entry() */
- int nops_cnt = 4 - ((cbuf.code_size() - code_size) & 0x3);
+ int nops_cnt = 4 - ((cbuf.insts_size() - insts_size) & 0x3);
if (OptoBreakpoint) {
// Leave space for int3
nops_cnt -= 1;
@@ -1910,14 +1876,14 @@ uint size_exception_handler()
int emit_exception_handler(CodeBuffer& cbuf)
{
- // Note that the code buffer's inst_mark is always relative to insts.
+ // Note that the code buffer's insts_mark is always relative to insts.
// That's why we must use the macroassembler to generate a handler.
MacroAssembler _masm(&cbuf);
address base =
__ start_a_stub(size_exception_handler());
if (base == NULL) return 0; // CodeBuffer::expand failed
int offset = __ offset();
- __ jump(RuntimeAddress(OptoRuntime::exception_blob()->instructions_begin()));
+ __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));
assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
__ end_a_stub();
return offset;
@@ -1933,7 +1899,7 @@ uint size_deopt_handler()
int emit_deopt_handler(CodeBuffer& cbuf)
{
- // Note that the code buffer's inst_mark is always relative to insts.
+ // Note that the code buffer's insts_mark is always relative to insts.
// That's why we must use the macroassembler to generate a handler.
MacroAssembler _masm(&cbuf);
address base =
@@ -1962,7 +1928,7 @@ static void emit_double_constant(CodeBuffer& cbuf, double x) {
address double_address = __ double_constant(x);
cbuf.insts()->set_mark_off(mark); // preserve mark across masm shift
emit_d32_reloc(cbuf,
- (int) (double_address - cbuf.code_end() - 4),
+ (int) (double_address - cbuf.insts_end() - 4),
internal_word_Relocation::spec(double_address),
RELOC_DISP32);
}
@@ -1973,7 +1939,7 @@ static void emit_float_constant(CodeBuffer& cbuf, float x) {
address float_address = __ float_constant(x);
cbuf.insts()->set_mark_off(mark); // preserve mark across masm shift
emit_d32_reloc(cbuf,
- (int) (float_address - cbuf.code_end() - 4),
+ (int) (float_address - cbuf.insts_end() - 4),
internal_word_Relocation::spec(float_address),
RELOC_DISP32);
}
@@ -2481,14 +2447,14 @@ encode %{
%{
// JMP, CALL
Label* l = $labl$$label;
- emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0);
+ emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0);
%}
enc_class LblShort(label labl)
%{
// JMP, CALL
Label* l = $labl$$label;
- int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+ int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
emit_d8(cbuf, disp);
%}
@@ -2517,7 +2483,7 @@ encode %{
Label* l = $labl$$label;
$$$emit8$primary;
emit_cc(cbuf, $secondary, $cop$$cmpcode);
- emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0);
+ emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0);
%}
enc_class JccShort (cmpOp cop, label labl)
@@ -2525,7 +2491,7 @@ encode %{
// JCC
Label *l = $labl$$label;
emit_cc(cbuf, $primary, $cop$$cmpcode);
- int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+ int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
emit_d8(cbuf, disp);
%}
@@ -2609,22 +2575,22 @@ encode %{
%{
// CALL Java_To_Interpreter
// This is the instruction starting address for relocation info.
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
// CALL directly to the runtime
emit_d32_reloc(cbuf,
- (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+ (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
runtime_call_Relocation::spec(),
RELOC_DISP32);
%}
enc_class preserve_SP %{
- debug_only(int off0 = cbuf.code_size());
+ debug_only(int off0 = cbuf.insts_size());
MacroAssembler _masm(&cbuf);
// RBP is preserved across all calls, even compiled calls.
// Use it to preserve RSP in places where the callee might change the SP.
__ movptr(rbp_mh_SP_save, rsp);
- debug_only(int off1 = cbuf.code_size());
+ debug_only(int off1 = cbuf.insts_size());
assert(off1 - off0 == preserve_SP_size(), "correct size prediction");
%}
@@ -2638,22 +2604,22 @@ encode %{
// JAVA STATIC CALL
// CALL to fixup routine. Fixup routine uses ScopeDesc info to
// determine who we intended to call.
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
if (!_method) {
emit_d32_reloc(cbuf,
- (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+ (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
runtime_call_Relocation::spec(),
RELOC_DISP32);
} else if (_optimized_virtual) {
emit_d32_reloc(cbuf,
- (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+ (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
opt_virtual_call_Relocation::spec(),
RELOC_DISP32);
} else {
emit_d32_reloc(cbuf,
- (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+ (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
static_call_Relocation::spec(),
RELOC_DISP32);
}
@@ -2669,7 +2635,7 @@ encode %{
// !!!!!
// Generate "movq rax, -1", placeholder instruction to load oop-info
// emit_call_dynamic_prologue( cbuf );
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
// movq rax, -1
emit_opcode(cbuf, Assembler::REX_W);
@@ -2677,13 +2643,13 @@ encode %{
emit_d64_reloc(cbuf,
(int64_t) Universe::non_oop_word(),
oop_Relocation::spec_for_immediate(), RELOC_IMM64);
- address virtual_call_oop_addr = cbuf.inst_mark();
+ address virtual_call_oop_addr = cbuf.insts_mark();
// CALL to fixup routine. Fixup routine uses ScopeDesc info to determine
// who we intended to call.
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
emit_d32_reloc(cbuf,
- (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+ (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
virtual_call_Relocation::spec(virtual_call_oop_addr),
RELOC_DISP32);
%}
@@ -2697,7 +2663,7 @@ encode %{
// assert(-0x80 <= disp && disp < 0x80, "compiled_code_offset isn't small");
// callq *disp(%rax)
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
$$$emit8$primary;
if (disp < 0x80) {
emit_rm(cbuf, 0x01, $secondary, RAX_enc); // R/M byte
@@ -3729,10 +3695,10 @@ encode %{
enc_class enc_rethrow()
%{
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0xE9); // jmp entry
emit_d32_reloc(cbuf,
- (int) (OptoRuntime::rethrow_stub() - cbuf.code_end() - 4),
+ (int) (OptoRuntime::rethrow_stub() - cbuf.insts_end() - 4),
runtime_call_Relocation::spec(),
RELOC_DISP32);
%}
@@ -3742,7 +3708,7 @@ encode %{
int dstenc = $dst$$reg;
address signmask_address = (address) StubRoutines::x86::float_sign_mask();
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
if (dstenc >= 8) {
emit_opcode(cbuf, Assembler::REX_R);
dstenc -= 8;
@@ -3759,7 +3725,7 @@ encode %{
int dstenc = $dst$$reg;
address signmask_address = (address) StubRoutines::x86::double_sign_mask();
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0x66);
if (dstenc >= 8) {
emit_opcode(cbuf, Assembler::REX_R);
@@ -3777,7 +3743,7 @@ encode %{
int dstenc = $dst$$reg;
address signflip_address = (address) StubRoutines::x86::float_sign_flip();
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
if (dstenc >= 8) {
emit_opcode(cbuf, Assembler::REX_R);
dstenc -= 8;
@@ -3794,7 +3760,7 @@ encode %{
int dstenc = $dst$$reg;
address signflip_address = (address) StubRoutines::x86::double_sign_flip();
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0x66);
if (dstenc >= 8) {
emit_opcode(cbuf, Assembler::REX_R);
@@ -3846,11 +3812,11 @@ encode %{
encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes
// call f2i_fixup
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0xE8);
emit_d32_reloc(cbuf,
(int)
- (StubRoutines::x86::f2i_fixup() - cbuf.code_end() - 4),
+ (StubRoutines::x86::f2i_fixup() - cbuf.insts_end() - 4),
runtime_call_Relocation::spec(),
RELOC_DISP32);
@@ -3870,7 +3836,7 @@ encode %{
address const_address = (address) StubRoutines::x86::double_sign_flip();
// cmpq $dst, [0x8000000000000000]
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, dstenc < 8 ? Assembler::REX_W : Assembler::REX_WR);
emit_opcode(cbuf, 0x39);
// XXX reg_mem doesn't support RIP-relative addressing yet
@@ -3904,11 +3870,11 @@ encode %{
encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes
// call f2l_fixup
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0xE8);
emit_d32_reloc(cbuf,
(int)
- (StubRoutines::x86::f2l_fixup() - cbuf.code_end() - 4),
+ (StubRoutines::x86::f2l_fixup() - cbuf.insts_end() - 4),
runtime_call_Relocation::spec(),
RELOC_DISP32);
@@ -3960,11 +3926,11 @@ encode %{
encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes
// call d2i_fixup
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0xE8);
emit_d32_reloc(cbuf,
(int)
- (StubRoutines::x86::d2i_fixup() - cbuf.code_end() - 4),
+ (StubRoutines::x86::d2i_fixup() - cbuf.insts_end() - 4),
runtime_call_Relocation::spec(),
RELOC_DISP32);
@@ -3984,7 +3950,7 @@ encode %{
address const_address = (address) StubRoutines::x86::double_sign_flip();
// cmpq $dst, [0x8000000000000000]
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, dstenc < 8 ? Assembler::REX_W : Assembler::REX_WR);
emit_opcode(cbuf, 0x39);
// XXX reg_mem doesn't support RIP-relative addressing yet
@@ -4018,11 +3984,11 @@ encode %{
encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes
// call d2l_fixup
- cbuf.set_inst_mark();
+ cbuf.set_insts_mark();
emit_opcode(cbuf, 0xE8);
emit_d32_reloc(cbuf,
(int)
- (StubRoutines::x86::d2l_fixup() - cbuf.code_end() - 4),
+ (StubRoutines::x86::d2l_fixup() - cbuf.insts_end() - 4),
runtime_call_Relocation::spec(),
RELOC_DISP32);
@@ -4042,11 +4008,11 @@ encode %{
%{
// testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes
// XXX reg_mem doesn't support RIP-relative addressing yet
- cbuf.set_inst_mark();
- cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_type, 0); // XXX
+ cbuf.set_insts_mark();
+ cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_type, 0); // XXX
emit_opcode(cbuf, 0x85); // testl
emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5
- // cbuf.inst_mark() is beginning of instruction
+ // cbuf.insts_mark() is beginning of instruction
emit_d32_reloc(cbuf, os::get_polling_page());
// relocInfo::poll_type,
%}
@@ -12304,7 +12270,7 @@ instruct jmpConUCF2(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{
int parity_disp = -1;
if ($cop$$cmpcode == Assembler::notEqual) {
// the two jumps 6 bytes apart so the jump distances are too
- parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0;
+ parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
} else if ($cop$$cmpcode == Assembler::equal) {
parity_disp = 6;
} else {
@@ -12313,7 +12279,7 @@ instruct jmpConUCF2(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{
emit_d32(cbuf, parity_disp);
$$$emit8$primary;
emit_cc(cbuf, $secondary, $cop$$cmpcode);
- int disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0;
+ int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
emit_d32(cbuf, disp);
%}
ins_pipe(pipe_jcc);
@@ -12508,7 +12474,7 @@ instruct jmpConUCF2_short(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{
emit_cc(cbuf, $primary, Assembler::parity);
int parity_disp = -1;
if ($cop$$cmpcode == Assembler::notEqual) {
- parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+ parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
} else if ($cop$$cmpcode == Assembler::equal) {
parity_disp = 2;
} else {
@@ -12516,7 +12482,7 @@ instruct jmpConUCF2_short(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{
}
emit_d8(cbuf, parity_disp);
emit_cc(cbuf, $primary, $cop$$cmpcode);
- int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+ int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
emit_d8(cbuf, disp);
assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp");
diff --git a/src/os/solaris/dtrace/generateJvmOffsets.cpp b/src/os/solaris/dtrace/generateJvmOffsets.cpp
index d39ffdd3f..d60d0bb64 100644
--- a/src/os/solaris/dtrace/generateJvmOffsets.cpp
+++ b/src/os/solaris/dtrace/generateJvmOffsets.cpp
@@ -230,7 +230,8 @@ int generateJvmOffsets(GEN_variant gen_variant) {
GEN_OFFS(CodeBlob, _name);
GEN_OFFS(CodeBlob, _header_size);
- GEN_OFFS(CodeBlob, _instructions_offset);
+ GEN_OFFS(CodeBlob, _content_offset);
+ GEN_OFFS(CodeBlob, _code_offset);
GEN_OFFS(CodeBlob, _data_offset);
GEN_OFFS(CodeBlob, _frame_size);
printf("\n");
diff --git a/src/os/solaris/dtrace/libjvm_db.c b/src/os/solaris/dtrace/libjvm_db.c
index 691cbb7be..5e1d62680 100644
--- a/src/os/solaris/dtrace/libjvm_db.c
+++ b/src/os/solaris/dtrace/libjvm_db.c
@@ -124,7 +124,7 @@ typedef struct Nmethod_t {
uint64_t pc_desc;
int32_t orig_pc_offset; /* _orig_pc_offset */
- int32_t instrs_beg; /* _instructions_offset */
+ int32_t instrs_beg; /* _code_offset */
int32_t instrs_end;
int32_t deopt_beg; /* _deoptimize_offset */
int32_t scopes_data_beg; /* _scopes_data_offset */
@@ -587,7 +587,7 @@ static int nmethod_info(Nmethod_t *N)
fprintf(stderr, "\t nmethod_info: BEGIN \n");
/* Instructions */
- err = ps_pread(J->P, nm + OFFSET_CodeBlob_instructions_offset, &N->instrs_beg, SZ32);
+ err = ps_pread(J->P, nm + OFFSET_CodeBlob_code_offset, &N->instrs_beg, SZ32);
CHECK_FAIL(err);
err = ps_pread(J->P, nm + OFFSET_CodeBlob_data_offset, &N->instrs_end, SZ32);
CHECK_FAIL(err);
diff --git a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
index 8cc55b78c..cc3267587 100644
--- a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
+++ b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -149,8 +149,8 @@ bool os::register_code_area(char *low, char *high) {
// If we are using Vectored Exceptions we don't need this registration
if (UseVectoredExceptions) return true;
- BufferBlob* b = BufferBlob::create("CodeCache Exception Handler", sizeof (DynamicCodeData));
- CodeBuffer cb(b->instructions_begin(), b->instructions_size());
+ BufferBlob* blob = BufferBlob::create("CodeCache Exception Handler", sizeof(DynamicCodeData));
+ CodeBuffer cb(blob);
MacroAssembler* masm = new MacroAssembler(&cb);
pDCD = (pDynamicCodeData) masm->pc();
diff --git a/src/os_cpu/windows_x86/vm/windows_x86_32.ad b/src/os_cpu/windows_x86/vm/windows_x86_32.ad
index 88eccf220..32b7b2973 100644
--- a/src/os_cpu/windows_x86/vm/windows_x86_32.ad
+++ b/src/os_cpu/windows_x86/vm/windows_x86_32.ad
@@ -1,5 +1,5 @@
//
-// Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@@ -141,8 +141,7 @@ source %{
// emit an interrupt that is caught by the debugger
void emit_break(CodeBuffer &cbuf) {
- *(cbuf.code_end()) = (unsigned char)(0xcc);
- cbuf.set_code_end(cbuf.code_end() + 1);
+ cbuf.insts()->emit_int8((unsigned char) 0xcc);
}
void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
diff --git a/src/os_cpu/windows_x86/vm/windows_x86_64.ad b/src/os_cpu/windows_x86/vm/windows_x86_64.ad
index 3e1b573f8..69374f8e4 100644
--- a/src/os_cpu/windows_x86/vm/windows_x86_64.ad
+++ b/src/os_cpu/windows_x86/vm/windows_x86_64.ad
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@@ -144,8 +144,7 @@ int MachCallRuntimeNode::ret_addr_offset()
// emit an interrupt that is caught by the debugger
void emit_break(CodeBuffer &cbuf) {
- *(cbuf.code_end()) = (unsigned char)(0xcc);
- cbuf.set_code_end(cbuf.code_end() + 1);
+ cbuf.insts()->emit_int8((unsigned char) 0xcc);
}
void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
diff --git a/src/share/vm/adlc/output_c.cpp b/src/share/vm/adlc/output_c.cpp
index 393fd238b..75cdcacb9 100644
--- a/src/share/vm/adlc/output_c.cpp
+++ b/src/share/vm/adlc/output_c.cpp
@@ -2482,7 +2482,7 @@ void ArchDesc::defineEmit(FILE *fp, InstructForm &inst) {
}
// Save current instruction's starting address (helps with relocation).
- fprintf( fp, " cbuf.set_inst_mark();\n");
+ fprintf(fp, " cbuf.set_insts_mark();\n");
// // // idx0 is only needed for syntactic purposes and only by "storeSSI"
// fprintf( fp, " unsigned idx0 = 0;\n");
diff --git a/src/share/vm/asm/codeBuffer.cpp b/src/share/vm/asm/codeBuffer.cpp
index 77e7cdb87..cae51ddb8 100644
--- a/src/share/vm/asm/codeBuffer.cpp
+++ b/src/share/vm/asm/codeBuffer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -74,12 +74,11 @@
typedef CodeBuffer::csize_t csize_t; // file-local definition
-// external buffer, in a predefined CodeBlob or other buffer area
+// External buffer, in a predefined CodeBlob.
// Important: The code_start must be taken exactly, and not realigned.
-CodeBuffer::CodeBuffer(address code_start, csize_t code_size) {
- assert(code_start != NULL, "sanity");
+CodeBuffer::CodeBuffer(CodeBlob* blob) {
initialize_misc("static buffer");
- initialize(code_start, code_size);
+ initialize(blob->content_begin(), blob->content_size());
assert(verify_section_allocation(), "initial use of buffer OK");
}
@@ -99,7 +98,7 @@ void CodeBuffer::initialize(csize_t code_size, csize_t locs_size) {
// Set up various pointers into the blob.
initialize(_total_start, _total_size);
- assert((uintptr_t)code_begin() % CodeEntryAlignment == 0, "instruction start not code entry aligned");
+ assert((uintptr_t)insts_begin() % CodeEntryAlignment == 0, "instruction start not code entry aligned");
pd_initialize();
@@ -192,8 +191,8 @@ void CodeBuffer::freeze_section(CodeSection* cs) {
void CodeBuffer::set_blob(BufferBlob* blob) {
_blob = blob;
if (blob != NULL) {
- address start = blob->instructions_begin();
- address end = blob->instructions_end();
+ address start = blob->content_begin();
+ address end = blob->content_end();
// Round up the starting address.
int align = _insts.alignment();
start += (-(intptr_t)start) & (align-1);
@@ -422,21 +421,21 @@ void CodeSection::expand_locs(int new_capacity) {
/// The pattern is the same for all functions.
/// We iterate over all the sections, padding each to alignment.
-csize_t CodeBuffer::total_code_size() const {
- csize_t code_size_so_far = 0;
+csize_t CodeBuffer::total_content_size() const {
+ csize_t size_so_far = 0;
for (int n = 0; n < (int)SECT_LIMIT; n++) {
const CodeSection* cs = code_section(n);
if (cs->is_empty()) continue; // skip trivial section
- code_size_so_far = cs->align_at_start(code_size_so_far);
- code_size_so_far += cs->size();
+ size_so_far = cs->align_at_start(size_so_far);
+ size_so_far += cs->size();
}
- return code_size_so_far;
+ return size_so_far;
}
void CodeBuffer::compute_final_layout(CodeBuffer* dest) const {
address buf = dest->_total_start;
csize_t buf_offset = 0;
- assert(dest->_total_size >= total_code_size(), "must be big enough");
+ assert(dest->_total_size >= total_content_size(), "must be big enough");
{
// not sure why this is here, but why not...
@@ -489,7 +488,7 @@ void CodeBuffer::compute_final_layout(CodeBuffer* dest) const {
}
// Done calculating sections; did it come out to the right end?
- assert(buf_offset == total_code_size(), "sanity");
+ assert(buf_offset == total_content_size(), "sanity");
assert(dest->verify_section_allocation(), "final configuration works");
}
@@ -515,7 +514,7 @@ csize_t CodeBuffer::total_offset_of(address addr) const {
csize_t CodeBuffer::total_relocation_size() const {
csize_t lsize = copy_relocations_to(NULL); // dry run only
- csize_t csize = total_code_size();
+ csize_t csize = total_content_size();
csize_t total = RelocIterator::locs_and_index_size(csize, lsize);
return (csize_t) align_size_up(total, HeapWordSize);
}
@@ -601,7 +600,7 @@ csize_t CodeBuffer::copy_relocations_to(CodeBlob* dest) const {
buf_offset += sizeof(relocInfo);
}
- assert(code_end_so_far == total_code_size(), "sanity");
+ assert(code_end_so_far == total_content_size(), "sanity");
// Account for index:
if (buf != NULL) {
@@ -621,9 +620,8 @@ void CodeBuffer::copy_code_to(CodeBlob* dest_blob) {
}
#endif //PRODUCT
- CodeBuffer dest(dest_blob->instructions_begin(),
- dest_blob->instructions_size());
- assert(dest_blob->instructions_size() >= total_code_size(), "good sizing");
+ CodeBuffer dest(dest_blob);
+ assert(dest_blob->content_size() >= total_content_size(), "good sizing");
this->compute_final_layout(&dest);
relocate_code_to(&dest);
@@ -631,11 +629,10 @@ void CodeBuffer::copy_code_to(CodeBlob* dest_blob) {
dest_blob->set_comments(_comments);
// Done moving code bytes; were they the right size?
- assert(round_to(dest.total_code_size(), oopSize) == dest_blob->instructions_size(), "sanity");
+ assert(round_to(dest.total_content_size(), oopSize) == dest_blob->content_size(), "sanity");
// Flush generated code
- ICache::invalidate_range(dest_blob->instructions_begin(),
- dest_blob->instructions_size());
+ ICache::invalidate_range(dest_blob->code_begin(), dest_blob->code_size());
}
// Move all my code into another code buffer.
@@ -844,8 +841,8 @@ bool CodeBuffer::verify_section_allocation() {
if (tstart == badAddress) return true; // smashed by set_blob(NULL)
address tend = tstart + _total_size;
if (_blob != NULL) {
- assert(tstart >= _blob->instructions_begin(), "sanity");
- assert(tend <= _blob->instructions_end(), "sanity");
+ assert(tstart >= _blob->content_begin(), "sanity");
+ assert(tend <= _blob->content_end(), "sanity");
}
address tcheck = tstart; // advancing pointer to verify disjointness
for (int n = 0; n < (int)SECT_LIMIT; n++) {
@@ -981,13 +978,13 @@ void CodeComments::free() {
void CodeBuffer::decode() {
- Disassembler::decode(decode_begin(), code_end());
- _decode_begin = code_end();
+ Disassembler::decode(decode_begin(), insts_end());
+ _decode_begin = insts_end();
}
void CodeBuffer::skip_decode() {
- _decode_begin = code_end();
+ _decode_begin = insts_end();
}
diff --git a/src/share/vm/asm/codeBuffer.hpp b/src/share/vm/asm/codeBuffer.hpp
index 8e4a4ea32..6e6897b06 100644
--- a/src/share/vm/asm/codeBuffer.hpp
+++ b/src/share/vm/asm/codeBuffer.hpp
@@ -186,6 +186,12 @@ class CodeSection VALUE_OBJ_CLASS_SPEC {
_locs_point = pc;
}
+ // Code emission
+ void emit_int8 (int8_t x) { *((int8_t*) end()) = x; set_end(end() + 1); }
+ void emit_int16(int16_t x) { *((int16_t*) end()) = x; set_end(end() + 2); }
+ void emit_int32(int32_t x) { *((int32_t*) end()) = x; set_end(end() + 4); }
+ void emit_int64(int64_t x) { *((int64_t*) end()) = x; set_end(end() + 8); }
+
// Share a scratch buffer for relocinfo. (Hacky; saves a resource allocation.)
void initialize_shared_locs(relocInfo* buf, int length);
@@ -374,9 +380,17 @@ class CodeBuffer: public StackObj {
public:
// (1) code buffer referring to pre-allocated instruction memory
- CodeBuffer(address code_start, csize_t code_size);
+ CodeBuffer(address code_start, csize_t code_size) {
+ assert(code_start != NULL, "sanity");
+ initialize_misc("static buffer");
+ initialize(code_start, code_size);
+ assert(verify_section_allocation(), "initial use of buffer OK");
+ }
+
+ // (2) CodeBuffer referring to pre-allocated CodeBlob.
+ CodeBuffer(CodeBlob* blob);
- // (2) code buffer allocating codeBlob memory for code & relocation
+ // (3) code buffer allocating codeBlob memory for code & relocation
// info but with lazy initialization. The name must be something
// informative.
CodeBuffer(const char* name) {
@@ -384,7 +398,7 @@ class CodeBuffer: public StackObj {
}
- // (3) code buffer allocating codeBlob memory for code & relocation
+ // (4) code buffer allocating codeBlob memory for code & relocation
// info. The name must be something informative and code_size must
// include both code and stubs sizes.
CodeBuffer(const char* name, csize_t code_size, csize_t locs_size) {
@@ -394,8 +408,8 @@ class CodeBuffer: public StackObj {
~CodeBuffer();
- // Initialize a CodeBuffer constructed using constructor 2. Using
- // constructor 3 is equivalent to calling constructor 2 and then
+ // Initialize a CodeBuffer constructed using constructor 3. Using
+ // constructor 4 is equivalent to calling constructor 3 and then
// calling this method. It's been factored out for convenience of
// construction.
void initialize(csize_t code_size, csize_t locs_size);
@@ -438,36 +452,37 @@ class CodeBuffer: public StackObj {
void free_blob(); // Free the blob, if we own one.
// Properties relative to the insts section:
- address code_begin() const { return _insts.start(); }
- address code_end() const { return _insts.end(); }
- void set_code_end(address end) { _insts.set_end(end); }
- address code_limit() const { return _insts.limit(); }
- address inst_mark() const { return _insts.mark(); }
- void set_inst_mark() { _insts.set_mark(); }
- void clear_inst_mark() { _insts.clear_mark(); }
+ address insts_begin() const { return _insts.start(); }
+ address insts_end() const { return _insts.end(); }
+ void set_insts_end(address end) { _insts.set_end(end); }
+ address insts_limit() const { return _insts.limit(); }
+ address insts_mark() const { return _insts.mark(); }
+ void set_insts_mark() { _insts.set_mark(); }
+ void clear_insts_mark() { _insts.clear_mark(); }
// is there anything in the buffer other than the current section?
- bool is_pure() const { return code_size() == total_code_size(); }
+ bool is_pure() const { return insts_size() == total_content_size(); }
// size in bytes of output so far in the insts sections
- csize_t code_size() const { return _insts.size(); }
+ csize_t insts_size() const { return _insts.size(); }
- // same as code_size(), except that it asserts there is no non-code here
- csize_t pure_code_size() const { assert(is_pure(), "no non-code");
- return code_size(); }
+ // same as insts_size(), except that it asserts there is no non-code here
+ csize_t pure_insts_size() const { assert(is_pure(), "no non-code");
+ return insts_size(); }
// capacity in bytes of the insts sections
- csize_t code_capacity() const { return _insts.capacity(); }
+ csize_t insts_capacity() const { return _insts.capacity(); }
// number of bytes remaining in the insts section
- csize_t code_remaining() const { return _insts.remaining(); }
+ csize_t insts_remaining() const { return _insts.remaining(); }
// is a given address in the insts section? (2nd version is end-inclusive)
- bool code_contains(address pc) const { return _insts.contains(pc); }
- bool code_contains2(address pc) const { return _insts.contains2(pc); }
+ bool insts_contains(address pc) const { return _insts.contains(pc); }
+ bool insts_contains2(address pc) const { return _insts.contains2(pc); }
- // allocated size of code in all sections, when aligned and concatenated
- // (this is the eventual state of the code in its final CodeBlob)
- csize_t total_code_size() const;
+ // Allocated size in all sections, when aligned and concatenated
+ // (this is the eventual state of the content in its final
+ // CodeBlob).
+ csize_t total_content_size() const;
// combined offset (relative to start of insts) of given address,
// as eventually found in the final CodeBlob
diff --git a/src/share/vm/c1/c1_Compilation.cpp b/src/share/vm/c1/c1_Compilation.cpp
index d9156c1b3..38235a3b3 100644
--- a/src/share/vm/c1/c1_Compilation.cpp
+++ b/src/share/vm/c1/c1_Compilation.cpp
@@ -454,8 +454,7 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho
, _allocator(NULL)
, _next_id(0)
, _next_block_id(0)
-, _code(buffer_blob->instructions_begin(),
- buffer_blob->instructions_size())
+, _code(buffer_blob)
, _current_instruction(NULL)
#ifndef PRODUCT
, _last_instruction_printed(NULL)
diff --git a/src/share/vm/c1/c1_Runtime1.cpp b/src/share/vm/c1/c1_Runtime1.cpp
index 96d4e7135..5100c5ebb 100644
--- a/src/share/vm/c1/c1_Runtime1.cpp
+++ b/src/share/vm/c1/c1_Runtime1.cpp
@@ -118,8 +118,7 @@ void Runtime1::generate_blob_for(BufferBlob* buffer_blob, StubID id) {
assert(0 <= id && id < number_of_ids, "illegal stub id");
ResourceMark rm;
// create code buffer for code storage
- CodeBuffer code(buffer_blob->instructions_begin(),
- buffer_blob->instructions_size());
+ CodeBuffer code(buffer_blob);
Compilation::setup_code_buffer(&code, 0);
diff --git a/src/share/vm/c1/c1_Runtime1.hpp b/src/share/vm/c1/c1_Runtime1.hpp
index 1f31ebfbf..60bb8550a 100644
--- a/src/share/vm/c1/c1_Runtime1.hpp
+++ b/src/share/vm/c1/c1_Runtime1.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@ class Runtime1: public AllStatic {
// stubs
static CodeBlob* blob_for (StubID id);
- static address entry_for(StubID id) { return blob_for(id)->instructions_begin(); }
+ static address entry_for(StubID id) { return blob_for(id)->code_begin(); }
static const char* name_for (StubID id);
static const char* name_for_address(address entry);
diff --git a/src/share/vm/ci/ciMethod.cpp b/src/share/vm/ci/ciMethod.cpp
index 463c3b89d..9135ac6d6 100644
--- a/src/share/vm/ci/ciMethod.cpp
+++ b/src/share/vm/ci/ciMethod.cpp
@@ -922,12 +922,12 @@ bool ciMethod::has_compiled_code() {
// ------------------------------------------------------------------
// ciMethod::instructions_size
-// This is a rough metric for "fat" methods, compared
-// before inlining with InlineSmallCode.
-// The CodeBlob::instructions_size accessor includes
-// junk like exception handler, stubs, and constant table,
-// which are not highly relevant to an inlined method.
-// So we use the more specific accessor nmethod::code_size.
+//
+// This is a rough metric for "fat" methods, compared before inlining
+// with InlineSmallCode. The CodeBlob::code_size accessor includes
+// junk like exception handler, stubs, and constant table, which are
+// not highly relevant to an inlined method. So we use the more
+// specific accessor nmethod::insts_size.
int ciMethod::instructions_size() {
GUARDED_VM_ENTRY(
nmethod* code = get_methodOop()->code();
@@ -939,7 +939,7 @@ int ciMethod::instructions_size() {
(TieredCompilation && code->compiler() != NULL && code->compiler()->is_c1())) {
return 0;
}
- return code->code_end() - code->verified_entry_point();
+ return code->insts_end() - code->verified_entry_point();
)
}
diff --git a/src/share/vm/code/codeBlob.cpp b/src/share/vm/code/codeBlob.cpp
index d5e4525fc..fa98026c9 100644
--- a/src/share/vm/code/codeBlob.cpp
+++ b/src/share/vm/code/codeBlob.cpp
@@ -39,7 +39,7 @@ unsigned int CodeBlob::allocation_size(CodeBuffer* cb, int header_size) {
size += round_to(cb->total_relocation_size(), oopSize);
// align the size to CodeEntryAlignment
size = align_code_offset(size);
- size += round_to(cb->total_code_size(), oopSize);
+ size += round_to(cb->total_content_size(), oopSize);
size += round_to(cb->total_oop_size(), oopSize);
return size;
}
@@ -47,8 +47,8 @@ unsigned int CodeBlob::allocation_size(CodeBuffer* cb, int header_size) {
// Creates a simple CodeBlob. Sets up the size of the different regions.
CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) {
- assert(size == round_to(size, oopSize), "unaligned size");
- assert(locs_size == round_to(locs_size, oopSize), "unaligned size");
+ assert(size == round_to(size, oopSize), "unaligned size");
+ assert(locs_size == round_to(locs_size, oopSize), "unaligned size");
assert(header_size == round_to(header_size, oopSize), "unaligned size");
assert(!UseRelocIndex, "no space allocated for reloc index yet");
@@ -64,7 +64,8 @@ CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_comple
_frame_complete_offset = frame_complete;
_header_size = header_size;
_relocation_size = locs_size;
- _instructions_offset = align_code_offset(header_size + locs_size);
+ _content_offset = align_code_offset(header_size + _relocation_size);
+ _code_offset = _content_offset;
_data_offset = size;
_frame_size = 0;
set_oop_maps(NULL);
@@ -82,7 +83,7 @@ CodeBlob::CodeBlob(
int frame_size,
OopMapSet* oop_maps
) {
- assert(size == round_to(size, oopSize), "unaligned size");
+ assert(size == round_to(size, oopSize), "unaligned size");
assert(header_size == round_to(header_size, oopSize), "unaligned size");
_name = name;
@@ -90,8 +91,9 @@ CodeBlob::CodeBlob(
_frame_complete_offset = frame_complete;
_header_size = header_size;
_relocation_size = round_to(cb->total_relocation_size(), oopSize);
- _instructions_offset = align_code_offset(header_size + _relocation_size);
- _data_offset = _instructions_offset + round_to(cb->total_code_size(), oopSize);
+ _content_offset = align_code_offset(header_size + _relocation_size);
+ _code_offset = _content_offset + cb->total_offset_of(cb->insts()->start());
+ _data_offset = _content_offset + round_to(cb->total_content_size(), oopSize);
assert(_data_offset <= size, "codeBlob is too small");
cb->copy_code_and_locs_to(this);
@@ -127,9 +129,8 @@ void CodeBlob::flush() {
OopMap* CodeBlob::oop_map_for_return_address(address return_address) {
- address pc = return_address ;
- assert (oop_maps() != NULL, "nope");
- return oop_maps()->find_map_at_offset ((intptr_t) pc - (intptr_t) instructions_begin());
+ assert(oop_maps() != NULL, "nope");
+ return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());
}
@@ -284,12 +285,12 @@ RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name,
jio_snprintf(stub_id, sizeof(stub_id), "RuntimeStub - %s", stub_name);
if (PrintStubCode) {
tty->print_cr("Decoding %s " INTPTR_FORMAT, stub_id, stub);
- Disassembler::decode(stub->instructions_begin(), stub->instructions_end());
+ Disassembler::decode(stub->code_begin(), stub->code_end());
}
- Forte::register_stub(stub_id, stub->instructions_begin(), stub->instructions_end());
+ Forte::register_stub(stub_id, stub->code_begin(), stub->code_end());
if (JvmtiExport::should_post_dynamic_code_generated()) {
- JvmtiExport::post_dynamic_code_generated(stub_name, stub->instructions_begin(), stub->instructions_end());
+ JvmtiExport::post_dynamic_code_generated(stub_name, stub->code_begin(), stub->code_end());
}
}
@@ -355,17 +356,15 @@ DeoptimizationBlob* DeoptimizationBlob::create(
// Do not hold the CodeCache lock during name formatting.
if (blob != NULL) {
char blob_id[256];
- jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->instructions_begin());
+ jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->code_begin());
if (PrintStubCode) {
tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
- Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+ Disassembler::decode(blob->code_begin(), blob->code_end());
}
- Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+ Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
if (JvmtiExport::should_post_dynamic_code_generated()) {
- JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob",
- blob->instructions_begin(),
- blob->instructions_end());
+ JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob", blob->code_begin(), blob->code_end());
}
}
@@ -412,17 +411,15 @@ UncommonTrapBlob* UncommonTrapBlob::create(
// Do not hold the CodeCache lock during name formatting.
if (blob != NULL) {
char blob_id[256];
- jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->instructions_begin());
+ jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->code_begin());
if (PrintStubCode) {
tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
- Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+ Disassembler::decode(blob->code_begin(), blob->code_end());
}
- Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+ Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
if (JvmtiExport::should_post_dynamic_code_generated()) {
- JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob",
- blob->instructions_begin(),
- blob->instructions_end());
+ JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob", blob->code_begin(), blob->code_end());
}
}
@@ -471,17 +468,15 @@ ExceptionBlob* ExceptionBlob::create(
// We do not need to hold the CodeCache lock during name formatting
if (blob != NULL) {
char blob_id[256];
- jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->instructions_begin());
+ jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->code_begin());
if (PrintStubCode) {
tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
- Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+ Disassembler::decode(blob->code_begin(), blob->code_end());
}
- Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+ Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
if (JvmtiExport::should_post_dynamic_code_generated()) {
- JvmtiExport::post_dynamic_code_generated("ExceptionBlob",
- blob->instructions_begin(),
- blob->instructions_end());
+ JvmtiExport::post_dynamic_code_generated("ExceptionBlob", blob->code_begin(), blob->code_end());
}
}
@@ -529,17 +524,15 @@ SafepointBlob* SafepointBlob::create(
// We do not need to hold the CodeCache lock during name formatting.
if (blob != NULL) {
char blob_id[256];
- jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->instructions_begin());
+ jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->code_begin());
if (PrintStubCode) {
tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
- Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+ Disassembler::decode(blob->code_begin(), blob->code_end());
}
- Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+ Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
if (JvmtiExport::should_post_dynamic_code_generated()) {
- JvmtiExport::post_dynamic_code_generated("SafepointBlob",
- blob->instructions_begin(),
- blob->instructions_end());
+ JvmtiExport::post_dynamic_code_generated("SafepointBlob", blob->code_begin(), blob->code_end());
}
}
diff --git a/src/share/vm/code/codeBlob.hpp b/src/share/vm/code/codeBlob.hpp
index 28cd68aa6..9b08c3dc8 100644
--- a/src/share/vm/code/codeBlob.hpp
+++ b/src/share/vm/code/codeBlob.hpp
@@ -35,7 +35,8 @@
// Layout:
// - header
// - relocation
-// - instruction space
+// - content space
+// - instruction space
// - data space
class DeoptimizationBlob;
@@ -48,7 +49,8 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
int _size; // total size of CodeBlob in bytes
int _header_size; // size of header (depends on subclass)
int _relocation_size; // size of relocation
- int _instructions_offset; // offset to where instructions region begins
+ int _content_offset; // offset to where content region begins (this includes consts, insts, stubs)
+ int _code_offset; // offset to where instructions region begins (this includes insts, stubs)
int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have
// not finished setting up their frame. Beware of pc's in
// that range. There is a similar range(s) on returns
@@ -106,31 +108,36 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
address header_end() const { return ((address) this) + _header_size; };
relocInfo* relocation_begin() const { return (relocInfo*) header_end(); };
relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); }
- address instructions_begin() const { return (address) header_begin() + _instructions_offset; }
- address instructions_end() const { return (address) header_begin() + _data_offset; }
+ address content_begin() const { return (address) header_begin() + _content_offset; }
+ address content_end() const { return (address) header_begin() + _data_offset; }
+ address code_begin() const { return (address) header_begin() + _code_offset; }
+ address code_end() const { return (address) header_begin() + _data_offset; }
address data_begin() const { return (address) header_begin() + _data_offset; }
address data_end() const { return (address) header_begin() + _size; }
// Offsets
int relocation_offset() const { return _header_size; }
- int instructions_offset() const { return _instructions_offset; }
+ int content_offset() const { return _content_offset; }
+ int code_offset() const { return _code_offset; }
int data_offset() const { return _data_offset; }
// Sizes
int size() const { return _size; }
int header_size() const { return _header_size; }
int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); }
- int instructions_size() const { return instructions_end() - instructions_begin(); }
- int data_size() const { return data_end() - data_begin(); }
+ int content_size() const { return content_end() - content_begin(); }
+ int code_size() const { return code_end() - code_begin(); }
+ int data_size() const { return data_end() - data_begin(); }
// Containment
- bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); }
+ bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); }
bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); }
- bool instructions_contains(address addr) const { return instructions_begin() <= addr && addr < instructions_end(); }
- bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); }
- bool contains(address addr) const { return instructions_contains(addr); }
- bool is_frame_complete_at(address addr) const { return instructions_contains(addr) &&
- addr >= instructions_begin() + _frame_complete_offset; }
+ bool content_contains(address addr) const { return content_begin() <= addr && addr < content_end(); }
+ bool code_contains(address addr) const { return code_begin() <= addr && addr < code_end(); }
+ bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); }
+ bool contains(address addr) const { return content_contains(addr); }
+ bool is_frame_complete_at(address addr) const { return code_contains(addr) &&
+ addr >= code_begin() + _frame_complete_offset; }
// CodeCache support: really only used by the nmethods, but in order to get
// asserts and certain bookkeeping to work in the CodeCache they are defined
@@ -169,7 +176,7 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
// Print the comment associated with offset on stream, if there is one
virtual void print_block_comment(outputStream* stream, address block_begin) {
- intptr_t offset = (intptr_t)(block_begin - instructions_begin());
+ intptr_t offset = (intptr_t)(block_begin - code_begin());
_comments.print_block_comment(stream, offset);
}
@@ -286,7 +293,7 @@ class RuntimeStub: public CodeBlob {
// GC support
bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; }
- address entry_point() { return instructions_begin(); }
+ address entry_point() { return code_begin(); }
// GC/Verification support
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ }
@@ -313,13 +320,15 @@ class SingletonBlob: public CodeBlob {
OopMapSet* oop_maps
)
: CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps)
- {};
+ {};
- bool is_alive() const { return true; }
+ address entry_point() { return code_begin(); }
- void verify(); // does nothing
- void print_on(outputStream* st) const;
- void print_value_on(outputStream* st) const;
+ bool is_alive() const { return true; }
+
+ void verify(); // does nothing
+ void print_on(outputStream* st) const;
+ void print_value_on(outputStream* st) const;
};
@@ -376,9 +385,9 @@ class DeoptimizationBlob: public SingletonBlob {
// Printing
void print_value_on(outputStream* st) const;
- address unpack() const { return instructions_begin() + _unpack_offset; }
- address unpack_with_exception() const { return instructions_begin() + _unpack_with_exception; }
- address unpack_with_reexecution() const { return instructions_begin() + _unpack_with_reexecution; }
+ address unpack() const { return code_begin() + _unpack_offset; }
+ address unpack_with_exception() const { return code_begin() + _unpack_with_exception; }
+ address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; }
// Alternate entry point for C1 where the exception and issuing pc
// are in JavaThread::_exception_oop and JavaThread::_exception_pc
@@ -387,9 +396,9 @@ class DeoptimizationBlob: public SingletonBlob {
// there may be live values in those registers during deopt.
void set_unpack_with_exception_in_tls_offset(int offset) {
_unpack_with_exception_in_tls = offset;
- assert(contains(instructions_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob");
+ assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob");
}
- address unpack_with_exception_in_tls() const { return instructions_begin() + _unpack_with_exception_in_tls; }
+ address unpack_with_exception_in_tls() const { return code_begin() + _unpack_with_exception_in_tls; }
};
diff --git a/src/share/vm/code/codeCache.cpp b/src/share/vm/code/codeCache.cpp
index 485aff812..b02f142cc 100644
--- a/src/share/vm/code/codeCache.cpp
+++ b/src/share/vm/code/codeCache.cpp
@@ -76,14 +76,14 @@ class CodeBlob_sizes {
relocation_size += cb->relocation_size();
if (cb->is_nmethod()) {
nmethod* nm = cb->as_nmethod_or_null();
- code_size += nm->code_size();
+ code_size += nm->insts_size();
stub_size += nm->stub_size();
scopes_oop_size += nm->oops_size();
scopes_data_size += nm->scopes_data_size();
scopes_pcs_size += nm->scopes_pcs_size();
} else {
- code_size += cb->instructions_size();
+ code_size += cb->code_size();
}
}
};
@@ -210,7 +210,7 @@ void CodeCache::commit(CodeBlob* cb) {
}
// flush the hardware I-cache
- ICache::invalidate_range(cb->instructions_begin(), cb->instructions_size());
+ ICache::invalidate_range(cb->content_begin(), cb->content_size());
}
@@ -804,8 +804,8 @@ void CodeCache::print_internals() {
if(nm->method() != NULL && nm->is_java_method()) {
nmethodJava++;
- if(nm->code_size() > maxCodeSize) {
- maxCodeSize = nm->code_size();
+ if (nm->insts_size() > maxCodeSize) {
+ maxCodeSize = nm->insts_size();
}
}
} else if (cb->is_runtime_stub()) {
@@ -830,7 +830,7 @@ void CodeCache::print_internals() {
if (cb->is_nmethod()) {
nmethod* nm = (nmethod*)cb;
if(nm->is_java_method()) {
- buckets[nm->code_size() / bucketSize]++;
+ buckets[nm->insts_size() / bucketSize]++;
}
}
}
@@ -896,11 +896,11 @@ void CodeCache::print() {
FOR_ALL_BLOBS(p) {
if (p->is_alive()) {
number_of_blobs++;
- code_size += p->instructions_size();
+ code_size += p->code_size();
OopMapSet* set = p->oop_maps();
if (set != NULL) {
number_of_oop_maps += set->size();
- map_size += set->heap_size();
+ map_size += set->heap_size();
}
}
}
diff --git a/src/share/vm/code/exceptionHandlerTable.cpp b/src/share/vm/code/exceptionHandlerTable.cpp
index 8ad6592b4..12cc9cdf7 100644
--- a/src/share/vm/code/exceptionHandlerTable.cpp
+++ b/src/share/vm/code/exceptionHandlerTable.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -219,8 +219,8 @@ void ImplicitExceptionTable::copy_to( nmethod* nm ) {
void ImplicitExceptionTable::verify(nmethod *nm) const {
for (uint i = 0; i < len(); i++) {
- if ((*adr(i) > (unsigned int)nm->code_size()) ||
- (*(adr(i)+1) > (unsigned int)nm->code_size()))
+ if ((*adr(i) > (unsigned int)nm->insts_size()) ||
+ (*(adr(i)+1) > (unsigned int)nm->insts_size()))
fatal(err_msg("Invalid offset in ImplicitExceptionTable at " PTR_FORMAT, _data));
}
}
diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp
index 1b6472a3c..0526f4355 100644
--- a/src/share/vm/code/nmethod.cpp
+++ b/src/share/vm/code/nmethod.cpp
@@ -87,7 +87,7 @@ struct nmethod_stats_struct {
int nmethod_count;
int total_size;
int relocation_size;
- int code_size;
+ int insts_size;
int stub_size;
int consts_size;
int scopes_data_size;
@@ -101,7 +101,7 @@ struct nmethod_stats_struct {
nmethod_count += 1;
total_size += nm->size();
relocation_size += nm->relocation_size();
- code_size += nm->code_size();
+ insts_size += nm->insts_size();
stub_size += nm->stub_size();
consts_size += nm->consts_size();
oops_size += nm->oops_size();
@@ -116,7 +116,7 @@ struct nmethod_stats_struct {
tty->print_cr("Statistics for %d bytecoded nmethods:", nmethod_count);
if (total_size != 0) tty->print_cr(" total in heap = %d", total_size);
if (relocation_size != 0) tty->print_cr(" relocation = %d", relocation_size);
- if (code_size != 0) tty->print_cr(" main code = %d", code_size);
+ if (insts_size != 0) tty->print_cr(" main code = %d", insts_size);
if (stub_size != 0) tty->print_cr(" stub code = %d", stub_size);
if (consts_size != 0) tty->print_cr(" constants = %d", consts_size);
if (oops_size != 0) tty->print_cr(" oops = %d", oops_size);
@@ -130,13 +130,13 @@ struct nmethod_stats_struct {
int native_nmethod_count;
int native_total_size;
int native_relocation_size;
- int native_code_size;
+ int native_insts_size;
int native_oops_size;
void note_native_nmethod(nmethod* nm) {
native_nmethod_count += 1;
native_total_size += nm->size();
native_relocation_size += nm->relocation_size();
- native_code_size += nm->code_size();
+ native_insts_size += nm->insts_size();
native_oops_size += nm->oops_size();
}
void print_native_nmethod_stats() {
@@ -144,7 +144,7 @@ struct nmethod_stats_struct {
tty->print_cr("Statistics for %d native nmethods:", native_nmethod_count);
if (native_total_size != 0) tty->print_cr(" N. total size = %d", native_total_size);
if (native_relocation_size != 0) tty->print_cr(" N. relocation = %d", native_relocation_size);
- if (native_code_size != 0) tty->print_cr(" N. main code = %d", native_code_size);
+ if (native_insts_size != 0) tty->print_cr(" N. main code = %d", native_insts_size);
if (native_oops_size != 0) tty->print_cr(" N. oops = %d", native_oops_size);
}
@@ -404,7 +404,7 @@ void nmethod::add_handler_for_exception_and_pc(Handle exception, address pc, add
int nmethod::total_size() const {
return
- code_size() +
+ insts_size() +
stub_size() +
consts_size() +
scopes_data_size() +
@@ -618,8 +618,8 @@ nmethod::nmethod(
_deoptimize_mh_offset = 0;
_orig_pc_offset = 0;
- _stub_offset = data_offset();
_consts_offset = data_offset();
+ _stub_offset = data_offset();
_oops_offset = data_offset();
_scopes_data_offset = _oops_offset + round_to(code_buffer->total_oop_size(), oopSize);
_scopes_pcs_offset = _scopes_data_offset;
@@ -629,8 +629,8 @@ nmethod::nmethod(
_nmethod_end_offset = _nul_chk_table_offset;
_compile_id = 0; // default
_comp_level = CompLevel_none;
- _entry_point = instructions_begin();
- _verified_entry_point = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
+ _entry_point = code_begin() + offsets->value(CodeOffsets::Entry);
+ _verified_entry_point = code_begin() + offsets->value(CodeOffsets::Verified_Entry);
_osr_entry_point = NULL;
_exception_cache = NULL;
_pc_desc_cache.reset_to(NULL);
@@ -696,8 +696,8 @@ nmethod::nmethod(
_unwind_handler_offset = -1;
_trap_offset = offsets->value(CodeOffsets::Dtrace_trap);
_orig_pc_offset = 0;
- _stub_offset = data_offset();
_consts_offset = data_offset();
+ _stub_offset = data_offset();
_oops_offset = data_offset();
_scopes_data_offset = _oops_offset + round_to(code_buffer->total_oop_size(), oopSize);
_scopes_pcs_offset = _scopes_data_offset;
@@ -707,8 +707,8 @@ nmethod::nmethod(
_nmethod_end_offset = _nul_chk_table_offset;
_compile_id = 0; // default
_comp_level = CompLevel_none;
- _entry_point = instructions_begin();
- _verified_entry_point = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
+ _entry_point = code_begin() + offsets->value(CodeOffsets::Entry);
+ _verified_entry_point = code_begin() + offsets->value(CodeOffsets::Verified_Entry);
_osr_entry_point = NULL;
_exception_cache = NULL;
_pc_desc_cache.reset_to(NULL);
@@ -787,18 +787,21 @@ nmethod::nmethod(
_comp_level = comp_level;
_compiler = compiler;
_orig_pc_offset = orig_pc_offset;
- _stub_offset = instructions_offset() + code_buffer->total_offset_of(code_buffer->stubs()->start());
+
+ // Section offsets
+ _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts()->start());
+ _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs()->start());
// Exception handler and deopt handler are in the stub section
- _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions);
- _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt);
- _deoptimize_mh_offset = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
+ _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions);
+ _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt);
+ _deoptimize_mh_offset = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
if (offsets->value(CodeOffsets::UnwindHandler) != -1) {
- _unwind_handler_offset = instructions_offset() + offsets->value(CodeOffsets::UnwindHandler);
+ _unwind_handler_offset = code_offset() + offsets->value(CodeOffsets::UnwindHandler);
} else {
- _unwind_handler_offset = -1;
+ _unwind_handler_offset = -1;
}
- _consts_offset = instructions_offset() + code_buffer->total_offset_of(code_buffer->consts()->start());
+
_oops_offset = data_offset();
_scopes_data_offset = _oops_offset + round_to(code_buffer->total_oop_size (), oopSize);
_scopes_pcs_offset = _scopes_data_offset + round_to(debug_info->data_size (), oopSize);
@@ -807,9 +810,9 @@ nmethod::nmethod(
_nul_chk_table_offset = _handler_table_offset + round_to(handler_table->size_in_bytes(), oopSize);
_nmethod_end_offset = _nul_chk_table_offset + round_to(nul_chk_table->size_in_bytes(), oopSize);
- _entry_point = instructions_begin();
- _verified_entry_point = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
- _osr_entry_point = instructions_begin() + offsets->value(CodeOffsets::OSR_Entry);
+ _entry_point = code_begin() + offsets->value(CodeOffsets::Entry);
+ _verified_entry_point = code_begin() + offsets->value(CodeOffsets::Verified_Entry);
+ _osr_entry_point = code_begin() + offsets->value(CodeOffsets::OSR_Entry);
_exception_cache = NULL;
_pc_desc_cache.reset_to(scopes_pcs_begin());
@@ -878,12 +881,11 @@ void nmethod::log_new_nmethod() const {
HandleMark hm;
xtty->begin_elem("nmethod");
log_identity(xtty);
- xtty->print(" entry='" INTPTR_FORMAT "' size='%d'",
- instructions_begin(), size());
+ xtty->print(" entry='" INTPTR_FORMAT "' size='%d'", code_begin(), size());
xtty->print(" address='" INTPTR_FORMAT "'", (intptr_t) this);
LOG_OFFSET(xtty, relocation);
- LOG_OFFSET(xtty, code);
+ LOG_OFFSET(xtty, insts);
LOG_OFFSET(xtty, stub);
LOG_OFFSET(xtty, consts);
LOG_OFFSET(xtty, scopes_data);
@@ -1460,7 +1462,7 @@ void nmethod::post_compiled_method_load_event() {
moop->name()->utf8_length(),
moop->signature()->bytes(),
moop->signature()->utf8_length(),
- code_begin(), code_size());
+ insts_begin(), insts_size());
if (JvmtiExport::should_post_compiled_method_load() ||
JvmtiExport::should_post_compiled_method_unload()) {
@@ -1502,7 +1504,7 @@ void nmethod::post_compiled_method_unload() {
if (_jmethod_id != NULL && JvmtiExport::should_post_compiled_method_unload()) {
assert(!unload_reported(), "already unloaded");
HandleMark hm;
- JvmtiExport::post_compiled_method_unload(_jmethod_id, code_begin());
+ JvmtiExport::post_compiled_method_unload(_jmethod_id, insts_begin());
}
// The JVMTI CompiledMethodUnload event can be enabled or disabled at
@@ -1854,7 +1856,7 @@ void nmethod::copy_scopes_pcs(PcDesc* pcs, int count) {
// Adjust the final sentinel downward.
PcDesc* last_pc = &scopes_pcs_begin()[count-1];
assert(last_pc->pc_offset() == PcDesc::upper_offset_limit, "sanity");
- last_pc->set_pc_offset(instructions_size() + 1);
+ last_pc->set_pc_offset(content_size() + 1);
for (; last_pc + 1 < scopes_pcs_end(); last_pc += 1) {
// Fill any rounding gaps with copies of the last record.
last_pc[1] = last_pc[0];
@@ -1894,7 +1896,7 @@ static PcDesc* linear_search(nmethod* nm, int pc_offset, bool approximate) {
// Finds a PcDesc with real-pc equal to "pc"
PcDesc* nmethod::find_pc_desc_internal(address pc, bool approximate) {
- address base_address = instructions_begin();
+ address base_address = code_begin();
if ((pc < base_address) ||
(pc - base_address) >= (ptrdiff_t) PcDesc::upper_offset_limit) {
return NULL; // PC is wildly out of range
@@ -2042,7 +2044,7 @@ bool nmethod::is_dependent_on_method(methodOop dependee) {
bool nmethod::is_patchable_at(address instr_addr) {
- assert (code_contains(instr_addr), "wrong nmethod used");
+ assert(insts_contains(instr_addr), "wrong nmethod used");
if (is_zombie()) {
// a zombie may never be patched
return false;
@@ -2054,7 +2056,7 @@ bool nmethod::is_patchable_at(address instr_addr) {
address nmethod::continuation_for_implicit_exception(address pc) {
// Exception happened outside inline-cache check code => we are inside
// an active nmethod => use cpc to determine a return address
- int exception_offset = pc - instructions_begin();
+ int exception_offset = pc - code_begin();
int cont_offset = ImplicitExceptionTable(this).at( exception_offset );
#ifdef ASSERT
if (cont_offset == 0) {
@@ -2075,7 +2077,7 @@ address nmethod::continuation_for_implicit_exception(address pc) {
// Let the normal error handling report the exception
return NULL;
}
- return instructions_begin() + cont_offset;
+ return code_begin() + cont_offset;
}
@@ -2334,10 +2336,10 @@ void nmethod::print() const {
relocation_begin(),
relocation_end(),
relocation_size());
- if (code_size () > 0) tty->print_cr(" main code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
- code_begin(),
- code_end(),
- code_size());
+ if (insts_size () > 0) tty->print_cr(" main code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
+ insts_begin(),
+ insts_end(),
+ insts_size());
if (stub_size () > 0) tty->print_cr(" stub code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
stub_begin(),
stub_end(),
@@ -2607,7 +2609,7 @@ void nmethod::print_code_comment_on(outputStream* st, int column, u_char* begin,
// First, find an oopmap in (begin, end].
// We use the odd half-closed interval so that oop maps and scope descs
// which are tied to the byte after a call are printed with the call itself.
- address base = instructions_begin();
+ address base = code_begin();
OopMapSet* oms = oop_maps();
if (oms != NULL) {
for (int i = 0, imax = oms->size(); i < imax; i++) {
@@ -2695,10 +2697,10 @@ void nmethod::print_code_comment_on(outputStream* st, int column, u_char* begin,
st->move_to(column);
st->print("; {%s}", str);
}
- int cont_offset = ImplicitExceptionTable(this).at(begin - instructions_begin());
+ int cont_offset = ImplicitExceptionTable(this).at(begin - code_begin());
if (cont_offset != 0) {
st->move_to(column);
- st->print("; implicit exception: dispatches to " INTPTR_FORMAT, instructions_begin() + cont_offset);
+ st->print("; implicit exception: dispatches to " INTPTR_FORMAT, code_begin() + cont_offset);
}
}
@@ -2732,7 +2734,7 @@ void nmethod::print_handler_table() {
}
void nmethod::print_nul_chk_table() {
- ImplicitExceptionTable(this).print(instructions_begin());
+ ImplicitExceptionTable(this).print(code_begin());
}
void nmethod::print_statistics() {
diff --git a/src/share/vm/code/nmethod.hpp b/src/share/vm/code/nmethod.hpp
index 88fe784cf..ff37f96b8 100644
--- a/src/share/vm/code/nmethod.hpp
+++ b/src/share/vm/code/nmethod.hpp
@@ -312,7 +312,7 @@ class nmethod : public CodeBlob {
int frame_size);
int trap_offset() const { return _trap_offset; }
- address trap_address() const { return code_begin() + _trap_offset; }
+ address trap_address() const { return insts_begin() + _trap_offset; }
#endif // def HAVE_DTRACE_H
@@ -336,8 +336,8 @@ class nmethod : public CodeBlob {
bool is_compiled_by_shark() const;
// boundaries for different parts
- address code_begin () const { return _entry_point; }
- address code_end () const { return header_begin() + _stub_offset ; }
+ address insts_begin () const { return code_begin(); }
+ address insts_end () const { return header_begin() + _stub_offset ; }
address exception_begin () const { return header_begin() + _exception_offset ; }
address deopt_handler_begin () const { return header_begin() + _deoptimize_offset ; }
address deopt_mh_handler_begin() const { return header_begin() + _deoptimize_mh_offset ; }
@@ -361,7 +361,7 @@ class nmethod : public CodeBlob {
address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; }
// Sizes
- int code_size () const { return code_end () - code_begin (); }
+ int insts_size () const { return insts_end () - insts_begin (); }
int stub_size () const { return stub_end () - stub_begin (); }
int consts_size () const { return consts_end () - consts_begin (); }
int oops_size () const { return (address) oops_end () - (address) oops_begin (); }
@@ -374,7 +374,7 @@ class nmethod : public CodeBlob {
int total_size () const;
// Containment
- bool code_contains (address addr) const { return code_begin () <= addr && addr < code_end (); }
+ bool insts_contains (address addr) const { return insts_begin () <= addr && addr < insts_end (); }
bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); }
bool consts_contains (address addr) const { return consts_begin () <= addr && addr < consts_end (); }
bool oops_contains (oop* addr) const { return oops_begin () <= addr && addr < oops_end (); }
@@ -506,7 +506,7 @@ public:
void clear_inline_caches();
void cleanup_inline_caches();
bool inlinecache_check_contains(address addr) const {
- return (addr >= instructions_begin() && addr < verified_entry_point());
+ return (addr >= code_begin() && addr < verified_entry_point());
}
// unlink and deallocate this nmethod
@@ -559,7 +559,7 @@ public:
PcDesc* find_pc_desc(address pc, bool approximate) {
PcDesc* desc = _pc_desc_cache.last_pc_desc();
- if (desc != NULL && desc->pc_offset() == pc - instructions_begin()) {
+ if (desc != NULL && desc->pc_offset() == pc - code_begin()) {
return desc;
}
return find_pc_desc_internal(pc, approximate);
diff --git a/src/share/vm/code/pcDesc.cpp b/src/share/vm/code/pcDesc.cpp
index 9e063fb16..b8a9eb475 100644
--- a/src/share/vm/code/pcDesc.cpp
+++ b/src/share/vm/code/pcDesc.cpp
@@ -34,7 +34,7 @@ PcDesc::PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset) {
}
address PcDesc::real_pc(const nmethod* code) const {
- return code->instructions_begin() + pc_offset();
+ return code->code_begin() + pc_offset();
}
void PcDesc::print(nmethod* code) {
diff --git a/src/share/vm/code/relocInfo.cpp b/src/share/vm/code/relocInfo.cpp
index 6afb3c54d..7df9e47e0 100644
--- a/src/share/vm/code/relocInfo.cpp
+++ b/src/share/vm/code/relocInfo.cpp
@@ -128,13 +128,11 @@ void RelocIterator::initialize(nmethod* nm, address begin, address limit) {
_code = nm;
_current = nm->relocation_begin() - 1;
_end = nm->relocation_end();
- _addr = (address) nm->instructions_begin();
+ _addr = (address) nm->code_begin();
assert(!has_current(), "just checking");
- address code_end = nm->instructions_end();
-
- assert(begin == NULL || begin >= nm->instructions_begin(), "in bounds");
- // FIX THIS assert(limit == NULL || limit <= code_end, "in bounds");
+ assert(begin == NULL || begin >= nm->code_begin(), "in bounds");
+ assert(limit == NULL || limit <= nm->code_end(), "in bounds");
set_limits(begin, limit);
}
@@ -267,7 +265,7 @@ void RelocIterator::set_limits(address begin, address limit) {
// skip ahead
RelocIndexEntry* index = (RelocIndexEntry*)_end;
RelocIndexEntry* index_limit = (RelocIndexEntry*)((address)index + index_size);
- assert(_addr == _code->instructions_begin(), "_addr must be unadjusted");
+ assert(_addr == _code->code_begin(), "_addr must be unadjusted");
int card = (begin - _addr) / indexCardSize;
if (card > 0) {
if (index+card-1 < index_limit) index += card-1;
@@ -369,7 +367,7 @@ address RelocIterator::compute_section_start(int n) const {
CodeBlob* cb = code();
guarantee(cb != NULL, "must have a code blob");
if (n == CodeBuffer::SECT_INSTS)
- return CACHE = cb->instructions_begin();
+ return CACHE = cb->code_begin();
assert(cb->is_nmethod(), "only nmethods have these sections");
nmethod* nm = (nmethod*) cb;
address res = NULL;
@@ -383,7 +381,7 @@ address RelocIterator::compute_section_start(int n) const {
default:
ShouldNotReachHere();
}
- assert(nm->contains(res) || res == nm->instructions_end(), "tame pointer");
+ assert(nm->contains(res) || res == nm->code_end(), "tame pointer");
CACHE = res;
return res;
#undef CACHE
diff --git a/src/share/vm/code/scopeDesc.cpp b/src/share/vm/code/scopeDesc.cpp
index 2e1e19e69..9eb1e888e 100644
--- a/src/share/vm/code/scopeDesc.cpp
+++ b/src/share/vm/code/scopeDesc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -174,7 +174,7 @@ void ScopeDesc::print_on(outputStream* st, PcDesc* pd) const {
print_value_on(st);
// decode offsets
if (WizardMode) {
- st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, _code->instructions_begin());
+ st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, _code->content_begin());
st->print_cr(" offset: %d", _decode_offset);
st->print_cr(" bci: %d", bci());
st->print_cr(" reexecute: %s", should_reexecute() ? "true" : "false");
diff --git a/src/share/vm/code/stubs.cpp b/src/share/vm/code/stubs.cpp
index e8b492731..7272f4673 100644
--- a/src/share/vm/code/stubs.cpp
+++ b/src/share/vm/code/stubs.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,9 +66,9 @@ StubQueue::StubQueue(StubInterface* stub_interface, int buffer_size,
vm_exit_out_of_memory(size, err_msg("CodeCache: no room for %s", name));
}
_stub_interface = stub_interface;
- _buffer_size = blob->instructions_size();
- _buffer_limit = blob->instructions_size();
- _stub_buffer = blob->instructions_begin();
+ _buffer_size = blob->content_size();
+ _buffer_limit = blob->content_size();
+ _stub_buffer = blob->content_begin();
_queue_begin = 0;
_queue_end = 0;
_number_of_stubs = 0;
diff --git a/src/share/vm/code/vtableStubs.cpp b/src/share/vm/code/vtableStubs.cpp
index 028cfe838..e85a8732f 100644
--- a/src/share/vm/code/vtableStubs.cpp
+++ b/src/share/vm/code/vtableStubs.cpp
@@ -48,7 +48,7 @@ void* VtableStub::operator new(size_t size, int code_size) {
if (blob == NULL) {
vm_exit_out_of_memory(bytes, "CodeCache: no room for vtable chunks");
}
- _chunk = blob->instructions_begin();
+ _chunk = blob->content_begin();
_chunk_end = _chunk + bytes;
Forte::register_stub("vtable stub", _chunk, _chunk_end);
// Notify JVMTI about this stub. The event will be recorded by the enclosing
diff --git a/src/share/vm/compiler/compileBroker.cpp b/src/share/vm/compiler/compileBroker.cpp
index 478d3f47b..911ab0675 100644
--- a/src/share/vm/compiler/compileBroker.cpp
+++ b/src/share/vm/compiler/compileBroker.cpp
@@ -399,7 +399,7 @@ void CompileTask::log_task_done(CompileLog* log) {
// <task_done ... stamp='1.234'> </task>
nmethod* nm = code();
log->begin_elem("task_done success='%d' nmsize='%d' count='%d'",
- _is_success, nm == NULL ? 0 : nm->instructions_size(),
+ _is_success, nm == NULL ? 0 : nm->content_size(),
method->invocation_count());
int bec = method->backedge_count();
if (bec != 0) log->print(" backedge_count='%d'", bec);
@@ -1847,13 +1847,13 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
}
// Collect counts of successful compilations
- _sum_nmethod_size += code->total_size();
- _sum_nmethod_code_size += code->code_size();
+ _sum_nmethod_size += code->total_size();
+ _sum_nmethod_code_size += code->insts_size();
_total_compile_count++;
if (UsePerfData) {
- _perf_sum_nmethod_size->inc(code->total_size());
- _perf_sum_nmethod_code_size->inc(code->code_size());
+ _perf_sum_nmethod_size->inc( code->total_size());
+ _perf_sum_nmethod_code_size->inc(code->insts_size());
_perf_total_compile_count->inc();
}
diff --git a/src/share/vm/compiler/disassembler.cpp b/src/share/vm/compiler/disassembler.cpp
index 8176a8164..175d874da 100644
--- a/src/share/vm/compiler/disassembler.cpp
+++ b/src/share/vm/compiler/disassembler.cpp
@@ -407,7 +407,7 @@ void Disassembler::decode(CodeBlob* cb, outputStream* st) {
if (!load_library()) return;
decode_env env(cb, st);
env.output()->print_cr("Decoding CodeBlob " INTPTR_FORMAT, cb);
- env.decode_instructions(cb->instructions_begin(), cb->instructions_end());
+ env.decode_instructions(cb->code_begin(), cb->code_end());
}
@@ -424,12 +424,12 @@ void Disassembler::decode(nmethod* nm, outputStream* st) {
env.output()->print_cr("Code:");
#ifdef SHARK
- SharkEntry* entry = (SharkEntry *) nm->instructions_begin();
- unsigned char* p = entry->code_start();
+ SharkEntry* entry = (SharkEntry *) nm->code_begin();
+ unsigned char* p = entry->code_start();
unsigned char* end = entry->code_limit();
#else
- unsigned char* p = nm->instructions_begin();
- unsigned char* end = nm->instructions_end();
+ unsigned char* p = nm->code_begin();
+ unsigned char* end = nm->code_end();
#endif // SHARK
// If there has been profiling, print the buckets.
diff --git a/src/share/vm/interpreter/interpreter.hpp b/src/share/vm/interpreter/interpreter.hpp
index e8da2ce31..606bbdfca 100644
--- a/src/share/vm/interpreter/interpreter.hpp
+++ b/src/share/vm/interpreter/interpreter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@ class CodeletMark: ResourceMark {
// commit Codelet
- AbstractInterpreter::code()->commit((*_masm)->code()->pure_code_size());
+ AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size());
// make sure nobody can use _masm outside a CodeletMark lifespan
*_masm = NULL;
}
diff --git a/src/share/vm/interpreter/interpreterRuntime.cpp b/src/share/vm/interpreter/interpreterRuntime.cpp
index c156bbb37..f0944896a 100644
--- a/src/share/vm/interpreter/interpreterRuntime.cpp
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp
@@ -1124,7 +1124,7 @@ address SignatureHandlerLibrary::set_handler_blob() {
if (handler_blob == NULL) {
return NULL;
}
- address handler = handler_blob->instructions_begin();
+ address handler = handler_blob->code_begin();
_handler_blob = handler_blob;
_handler = handler;
return handler;
@@ -1140,7 +1140,7 @@ void SignatureHandlerLibrary::initialize() {
BufferBlob* bb = BufferBlob::create("Signature Handler Temp Buffer",
SignatureHandlerLibrary::buffer_size);
- _buffer = bb->instructions_begin();
+ _buffer = bb->code_begin();
_fingerprints = new(ResourceObj::C_HEAP)GrowableArray<uint64_t>(32, true);
_handlers = new(ResourceObj::C_HEAP)GrowableArray<address>(32, true);
@@ -1148,16 +1148,16 @@ void SignatureHandlerLibrary::initialize() {
address SignatureHandlerLibrary::set_handler(CodeBuffer* buffer) {
address handler = _handler;
- int code_size = buffer->pure_code_size();
- if (handler + code_size > _handler_blob->instructions_end()) {
+ int insts_size = buffer->pure_insts_size();
+ if (handler + insts_size > _handler_blob->code_end()) {
// get a new handler blob
handler = set_handler_blob();
}
if (handler != NULL) {
- memcpy(handler, buffer->code_begin(), code_size);
+ memcpy(handler, buffer->insts_begin(), insts_size);
pd_set_handler(handler);
- ICache::invalidate_range(handler, code_size);
- _handler = handler + code_size;
+ ICache::invalidate_range(handler, insts_size);
+ _handler = handler + insts_size;
}
return handler;
}
@@ -1196,8 +1196,8 @@ void SignatureHandlerLibrary::add(methodHandle method) {
(method->is_static() ? "static" : "receiver"),
method->name_and_sig_as_C_string(),
fingerprint,
- buffer.code_size());
- Disassembler::decode(handler, handler + buffer.code_size());
+ buffer.insts_size());
+ Disassembler::decode(handler, handler + buffer.insts_size());
#ifndef PRODUCT
tty->print_cr(" --- associated result handler ---");
address rh_begin = Interpreter::result_handler(method()->result_type());
diff --git a/src/share/vm/opto/compile.cpp b/src/share/vm/opto/compile.cpp
index e5d3c4fdd..b1f6bf56a 100644
--- a/src/share/vm/opto/compile.cpp
+++ b/src/share/vm/opto/compile.cpp
@@ -400,7 +400,7 @@ void Compile::init_scratch_buffer_blob() {
}
// Initialize the relocation buffers
- relocInfo* locs_buf = (relocInfo*) blob->instructions_end() - MAX_locs_size;
+ relocInfo* locs_buf = (relocInfo*) blob->content_end() - MAX_locs_size;
set_scratch_locs_memory(locs_buf);
}
@@ -422,9 +422,9 @@ uint Compile::scratch_emit_size(const Node* n) {
assert(blob != NULL, "Initialize BufferBlob at start");
assert(blob->size() > MAX_inst_size, "sanity");
relocInfo* locs_buf = scratch_locs_memory();
- address blob_begin = blob->instructions_begin();
+ address blob_begin = blob->content_begin();
address blob_end = (address)locs_buf;
- assert(blob->instructions_contains(blob_end), "sanity");
+ assert(blob->content_contains(blob_end), "sanity");
CodeBuffer buf(blob_begin, blob_end - blob_begin);
buf.initialize_consts_size(MAX_const_size);
buf.initialize_stubs_size(MAX_stubs_size);
@@ -433,7 +433,7 @@ uint Compile::scratch_emit_size(const Node* n) {
buf.insts()->initialize_shared_locs(&locs_buf[0], lsize);
buf.stubs()->initialize_shared_locs(&locs_buf[lsize], lsize);
n->emit(buf, this->regalloc());
- return buf.code_size();
+ return buf.insts_size();
}
diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp
index 938a6a15b..d34f82997 100644
--- a/src/share/vm/opto/graphKit.cpp
+++ b/src/share/vm/opto/graphKit.cpp
@@ -1891,7 +1891,7 @@ void GraphKit::uncommon_trap(int trap_request,
kill_dead_locals();
// Now insert the uncommon trap subroutine call
- address call_addr = SharedRuntime::uncommon_trap_blob()->instructions_begin();
+ address call_addr = SharedRuntime::uncommon_trap_blob()->entry_point();
const TypePtr* no_memory_effects = NULL;
// Pass the index of the class to be loaded
Node* call = make_runtime_call(RC_NO_LEAF | RC_UNCOMMON |
diff --git a/src/share/vm/opto/lcm.cpp b/src/share/vm/opto/lcm.cpp
index 2e43346c7..c93b53eb9 100644
--- a/src/share/vm/opto/lcm.cpp
+++ b/src/share/vm/opto/lcm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -72,8 +72,7 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe
for (uint i1 = 0; i1 < null_block->_nodes.size(); i1++) {
Node* nn = null_block->_nodes[i1];
if (nn->is_MachCall() &&
- nn->as_MachCall()->entry_point() ==
- SharedRuntime::uncommon_trap_blob()->instructions_begin()) {
+ nn->as_MachCall()->entry_point() == SharedRuntime::uncommon_trap_blob()->entry_point()) {
const Type* trtype = nn->in(TypeFunc::Parms)->bottom_type();
if (trtype->isa_int() && trtype->is_int()->is_con()) {
jint tr_con = trtype->is_int()->get_con();
diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp
index f09a1c48f..f48ed6f31 100644
--- a/src/share/vm/opto/library_call.cpp
+++ b/src/share/vm/opto/library_call.cpp
@@ -4962,8 +4962,7 @@ LibraryCallKit::tightly_coupled_allocation(Node* ptr,
for (DUIterator_Fast jmax, j = not_ctl->fast_outs(jmax); j < jmax; j++) {
Node* obs = not_ctl->fast_out(j);
if (obs->in(0) == not_ctl && obs->is_Call() &&
- (obs->as_Call()->entry_point() ==
- SharedRuntime::uncommon_trap_blob()->instructions_begin())) {
+ (obs->as_Call()->entry_point() == SharedRuntime::uncommon_trap_blob()->entry_point())) {
found_trap = true; break;
}
}
diff --git a/src/share/vm/opto/output.cpp b/src/share/vm/opto/output.cpp
index 010743959..959f4c8c8 100644
--- a/src/share/vm/opto/output.cpp
+++ b/src/share/vm/opto/output.cpp
@@ -1184,7 +1184,7 @@ void Compile::Fill_buffer() {
MacroAssembler(cb).bind( blk_labels[b->_pre_order] );
else
- assert( blk_labels[b->_pre_order].loc_pos() == cb->code_size(),
+ assert( blk_labels[b->_pre_order].loc_pos() == cb->insts_size(),
"label position does not match code offset" );
uint last_inst = b->_nodes.size();
@@ -1225,7 +1225,7 @@ void Compile::Fill_buffer() {
// If this requires all previous instructions be flushed, then do so
if( is_sfn || is_mcall || mach->alignment_required() != 1) {
cb->flush_bundle(true);
- current_offset = cb->code_size();
+ current_offset = cb->insts_size();
}
// align the instruction if necessary
@@ -1246,7 +1246,7 @@ void Compile::Fill_buffer() {
_cfg->_bbs.map( nop->_idx, b );
nop->emit(*cb, _regalloc);
cb->flush_bundle(true);
- current_offset = cb->code_size();
+ current_offset = cb->insts_size();
}
// Remember the start of the last call in a basic block
@@ -1348,12 +1348,12 @@ void Compile::Fill_buffer() {
// Save the offset for the listing
#ifndef PRODUCT
if( node_offsets && n->_idx < node_offset_limit )
- node_offsets[n->_idx] = cb->code_size();
+ node_offsets[n->_idx] = cb->insts_size();
#endif
// "Normal" instruction case
n->emit(*cb, _regalloc);
- current_offset = cb->code_size();
+ current_offset = cb->insts_size();
non_safepoints.observe_instruction(n, current_offset);
// mcall is last "call" that can be a safepoint
@@ -1372,13 +1372,12 @@ void Compile::Fill_buffer() {
assert(delay_slot != NULL, "expecting delay slot node");
// Back up 1 instruction
- cb->set_code_end(
- cb->code_end()-Pipeline::instr_unit_size());
+ cb->set_insts_end(cb->insts_end() - Pipeline::instr_unit_size());
// Save the offset for the listing
#ifndef PRODUCT
if( node_offsets && delay_slot->_idx < node_offset_limit )
- node_offsets[delay_slot->_idx] = cb->code_size();
+ node_offsets[delay_slot->_idx] = cb->insts_size();
#endif
// Support a SafePoint in the delay slot
@@ -1420,7 +1419,7 @@ void Compile::Fill_buffer() {
b->_nodes.insert( b->_nodes.size(), nop );
_cfg->_bbs.map( nop->_idx, b );
nop->emit(*cb, _regalloc);
- current_offset = cb->code_size();
+ current_offset = cb->insts_size();
}
}
@@ -1437,13 +1436,13 @@ void Compile::Fill_buffer() {
// Compute the size of the first block
_first_block_size = blk_labels[1].loc_pos() - blk_labels[0].loc_pos();
- assert(cb->code_size() < 500000, "method is unreasonably large");
+ assert(cb->insts_size() < 500000, "method is unreasonably large");
// ------------------
#ifndef PRODUCT
// Information on the size of the method, without the extraneous code
- Scheduling::increment_method_size(cb->code_size());
+ Scheduling::increment_method_size(cb->insts_size());
#endif
// ------------------
diff --git a/src/share/vm/opto/stringopts.cpp b/src/share/vm/opto/stringopts.cpp
index 0f80acec8..2584652a0 100644
--- a/src/share/vm/opto/stringopts.cpp
+++ b/src/share/vm/opto/stringopts.cpp
@@ -157,7 +157,7 @@ class StringConcat : public ResourceObj {
Node* uct = _uncommon_traps.at(u);
// Build a new call using the jvms state of the allocate
- address call_addr = SharedRuntime::uncommon_trap_blob()->instructions_begin();
+ address call_addr = SharedRuntime::uncommon_trap_blob()->entry_point();
const TypeFunc* call_type = OptoRuntime::uncommon_trap_Type();
int size = call_type->domain()->cnt();
const TypePtr* no_memory_effects = NULL;
diff --git a/src/share/vm/prims/jvmtiCodeBlobEvents.cpp b/src/share/vm/prims/jvmtiCodeBlobEvents.cpp
index 0547de267..f742a99e9 100644
--- a/src/share/vm/prims/jvmtiCodeBlobEvents.cpp
+++ b/src/share/vm/prims/jvmtiCodeBlobEvents.cpp
@@ -114,7 +114,7 @@ void CodeBlobCollector::do_blob(CodeBlob* cb) {
// check if this starting address has been seen already - the
// assumption is that stubs are inserted into the list before the
// enclosing BufferBlobs.
- address addr = cb->instructions_begin();
+ address addr = cb->code_begin();
for (int i=0; i<_global_code_blobs->length(); i++) {
JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i);
if (addr == scb->code_begin()) {
@@ -123,8 +123,7 @@ void CodeBlobCollector::do_blob(CodeBlob* cb) {
}
// record the CodeBlob details as a JvmtiCodeBlobDesc
- JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->instructions_begin(),
- cb->instructions_end());
+ JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end());
_global_code_blobs->append(scb);
}
diff --git a/src/share/vm/prims/jvmtiExport.cpp b/src/share/vm/prims/jvmtiExport.cpp
index a4c2828da..d07f5902b 100644
--- a/src/share/vm/prims/jvmtiExport.cpp
+++ b/src/share/vm/prims/jvmtiExport.cpp
@@ -687,8 +687,8 @@ class JvmtiCompiledMethodLoadEventMark : public JvmtiMethodEventMark {
public:
JvmtiCompiledMethodLoadEventMark(JavaThread *thread, nmethod *nm, void* compile_info_ptr = NULL)
: JvmtiMethodEventMark(thread,methodHandle(thread, nm->method())) {
- _code_data = nm->code_begin();
- _code_size = nm->code_size();
+ _code_data = nm->insts_begin();
+ _code_size = nm->insts_size();
_compile_info = compile_info_ptr; // Set void pointer of compiledMethodLoad Event. Default value is NULL.
JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
}
diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp
index 7b3acfda1..650b3d309 100644
--- a/src/share/vm/prims/methodHandles.cpp
+++ b/src/share/vm/prims/methodHandles.cpp
@@ -113,8 +113,7 @@ void MethodHandles::generate_adapters() {
_adapter_code = MethodHandlesAdapterBlob::create(_adapter_code_size);
if (_adapter_code == NULL)
vm_exit_out_of_memory(_adapter_code_size, "CodeCache: no room for MethodHandles adapters");
- CodeBuffer code(_adapter_code->instructions_begin(), _adapter_code->instructions_size());
-
+ CodeBuffer code(_adapter_code);
MethodHandlesAdapterGenerator g(&code);
g.generate();
}
diff --git a/src/share/vm/runtime/compilationPolicy.cpp b/src/share/vm/runtime/compilationPolicy.cpp
index 96b02db43..eba75a067 100644
--- a/src/share/vm/runtime/compilationPolicy.cpp
+++ b/src/share/vm/runtime/compilationPolicy.cpp
@@ -439,7 +439,7 @@ const char* StackWalkCompPolicy::shouldNotInline(methodHandle m) {
if (!instanceKlass::cast(m->method_holder())->is_initialized()) return (_msg = "method holder not initialized");
if (m->is_native()) return (_msg = "native method");
nmethod* m_code = m->code();
- if( m_code != NULL && m_code->instructions_size() > InlineSmallCode )
+ if (m_code != NULL && m_code->code_size() > InlineSmallCode)
return (_msg = "already compiled into a big method");
// use frequency-based objections only for non-trivial methods
diff --git a/src/share/vm/runtime/frame.cpp b/src/share/vm/runtime/frame.cpp
index 69d287984..bf24d6eb8 100644
--- a/src/share/vm/runtime/frame.cpp
+++ b/src/share/vm/runtime/frame.cpp
@@ -537,8 +537,8 @@ void frame::print_value_on(outputStream* st, JavaThread *thread) const {
st->cr();
#ifndef PRODUCT
if (end == NULL) {
- begin = _cb->instructions_begin();
- end = _cb->instructions_end();
+ begin = _cb->code_begin();
+ end = _cb->code_end();
}
#endif
}
diff --git a/src/share/vm/runtime/icache.cpp b/src/share/vm/runtime/icache.cpp
index 5774f0d28..78a3bcd78 100644
--- a/src/share/vm/runtime/icache.cpp
+++ b/src/share/vm/runtime/icache.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@ void AbstractICache::initialize() {
ResourceMark rm;
BufferBlob* b = BufferBlob::create("flush_icache_stub", ICache::stub_size);
- CodeBuffer c(b->instructions_begin(), b->instructions_size());
+ CodeBuffer c(b);
ICacheStubGenerator g(&c);
g.generate_icache_flush(&_flush_icache_stub);
diff --git a/src/share/vm/runtime/rframe.cpp b/src/share/vm/runtime/rframe.cpp
index e9125796d..ca7501ab4 100644
--- a/src/share/vm/runtime/rframe.cpp
+++ b/src/share/vm/runtime/rframe.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@ int InterpretedRFrame::cost() const {
int CompiledRFrame::cost() const {
nmethod* nm = top_method()->code();
if (nm != NULL) {
- return nm->code_size();
+ return nm->insts_size();
} else {
return top_method()->code_size();
}
diff --git a/src/share/vm/runtime/sharedRuntime.cpp b/src/share/vm/runtime/sharedRuntime.cpp
index 5e9325399..426b359cd 100644
--- a/src/share/vm/runtime/sharedRuntime.cpp
+++ b/src/share/vm/runtime/sharedRuntime.cpp
@@ -455,11 +455,11 @@ address SharedRuntime::get_poll_stub(address pc) {
if (at_poll_return) {
assert(SharedRuntime::polling_page_return_handler_blob() != NULL,
"polling page return stub not created yet");
- stub = SharedRuntime::polling_page_return_handler_blob()->instructions_begin();
+ stub = SharedRuntime::polling_page_return_handler_blob()->entry_point();
} else {
assert(SharedRuntime::polling_page_safepoint_handler_blob() != NULL,
"polling page safepoint stub not created yet");
- stub = SharedRuntime::polling_page_safepoint_handler_blob()->instructions_begin();
+ stub = SharedRuntime::polling_page_safepoint_handler_blob()->entry_point();
}
#ifndef PRODUCT
if( TraceSafepoint ) {
@@ -574,7 +574,7 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc,
}
// found handling method => lookup exception handler
- int catch_pco = ret_pc - nm->instructions_begin();
+ int catch_pco = ret_pc - nm->code_begin();
ExceptionHandlerTable table(nm);
HandlerTableEntry *t = table.entry_for(catch_pco, handler_bci, scope_depth);
@@ -607,7 +607,7 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc,
return NULL;
}
- return nm->instructions_begin() + t->pco();
+ return nm->code_begin() + t->pco();
}
JRT_ENTRY(void, SharedRuntime::throw_AbstractMethodError(JavaThread* thread))
@@ -2252,7 +2252,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
ResourceMark rm;
- NOT_PRODUCT(int code_size);
+ NOT_PRODUCT(int insts_size);
AdapterBlob* B = NULL;
AdapterHandlerEntry* entry = NULL;
AdapterFingerPrint* fingerprint = NULL;
@@ -2305,7 +2305,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
if (buf != NULL) {
- CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+ CodeBuffer buffer(buf);
short buffer_locs[20];
buffer.insts()->initialize_shared_locs((relocInfo*)buffer_locs,
sizeof(buffer_locs)/sizeof(relocInfo));
@@ -2321,19 +2321,19 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
#ifdef ASSERT
if (VerifyAdapterSharing) {
if (shared_entry != NULL) {
- assert(shared_entry->compare_code(buf->instructions_begin(), buffer.code_size(), total_args_passed, sig_bt),
+ assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt),
"code must match");
// Release the one just created and return the original
_adapters->free_entry(entry);
return shared_entry;
} else {
- entry->save_code(buf->instructions_begin(), buffer.code_size(), total_args_passed, sig_bt);
+ entry->save_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt);
}
}
#endif
B = AdapterBlob::create(&buffer);
- NOT_PRODUCT(code_size = buffer.code_size());
+ NOT_PRODUCT(insts_size = buffer.insts_size());
}
if (B == NULL) {
// CodeCache is full, disable compilation
@@ -2343,16 +2343,16 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
CompileBroker::handle_full_code_cache();
return NULL; // Out of CodeCache space
}
- entry->relocate(B->instructions_begin());
+ entry->relocate(B->content_begin());
#ifndef PRODUCT
// debugging suppport
if (PrintAdapterHandlers) {
tty->cr();
tty->print_cr("i2c argument handler #%d for: %s %s (fingerprint = %s, %d bytes generated)",
_adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
- method->signature()->as_C_string(), fingerprint->as_string(), code_size );
+ method->signature()->as_C_string(), fingerprint->as_string(), insts_size );
tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
- Disassembler::decode(entry->get_i2c_entry(), entry->get_i2c_entry() + code_size);
+ Disassembler::decode(entry->get_i2c_entry(), entry->get_i2c_entry() + insts_size);
}
#endif
@@ -2366,13 +2366,11 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
"%s(%s)@" PTR_FORMAT,
B->name(),
fingerprint->as_string(),
- B->instructions_begin());
- Forte::register_stub(blob_id, B->instructions_begin(), B->instructions_end());
+ B->content_begin());
+ Forte::register_stub(blob_id, B->content_begin(), B->content_end());
if (JvmtiExport::should_post_dynamic_code_generated()) {
- JvmtiExport::post_dynamic_code_generated(blob_id,
- B->instructions_begin(),
- B->instructions_end());
+ JvmtiExport::post_dynamic_code_generated(blob_id, B->content_begin(), B->content_end());
}
}
return entry;
@@ -2456,7 +2454,7 @@ nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
if (buf != NULL) {
- CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+ CodeBuffer buffer(buf);
double locs_buf[20];
buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
MacroAssembler _masm(&buffer);
@@ -2540,7 +2538,7 @@ nmethod *AdapterHandlerLibrary::create_dtrace_nmethod(methodHandle method) {
BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
if (buf != NULL) {
- CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+ CodeBuffer buffer(buf);
// Need a few relocation entries
double locs_buf[20];
buffer.insts()->initialize_shared_locs(
diff --git a/src/share/vm/runtime/sharedRuntime.hpp b/src/share/vm/runtime/sharedRuntime.hpp
index bd5031e49..4f6d103f8 100644
--- a/src/share/vm/runtime/sharedRuntime.hpp
+++ b/src/share/vm/runtime/sharedRuntime.hpp
@@ -173,12 +173,12 @@ class SharedRuntime: AllStatic {
static address get_ic_miss_stub() {
assert(_ic_miss_blob!= NULL, "oops");
- return _ic_miss_blob->instructions_begin();
+ return _ic_miss_blob->entry_point();
}
static address get_handle_wrong_method_stub() {
assert(_wrong_method_blob!= NULL, "oops");
- return _wrong_method_blob->instructions_begin();
+ return _wrong_method_blob->entry_point();
}
#ifdef COMPILER2
@@ -188,15 +188,15 @@ class SharedRuntime: AllStatic {
static address get_resolve_opt_virtual_call_stub(){
assert(_resolve_opt_virtual_call_blob != NULL, "oops");
- return _resolve_opt_virtual_call_blob->instructions_begin();
+ return _resolve_opt_virtual_call_blob->entry_point();
}
static address get_resolve_virtual_call_stub() {
assert(_resolve_virtual_call_blob != NULL, "oops");
- return _resolve_virtual_call_blob->instructions_begin();
+ return _resolve_virtual_call_blob->entry_point();
}
static address get_resolve_static_call_stub() {
assert(_resolve_static_call_blob != NULL, "oops");
- return _resolve_static_call_blob->instructions_begin();
+ return _resolve_static_call_blob->entry_point();
}
static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; }
@@ -548,16 +548,17 @@ class SharedRuntime: AllStatic {
// This library manages argument marshaling adapters and native wrappers.
// There are 2 flavors of adapters: I2C and C2I.
//
-// The I2C flavor takes a stock interpreted call setup, marshals the arguments
-// for a Java-compiled call, and jumps to Rmethod-> code()->
-// instructions_begin(). It is broken to call it without an nmethod assigned.
-// The usual behavior is to lift any register arguments up out of the stack
-// and possibly re-pack the extra arguments to be contigious. I2C adapters
-// will save what the interpreter's stack pointer will be after arguments are
-// popped, then adjust the interpreter's frame size to force alignment and
-// possibly to repack the arguments. After re-packing, it jumps to the
-// compiled code start. There are no safepoints in this adapter code and a GC
-// cannot happen while marshaling is in progress.
+// The I2C flavor takes a stock interpreted call setup, marshals the
+// arguments for a Java-compiled call, and jumps to Rmethod-> code()->
+// code_begin(). It is broken to call it without an nmethod assigned.
+// The usual behavior is to lift any register arguments up out of the
+// stack and possibly re-pack the extra arguments to be contigious.
+// I2C adapters will save what the interpreter's stack pointer will be
+// after arguments are popped, then adjust the interpreter's frame
+// size to force alignment and possibly to repack the arguments.
+// After re-packing, it jumps to the compiled code start. There are
+// no safepoints in this adapter code and a GC cannot happen while
+// marshaling is in progress.
//
// The C2I flavor takes a stock compiled call setup plus the target method in
// Rmethod, marshals the arguments for an interpreted call and jumps to
diff --git a/src/share/vm/runtime/stubRoutines.cpp b/src/share/vm/runtime/stubRoutines.cpp
index 0b39eb700..66bd61125 100644
--- a/src/share/vm/runtime/stubRoutines.cpp
+++ b/src/share/vm/runtime/stubRoutines.cpp
@@ -119,10 +119,9 @@ void StubRoutines::initialize1() {
TraceTime timer("StubRoutines generation 1", TraceStartupTime);
_code1 = BufferBlob::create("StubRoutines (1)", code_size1);
if (_code1 == NULL) {
- vm_exit_out_of_memory(code_size1,
- "CodeCache: no room for StubRoutines (1)");
+ vm_exit_out_of_memory(code_size1, "CodeCache: no room for StubRoutines (1)");
}
- CodeBuffer buffer(_code1->instructions_begin(), _code1->instructions_size());
+ CodeBuffer buffer(_code1);
StubGenerator_generate(&buffer, false);
}
}
@@ -172,10 +171,9 @@ void StubRoutines::initialize2() {
TraceTime timer("StubRoutines generation 2", TraceStartupTime);
_code2 = BufferBlob::create("StubRoutines (2)", code_size2);
if (_code2 == NULL) {
- vm_exit_out_of_memory(code_size2,
- "CodeCache: no room for StubRoutines (2)");
+ vm_exit_out_of_memory(code_size2, "CodeCache: no room for StubRoutines (2)");
}
- CodeBuffer buffer(_code2->instructions_begin(), _code2->instructions_size());
+ CodeBuffer buffer(_code2);
StubGenerator_generate(&buffer, true);
}
diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp
index 78f676e9c..4857811ae 100644
--- a/src/share/vm/runtime/vmStructs.cpp
+++ b/src/share/vm/runtime/vmStructs.cpp
@@ -604,7 +604,8 @@ static inline uint64_t cast_uint64_t(size_t x)
nonstatic_field(CodeBlob, _size, int) \
nonstatic_field(CodeBlob, _header_size, int) \
nonstatic_field(CodeBlob, _relocation_size, int) \
- nonstatic_field(CodeBlob, _instructions_offset, int) \
+ nonstatic_field(CodeBlob, _content_offset, int) \
+ nonstatic_field(CodeBlob, _code_offset, int) \
nonstatic_field(CodeBlob, _frame_complete_offset, int) \
nonstatic_field(CodeBlob, _data_offset, int) \
nonstatic_field(CodeBlob, _frame_size, int) \