# HG changeset patch # User mgerdin # Date 1450451272 -3600 # Fri Dec 18 16:07:52 2015 +0100 # Node ID 48ff36a9ec10c98657098e0774a94a8cd6759032 # Parent 9abe7c97d9baa226e9076a742e858d98a3662cd7 imported patch vtable-len-offset-bytesize diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -904,7 +904,7 @@ int vte_size = vtableEntry::size() * wordSize; assert(vte_size == wordSize, "else adjust times_vte_scale"); - ldrw(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset() * wordSize)); + ldrw(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset_bytes())); // %%% Could store the aligned, prescaled offset in the klassoop. // lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base)); diff --git a/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp b/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp --- a/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp +++ b/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp @@ -73,7 +73,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ ldrw(rscratch1, Address(r19, InstanceKlass::vtable_length_offset() * wordSize)); + __ ldrw(rscratch1, Address(r19, InstanceKlass::vtable_length_offset_bytes())); __ cmpw(rscratch1, vtable_index * vtableEntry::size()); __ br(Assembler::GT, L); __ enter(); diff --git a/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -1546,7 +1546,7 @@ int scan_step = itableOffsetEntry::size() * wordSize; int log_vte_size= exact_log2(vtableEntry::size() * wordSize); - lwz(scan_temp, InstanceKlass::vtable_length_offset() * wordSize, recv_klass); + lwz(scan_temp, InstanceKlass::vtable_length_offset_bytes(), recv_klass); // %%% We should store the aligned, prescaled offset in the klassoop. // Then the next several instructions would fold away. diff --git a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp --- a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp +++ b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp @@ -86,7 +86,7 @@ Label L; // Check offset vs vtable length. const Register vtable_len = R12_scratch2; - __ lwz(vtable_len, InstanceKlass::vtable_length_offset()*wordSize, rcvr_klass); + __ lwz(vtable_len, InstanceKlass::vtable_length_offset_bytes(), rcvr_klass); __ cmpwi(CCR0, vtable_len, vtable_index*vtableEntry::size()); __ bge(CCR0, L); __ li(R12_scratch2, vtable_index); @@ -161,7 +161,7 @@ __ load_klass_with_trap_null_check(rcvr_klass, R3_ARG1); BLOCK_COMMENT("Load start of itable entries into itable_entry."); - __ lwz(vtable_len, InstanceKlass::vtable_length_offset() * wordSize, rcvr_klass); + __ lwz(vtable_len, InstanceKlass::vtable_length_offset_bytes(), rcvr_klass); __ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size() * wordSize)); __ add(itable_entry_addr, vtable_len, rcvr_klass); diff --git a/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -2206,7 +2206,7 @@ int scan_step = itableOffsetEntry::size() * wordSize; int vte_size = vtableEntry::size() * wordSize; - lduw(recv_klass, InstanceKlass::vtable_length_offset() * wordSize, scan_temp); + lduw(recv_klass, InstanceKlass::vtable_length_offset_bytes(), scan_temp); // %%% We should store the aligned, prescaled offset in the klassoop. // Then the next several instructions would fold away. diff --git a/src/cpu/sparc/vm/templateTable_sparc.cpp b/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -3157,7 +3157,7 @@ Label search; Register Rtemp = O1_flags; - __ ld(O2_Klass, InstanceKlass::vtable_length_offset() * wordSize, Rtemp); + __ ld(O2_Klass, InstanceKlass::vtable_length_offset_bytes(), Rtemp); if (align_object_offset(1) > 1) { __ round_to(Rtemp, align_object_offset(1)); } diff --git a/src/cpu/sparc/vm/vtableStubs_sparc.cpp b/src/cpu/sparc/vm/vtableStubs_sparc.cpp --- a/src/cpu/sparc/vm/vtableStubs_sparc.cpp +++ b/src/cpu/sparc/vm/vtableStubs_sparc.cpp @@ -78,7 +78,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ ld(G3_scratch, InstanceKlass::vtable_length_offset()*wordSize, G5); + __ ld(G3_scratch, InstanceKlass::vtable_length_offset_bytes(), G5); __ cmp_and_br_short(G5, vtable_index*vtableEntry::size(), Assembler::greaterUnsigned, Assembler::pt, L); __ set(vtable_index, O2); __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), O0, O2); diff --git a/src/cpu/x86/vm/macroAssembler_x86.cpp b/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -6046,7 +6046,7 @@ Address::ScaleFactor times_vte_scale = Address::times_ptr; assert(vte_size == wordSize, "else adjust times_vte_scale"); - movl(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset() * wordSize)); + movl(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset_bytes())); // %%% Could store the aligned, prescaled offset in the klassoop. lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base)); diff --git a/src/cpu/x86/vm/vtableStubs_x86_32.cpp b/src/cpu/x86/vm/vtableStubs_x86_32.cpp --- a/src/cpu/x86/vm/vtableStubs_x86_32.cpp +++ b/src/cpu/x86/vm/vtableStubs_x86_32.cpp @@ -85,7 +85,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ cmpl(Address(rax, InstanceKlass::vtable_length_offset()*wordSize), vtable_index*vtableEntry::size()); + __ cmpl(Address(rax, InstanceKlass::vtable_length_offset_bytes()), vtable_index*vtableEntry::size()); __ jcc(Assembler::greater, L); __ movl(rbx, vtable_index); __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), rcx, rbx); diff --git a/src/cpu/x86/vm/vtableStubs_x86_64.cpp b/src/cpu/x86/vm/vtableStubs_x86_64.cpp --- a/src/cpu/x86/vm/vtableStubs_x86_64.cpp +++ b/src/cpu/x86/vm/vtableStubs_x86_64.cpp @@ -77,7 +77,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ cmpl(Address(rax, InstanceKlass::vtable_length_offset() * wordSize), + __ cmpl(Address(rax, InstanceKlass::vtable_length_offset_bytes()), vtable_index * vtableEntry::size()); __ jcc(Assembler::greater, L); __ movl(rbx, vtable_index); diff --git a/src/share/vm/oops/instanceKlass.hpp b/src/share/vm/oops/instanceKlass.hpp --- a/src/share/vm/oops/instanceKlass.hpp +++ b/src/share/vm/oops/instanceKlass.hpp @@ -951,7 +951,7 @@ #endif static int vtable_start_offset() { return header_size(); } - static int vtable_length_offset() { return offset_of(InstanceKlass, _vtable_len) / HeapWordSize; } + static int vtable_length_offset_bytes() { return offset_of(InstanceKlass, _vtable_len); } intptr_t* start_of_vtable() const { return ((intptr_t*)this) + vtable_start_offset(); } intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } diff --git a/src/share/vm/shark/sharkTopLevelBlock.cpp b/src/share/vm/shark/sharkTopLevelBlock.cpp --- a/src/share/vm/shark/sharkTopLevelBlock.cpp +++ b/src/share/vm/shark/sharkTopLevelBlock.cpp @@ -1171,7 +1171,7 @@ Value *vtable_length = builder()->CreateValueOfStructEntry( object_klass, - in_ByteSize(InstanceKlass::vtable_length_offset() * HeapWordSize), + in_ByteSize(InstanceKlass::vtable_length_offset_bytes()), SharkType::jint_type(), "vtable_length"); vtable_length = # HG changeset patch # User mgerdin # Date 1452690850 -3600 # Wed Jan 13 14:14:10 2016 +0100 # Node ID 1871c4d9479811a727d6ab1ade51bc1a5281f4c8 # Parent 48ff36a9ec10c98657098e0774a94a8cd6759032 [mq]: vtlen-ByteSize diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -904,7 +904,7 @@ int vte_size = vtableEntry::size() * wordSize; assert(vte_size == wordSize, "else adjust times_vte_scale"); - ldrw(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset_bytes())); + ldrw(scan_temp, Address(recv_klass, in_bytes(InstanceKlass::vtable_length_offset()))); // %%% Could store the aligned, prescaled offset in the klassoop. // lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base)); diff --git a/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp b/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp --- a/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp +++ b/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp @@ -73,7 +73,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ ldrw(rscratch1, Address(r19, InstanceKlass::vtable_length_offset_bytes())); + __ ldrw(rscratch1, Address(r19, in_bytes(InstanceKlass::vtable_length_offset()))); __ cmpw(rscratch1, vtable_index * vtableEntry::size()); __ br(Assembler::GT, L); __ enter(); diff --git a/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -1546,7 +1546,7 @@ int scan_step = itableOffsetEntry::size() * wordSize; int log_vte_size= exact_log2(vtableEntry::size() * wordSize); - lwz(scan_temp, InstanceKlass::vtable_length_offset_bytes(), recv_klass); + lwz(scan_temp, in_bytes(InstanceKlass::vtable_length_offset()), recv_klass); // %%% We should store the aligned, prescaled offset in the klassoop. // Then the next several instructions would fold away. diff --git a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp --- a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp +++ b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp @@ -86,7 +86,7 @@ Label L; // Check offset vs vtable length. const Register vtable_len = R12_scratch2; - __ lwz(vtable_len, InstanceKlass::vtable_length_offset_bytes(), rcvr_klass); + __ lwz(vtable_len, in_bytes(InstanceKlass::vtable_length_offset()), rcvr_klass); __ cmpwi(CCR0, vtable_len, vtable_index*vtableEntry::size()); __ bge(CCR0, L); __ li(R12_scratch2, vtable_index); @@ -161,7 +161,7 @@ __ load_klass_with_trap_null_check(rcvr_klass, R3_ARG1); BLOCK_COMMENT("Load start of itable entries into itable_entry."); - __ lwz(vtable_len, InstanceKlass::vtable_length_offset_bytes(), rcvr_klass); + __ lwz(vtable_len, in_bytes(InstanceKlass::vtable_length_offset()), rcvr_klass); __ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size() * wordSize)); __ add(itable_entry_addr, vtable_len, rcvr_klass); diff --git a/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -2206,7 +2206,7 @@ int scan_step = itableOffsetEntry::size() * wordSize; int vte_size = vtableEntry::size() * wordSize; - lduw(recv_klass, InstanceKlass::vtable_length_offset_bytes(), scan_temp); + lduw(recv_klass, in_bytes(InstanceKlass::vtable_length_offset()), scan_temp); // %%% We should store the aligned, prescaled offset in the klassoop. // Then the next several instructions would fold away. diff --git a/src/cpu/sparc/vm/templateTable_sparc.cpp b/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -3157,7 +3157,7 @@ Label search; Register Rtemp = O1_flags; - __ ld(O2_Klass, InstanceKlass::vtable_length_offset_bytes(), Rtemp); + __ ld(O2_Klass, in_bytes(InstanceKlass::vtable_length_offset()), Rtemp); if (align_object_offset(1) > 1) { __ round_to(Rtemp, align_object_offset(1)); } diff --git a/src/cpu/sparc/vm/vtableStubs_sparc.cpp b/src/cpu/sparc/vm/vtableStubs_sparc.cpp --- a/src/cpu/sparc/vm/vtableStubs_sparc.cpp +++ b/src/cpu/sparc/vm/vtableStubs_sparc.cpp @@ -78,7 +78,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ ld(G3_scratch, InstanceKlass::vtable_length_offset_bytes(), G5); + __ ld(G3_scratch, in_bytes(InstanceKlass::vtable_length_offset()), G5); __ cmp_and_br_short(G5, vtable_index*vtableEntry::size(), Assembler::greaterUnsigned, Assembler::pt, L); __ set(vtable_index, O2); __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), O0, O2); diff --git a/src/cpu/x86/vm/macroAssembler_x86.cpp b/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -6046,7 +6046,7 @@ Address::ScaleFactor times_vte_scale = Address::times_ptr; assert(vte_size == wordSize, "else adjust times_vte_scale"); - movl(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset_bytes())); + movl(scan_temp, Address(recv_klass, in_bytes(InstanceKlass::vtable_length_offset()))); // %%% Could store the aligned, prescaled offset in the klassoop. lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base)); diff --git a/src/cpu/x86/vm/vtableStubs_x86_32.cpp b/src/cpu/x86/vm/vtableStubs_x86_32.cpp --- a/src/cpu/x86/vm/vtableStubs_x86_32.cpp +++ b/src/cpu/x86/vm/vtableStubs_x86_32.cpp @@ -85,7 +85,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ cmpl(Address(rax, InstanceKlass::vtable_length_offset_bytes()), vtable_index*vtableEntry::size()); + __ cmpl(Address(rax, in_bytes(InstanceKlass::vtable_length_offset())), vtable_index*vtableEntry::size()); __ jcc(Assembler::greater, L); __ movl(rbx, vtable_index); __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), rcx, rbx); diff --git a/src/cpu/x86/vm/vtableStubs_x86_64.cpp b/src/cpu/x86/vm/vtableStubs_x86_64.cpp --- a/src/cpu/x86/vm/vtableStubs_x86_64.cpp +++ b/src/cpu/x86/vm/vtableStubs_x86_64.cpp @@ -77,7 +77,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ cmpl(Address(rax, InstanceKlass::vtable_length_offset_bytes()), + __ cmpl(Address(rax, in_bytes(InstanceKlass::vtable_length_offset())), vtable_index * vtableEntry::size()); __ jcc(Assembler::greater, L); __ movl(rbx, vtable_index); diff --git a/src/share/vm/oops/instanceKlass.hpp b/src/share/vm/oops/instanceKlass.hpp --- a/src/share/vm/oops/instanceKlass.hpp +++ b/src/share/vm/oops/instanceKlass.hpp @@ -950,8 +950,8 @@ virtual void collect_statistics(KlassSizeStats *sz) const; #endif - static int vtable_start_offset() { return header_size(); } - static int vtable_length_offset_bytes() { return offset_of(InstanceKlass, _vtable_len); } + static WordSize vtable_start_offset() { return in_WordSize(header_size()); } + static ByteSize vtable_length_offset() { return byte_offset_of(InstanceKlass, _vtable_len); } intptr_t* start_of_vtable() const { return ((intptr_t*)this) + vtable_start_offset(); } intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } diff --git a/src/share/vm/shark/sharkTopLevelBlock.cpp b/src/share/vm/shark/sharkTopLevelBlock.cpp --- a/src/share/vm/shark/sharkTopLevelBlock.cpp +++ b/src/share/vm/shark/sharkTopLevelBlock.cpp @@ -1171,7 +1171,7 @@ Value *vtable_length = builder()->CreateValueOfStructEntry( object_klass, - in_ByteSize(InstanceKlass::vtable_length_offset_bytes()), + InstanceKlass::vtable_length_offset(), SharkType::jint_type(), "vtable_length"); vtable_length = # HG changeset patch # User mgerdin # Date 1452692646 -3600 # Wed Jan 13 14:44:06 2016 +0100 # Node ID 167f5e78ddf61d3e892a4c11d21a7b1d8f543b5f # Parent 1871c4d9479811a727d6ab1ade51bc1a5281f4c8 [mq]: vtable_start_WordSize diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -898,7 +898,7 @@ "caller must use same register for non-constant itable index as for method"); // Compute start of first itableOffsetEntry (which is at the end of the vtable) - int vtable_base = InstanceKlass::vtable_start_offset() * wordSize; + int vtable_base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; int itentry_off = itableMethodEntry::method_offset_in_bytes(); int scan_step = itableOffsetEntry::size() * wordSize; int vte_size = vtableEntry::size() * wordSize; @@ -963,7 +963,7 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass, RegisterOrConstant vtable_index, Register method_result) { - const int base = InstanceKlass::vtable_start_offset() * wordSize; + const int base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; assert(vtableEntry::size() * wordSize == 8, "adjust the scaling in the code below"); int vtable_offset_in_bytes = base + vtableEntry::method_offset_in_bytes(); diff --git a/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -1540,7 +1540,7 @@ "caller must use same register for non-constant itable index as for method"); // Compute start of first itableOffsetEntry (which is at the end of the vtable). - int vtable_base = InstanceKlass::vtable_start_offset() * wordSize; + int vtable_base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; int itentry_off = itableMethodEntry::method_offset_in_bytes(); int logMEsize = exact_log2(itableMethodEntry::size() * wordSize); int scan_step = itableOffsetEntry::size() * wordSize; @@ -1614,7 +1614,7 @@ assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg()); - const int base = InstanceKlass::vtable_start_offset() * wordSize; + const int base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); if (vtable_index.is_register()) { diff --git a/src/cpu/ppc/vm/ppc.ad b/src/cpu/ppc/vm/ppc.ad --- a/src/cpu/ppc/vm/ppc.ad +++ b/src/cpu/ppc/vm/ppc.ad @@ -3635,7 +3635,7 @@ __ load_klass(R11_scratch1, R3); - int entry_offset = InstanceKlass::vtable_start_offset() + _vtable_index * vtableEntry::size(); + int entry_offset = in_words(InstanceKlass::vtable_start_offset()) + _vtable_index * vtableEntry::size(); int v_off = entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); __ li(R19_method, v_off); __ ldx(R19_method/*method oop*/, R19_method/*method offset*/, R11_scratch1/*class*/); diff --git a/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/src/cpu/ppc/vm/templateTable_ppc_64.cpp --- a/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -3286,7 +3286,7 @@ const Register Rtarget_method = Rindex; // Get target method & entry point. - const int base = InstanceKlass::vtable_start_offset() * wordSize; + const int base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; // Calc vtable addr scale the vtable index by 8. __ sldi(Rindex, Rindex, exact_log2(vtableEntry::size() * wordSize)); // Load target. diff --git a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp --- a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp +++ b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp @@ -79,7 +79,7 @@ __ load_klass_with_trap_null_check(rcvr_klass, R3); // Set method (in case of interpreted method), and destination address. - int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size(); + int entry_offset = in_words(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size(); #ifndef PRODUCT if (DebugVtables) { @@ -167,7 +167,7 @@ // Loop over all itable entries until desired interfaceOop(Rinterface) found. BLOCK_COMMENT("Increment itable_entry_addr in loop."); - const int vtable_base_offset = InstanceKlass::vtable_start_offset() * wordSize; + const int vtable_base_offset = in_words(InstanceKlass::vtable_start_offset()) * wordSize; __ addi(itable_entry_addr, itable_entry_addr, vtable_base_offset + itableOffsetEntry::interface_offset_in_bytes()); const int itable_offset_search_inc = itableOffsetEntry::size() * wordSize; diff --git a/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -2202,7 +2202,7 @@ } // Compute start of first itableOffsetEntry (which is at the end of the vtable) - int vtable_base = InstanceKlass::vtable_start_offset() * wordSize; + int vtable_base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; int scan_step = itableOffsetEntry::size() * wordSize; int vte_size = vtableEntry::size() * wordSize; @@ -2294,7 +2294,7 @@ Register method_result) { assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg()); Register sethi_temp = method_result; - const int base = (InstanceKlass::vtable_start_offset() * wordSize + + const int base = (in_words(InstanceKlass::vtable_start_offset()) * wordSize + // method pointer offset within the vtable entry: vtableEntry::method_offset_in_bytes()); RegisterOrConstant vtable_offset = vtable_index; diff --git a/src/cpu/sparc/vm/sparc.ad b/src/cpu/sparc/vm/sparc.ad --- a/src/cpu/sparc/vm/sparc.ad +++ b/src/cpu/sparc/vm/sparc.ad @@ -601,7 +601,7 @@ NativeCall::instruction_size); // sethi; setlo; call; delay slot } else { assert(!UseInlineCaches, "expect vtable calls only if not using ICs"); - int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size(); + int entry_offset = in_words(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size(); int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes(); int klass_load_size; if (UseCompressedClassPointers) { @@ -2658,7 +2658,7 @@ } else { klass_load_size = 1*BytesPerInstWord; } - int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size(); + int entry_offset = in_words(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size(); int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes(); if (Assembler::is_simm13(v_off)) { __ ld_ptr(G3, v_off, G5_method); diff --git a/src/cpu/sparc/vm/templateTable_sparc.cpp b/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -3153,7 +3153,7 @@ // // compute start of first itableOffsetEntry (which is at end of vtable) - const int base = InstanceKlass::vtable_start_offset() * wordSize; + const int base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; Label search; Register Rtemp = O1_flags; diff --git a/src/cpu/x86/vm/macroAssembler_x86.cpp b/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -6039,7 +6039,7 @@ "caller must use same register for non-constant itable index as for method"); // Compute start of first itableOffsetEntry (which is at the end of the vtable) - int vtable_base = InstanceKlass::vtable_start_offset() * wordSize; + int vtable_base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; int itentry_off = itableMethodEntry::method_offset_in_bytes(); int scan_step = itableOffsetEntry::size() * wordSize; int vte_size = vtableEntry::size() * wordSize; @@ -6102,7 +6102,7 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass, RegisterOrConstant vtable_index, Register method_result) { - const int base = InstanceKlass::vtable_start_offset() * wordSize; + const int base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; assert(vtableEntry::size() * wordSize == wordSize, "else adjust the scaling in the code below"); Address vtable_entry_addr(recv_klass, vtable_index, Address::times_ptr, diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2972,7 +2972,7 @@ SharedRuntime::get_resolve_virtual_call_stub(), arg_list, info); } else { - int entry_offset = InstanceKlass::vtable_start_offset() + x->vtable_index() * vtableEntry::size(); + int entry_offset = in_words(InstanceKlass::vtable_start_offset()) + x->vtable_index() * vtableEntry::size(); int vtable_offset = entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); __ call_virtual(target, receiver, result_register, vtable_offset, arg_list, info); } diff --git a/src/share/vm/oops/instanceKlass.hpp b/src/share/vm/oops/instanceKlass.hpp --- a/src/share/vm/oops/instanceKlass.hpp +++ b/src/share/vm/oops/instanceKlass.hpp @@ -951,9 +951,10 @@ #endif static WordSize vtable_start_offset() { return in_WordSize(header_size()); } + static ByteSize vtable_start_offset_bytes() { return in_ByteSize(header_size() * wordSize); } static ByteSize vtable_length_offset() { return byte_offset_of(InstanceKlass, _vtable_len); } - intptr_t* start_of_vtable() const { return ((intptr_t*)this) + vtable_start_offset(); } + intptr_t* start_of_vtable() const { return ((intptr_t*)this) + in_words(vtable_start_offset()); } intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; } diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp --- a/src/share/vm/opto/library_call.cpp +++ b/src/share/vm/opto/library_call.cpp @@ -4048,7 +4048,7 @@ assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, "bad index %d", vtable_index); // Get the Method* out of the appropriate vtable entry. - int entry_offset = (InstanceKlass::vtable_start_offset() + + int entry_offset = (in_words(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size()) * wordSize + vtableEntry::method_offset_in_bytes(); Node* entry_addr = basic_plus_adr(obj_klass, entry_offset); diff --git a/src/share/vm/shark/sharkTopLevelBlock.cpp b/src/share/vm/shark/sharkTopLevelBlock.cpp --- a/src/share/vm/shark/sharkTopLevelBlock.cpp +++ b/src/share/vm/shark/sharkTopLevelBlock.cpp @@ -1144,7 +1144,7 @@ klass, SharkType::Method_type(), vtableEntry::size() * wordSize, - in_ByteSize(InstanceKlass::vtable_start_offset() * wordSize), + in_ByteSize(in_words(InstanceKlass::vtable_start_offset()) * wordSize), LLVMValue::intptr_constant(vtable_index)), "callee"); } @@ -1166,7 +1166,7 @@ Value *vtable_start = builder()->CreateAdd( builder()->CreatePtrToInt(object_klass, SharkType::intptr_type()), LLVMValue::intptr_constant( - InstanceKlass::vtable_start_offset() * HeapWordSize), + in_words(InstanceKlass::vtable_start_offset()) * HeapWordSize), "vtable_start"); Value *vtable_length = builder()->CreateValueOfStructEntry( # HG changeset patch # User mgerdin # Date 1452692647 -3600 # Wed Jan 13 14:44:07 2016 +0100 # Node ID ccb8c5316d9f2e11b8cd3d5ebb453df98b2366ac # Parent 167f5e78ddf61d3e892a4c11d21a7b1d8f543b5f imported patch vtable_start_bytes diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -898,10 +898,10 @@ "caller must use same register for non-constant itable index as for method"); // Compute start of first itableOffsetEntry (which is at the end of the vtable) - int vtable_base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; + int vtable_base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); int itentry_off = itableMethodEntry::method_offset_in_bytes(); int scan_step = itableOffsetEntry::size() * wordSize; - int vte_size = vtableEntry::size() * wordSize; + int vte_size = vtableEntry::size_in_bytes(); assert(vte_size == wordSize, "else adjust times_vte_scale"); ldrw(scan_temp, Address(recv_klass, in_bytes(InstanceKlass::vtable_length_offset()))); @@ -963,7 +963,7 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass, RegisterOrConstant vtable_index, Register method_result) { - const int base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; + const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); assert(vtableEntry::size() * wordSize == 8, "adjust the scaling in the code below"); int vtable_offset_in_bytes = base + vtableEntry::method_offset_in_bytes(); diff --git a/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -1540,11 +1540,11 @@ "caller must use same register for non-constant itable index as for method"); // Compute start of first itableOffsetEntry (which is at the end of the vtable). - int vtable_base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; + int vtable_base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); int itentry_off = itableMethodEntry::method_offset_in_bytes(); int logMEsize = exact_log2(itableMethodEntry::size() * wordSize); int scan_step = itableOffsetEntry::size() * wordSize; - int log_vte_size= exact_log2(vtableEntry::size() * wordSize); + int log_vte_size= exact_log2(vtableEntry::size_in_bytes()); lwz(scan_temp, in_bytes(InstanceKlass::vtable_length_offset()), recv_klass); // %%% We should store the aligned, prescaled offset in the klassoop. @@ -1614,7 +1614,7 @@ assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg()); - const int base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; + const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); if (vtable_index.is_register()) { diff --git a/src/cpu/ppc/vm/ppc.ad b/src/cpu/ppc/vm/ppc.ad --- a/src/cpu/ppc/vm/ppc.ad +++ b/src/cpu/ppc/vm/ppc.ad @@ -3635,8 +3635,8 @@ __ load_klass(R11_scratch1, R3); - int entry_offset = in_words(InstanceKlass::vtable_start_offset()) + _vtable_index * vtableEntry::size(); - int v_off = entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + _vtable_index * vtableEntry::size_in_bytes(); + int v_off = entry_offset + vtableEntry::method_offset_in_bytes(); __ li(R19_method, v_off); __ ldx(R19_method/*method oop*/, R19_method/*method offset*/, R11_scratch1/*class*/); // NOTE: for vtable dispatches, the vtable entry will never be diff --git a/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/src/cpu/ppc/vm/templateTable_ppc_64.cpp --- a/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -3286,9 +3286,9 @@ const Register Rtarget_method = Rindex; // Get target method & entry point. - const int base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; + const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); // Calc vtable addr scale the vtable index by 8. - __ sldi(Rindex, Rindex, exact_log2(vtableEntry::size() * wordSize)); + __ sldi(Rindex, Rindex, exact_log2(vtableEntry::size_in_bytes())); // Load target. __ addi(Rrecv_klass, Rrecv_klass, base + vtableEntry::method_offset_in_bytes()); __ ldx(Rtarget_method, Rindex, Rrecv_klass); diff --git a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp --- a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp +++ b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp @@ -79,7 +79,7 @@ __ load_klass_with_trap_null_check(rcvr_klass, R3); // Set method (in case of interpreted method), and destination address. - int entry_offset = in_words(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size(); + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + vtable_index*vtableEntry::size_in_bytes(); #ifndef PRODUCT if (DebugVtables) { @@ -95,7 +95,7 @@ } #endif - int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes(); + int v_off = entry_offset + vtableEntry::method_offset_in_bytes(); __ ld(R19_method, v_off, rcvr_klass); @@ -162,12 +162,12 @@ BLOCK_COMMENT("Load start of itable entries into itable_entry."); __ lwz(vtable_len, in_bytes(InstanceKlass::vtable_length_offset()), rcvr_klass); - __ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size() * wordSize)); + __ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size_in_bytes())); __ add(itable_entry_addr, vtable_len, rcvr_klass); // Loop over all itable entries until desired interfaceOop(Rinterface) found. BLOCK_COMMENT("Increment itable_entry_addr in loop."); - const int vtable_base_offset = in_words(InstanceKlass::vtable_start_offset()) * wordSize; + const int vtable_base_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()); __ addi(itable_entry_addr, itable_entry_addr, vtable_base_offset + itableOffsetEntry::interface_offset_in_bytes()); const int itable_offset_search_inc = itableOffsetEntry::size() * wordSize; diff --git a/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -2202,9 +2202,9 @@ } // Compute start of first itableOffsetEntry (which is at the end of the vtable) - int vtable_base = in_words(InstanceKlass::vtable_start_offset()) * wordSize; + int vtable_base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); int scan_step = itableOffsetEntry::size() * wordSize; - int vte_size = vtableEntry::size() * wordSize; + int vte_size = vtableEntry::size_in_bytes(); lduw(recv_klass, in_bytes(InstanceKlass::vtable_length_offset()), scan_temp); // %%% We should store the aligned, prescaled offset in the klassoop. @@ -2294,16 +2294,16 @@ Register method_result) { assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg()); Register sethi_temp = method_result; - const int base = (in_words(InstanceKlass::vtable_start_offset()) * wordSize + - // method pointer offset within the vtable entry: - vtableEntry::method_offset_in_bytes()); + const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + + // method pointer offset within the vtable entry: + vtableEntry::method_offset_in_bytes(); RegisterOrConstant vtable_offset = vtable_index; // Each of the following three lines potentially generates an instruction. // But the total number of address formation instructions will always be // at most two, and will often be zero. In any case, it will be optimal. // If vtable_index is a register, we will have (sll_ptr N,x; inc_ptr B,x; ld_ptr k,x). // If vtable_index is a constant, we will have at most (set B+X<vtable_index() * vtableEntry::size(); - int vtable_offset = entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + x->vtable_index() * vtableEntry::size_in_bytes(); + int vtable_offset = entry_offset + vtableEntry::method_offset_in_bytes(); __ call_virtual(target, receiver, result_register, vtable_offset, arg_list, info); } break; diff --git a/src/share/vm/oops/instanceKlass.hpp b/src/share/vm/oops/instanceKlass.hpp --- a/src/share/vm/oops/instanceKlass.hpp +++ b/src/share/vm/oops/instanceKlass.hpp @@ -954,7 +954,7 @@ static ByteSize vtable_start_offset_bytes() { return in_ByteSize(header_size() * wordSize); } static ByteSize vtable_length_offset() { return byte_offset_of(InstanceKlass, _vtable_len); } - intptr_t* start_of_vtable() const { return ((intptr_t*)this) + in_words(vtable_start_offset()); } + intptr_t* start_of_vtable() const { return (intptr_t*) ((address)this + in_bytes(vtable_start_offset_bytes())); } intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; } diff --git a/src/share/vm/oops/klassVtable.hpp b/src/share/vm/oops/klassVtable.hpp --- a/src/share/vm/oops/klassVtable.hpp +++ b/src/share/vm/oops/klassVtable.hpp @@ -172,6 +172,9 @@ static int size() { return sizeof(vtableEntry) / sizeof(HeapWord); } + static int size_in_bytes() { + return sizeof(vtableEntry); + } static int method_offset_in_bytes() { return offset_of(vtableEntry, _method); } Method* method() const { return _method; } diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp --- a/src/share/vm/opto/library_call.cpp +++ b/src/share/vm/opto/library_call.cpp @@ -4048,8 +4048,8 @@ assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, "bad index %d", vtable_index); // Get the Method* out of the appropriate vtable entry. - int entry_offset = (in_words(InstanceKlass::vtable_start_offset()) + - vtable_index*vtableEntry::size()) * wordSize + + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + + vtable_index*vtableEntry::size_in_bytes() + vtableEntry::method_offset_in_bytes(); Node* entry_addr = basic_plus_adr(obj_klass, entry_offset); Node* target_call = make_load(NULL, entry_addr, TypePtr::NOTNULL, T_ADDRESS, MemNode::unordered); diff --git a/src/share/vm/shark/sharkTopLevelBlock.cpp b/src/share/vm/shark/sharkTopLevelBlock.cpp --- a/src/share/vm/shark/sharkTopLevelBlock.cpp +++ b/src/share/vm/shark/sharkTopLevelBlock.cpp @@ -1143,8 +1143,8 @@ builder()->CreateArrayAddress( klass, SharkType::Method_type(), - vtableEntry::size() * wordSize, - in_ByteSize(in_words(InstanceKlass::vtable_start_offset()) * wordSize), + vtableEntry::size_in_bytes(), + InstanceKlass::vtable_start_offset_bytes(), LLVMValue::intptr_constant(vtable_index)), "callee"); } @@ -1166,7 +1166,7 @@ Value *vtable_start = builder()->CreateAdd( builder()->CreatePtrToInt(object_klass, SharkType::intptr_type()), LLVMValue::intptr_constant( - in_words(InstanceKlass::vtable_start_offset()) * HeapWordSize), + in_bytes(InstanceKlass::vtable_start_offset_bytes())), "vtable_start"); Value *vtable_length = builder()->CreateValueOfStructEntry( @@ -1182,7 +1182,7 @@ vtable_start, builder()->CreateShl( vtable_length, - LLVMValue::intptr_constant(exact_log2(vtableEntry::size() * wordSize))), + LLVMValue::intptr_constant(exact_log2(vtableEntry::size_in_bytes()))), needs_aligning ? "" : "itable_start"); if (needs_aligning) { itable_start = builder()->CreateAnd( # HG changeset patch # User mgerdin # Date 1452788024 -3600 # Thu Jan 14 17:13:44 2016 +0100 # Node ID 7af2e7c4bd7adcc6a7a04f7fe068e08b962e2563 # Parent ccb8c5316d9f2e11b8cd3d5ebb453df98b2366ac [mq]: vtableentry diff --git a/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -2216,7 +2216,7 @@ // hoist first instruction of round_to(scan_temp, BytesPerLong): itb_offset += round_to_unit - wordSize; } - int itb_scale = exact_log2(vtableEntry::size() * wordSize); + int itb_scale = exact_log2(vtableEntry::size_in_bytes()); sll(scan_temp, itb_scale, scan_temp); add(scan_temp, itb_offset, scan_temp); if (round_to_unit != 0) { # HG changeset patch # User mgerdin # Date 1452788046 -3600 # Thu Jan 14 17:14:06 2016 +0100 # Node ID 1d78aa11587365b806f52d9450353b6ffd4c4424 # Parent 7af2e7c4bd7adcc6a7a04f7fe068e08b962e2563 [mq]: vtable_use_bytesize_addressing diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -904,7 +904,7 @@ int vte_size = vtableEntry::size_in_bytes(); assert(vte_size == wordSize, "else adjust times_vte_scale"); - ldrw(scan_temp, Address(recv_klass, in_bytes(InstanceKlass::vtable_length_offset()))); + ldrw(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset())); // %%% Could store the aligned, prescaled offset in the klassoop. // lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base)); diff --git a/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp b/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp --- a/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp +++ b/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp @@ -73,7 +73,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ ldrw(rscratch1, Address(r19, in_bytes(InstanceKlass::vtable_length_offset()))); + __ ldrw(rscratch1, Address(r19, InstanceKlass::vtable_length_offset())); __ cmpw(rscratch1, vtable_index * vtableEntry::size()); __ br(Assembler::GT, L); __ enter(); diff --git a/src/cpu/x86/vm/macroAssembler_x86.cpp b/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -6046,7 +6046,7 @@ Address::ScaleFactor times_vte_scale = Address::times_ptr; assert(vte_size == wordSize, "else adjust times_vte_scale"); - movl(scan_temp, Address(recv_klass, in_bytes(InstanceKlass::vtable_length_offset()))); + movl(scan_temp, Address(recv_klass, InstanceKlass::vtable_length_offset())); // %%% Could store the aligned, prescaled offset in the klassoop. lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base)); diff --git a/src/cpu/x86/vm/vtableStubs_x86_32.cpp b/src/cpu/x86/vm/vtableStubs_x86_32.cpp --- a/src/cpu/x86/vm/vtableStubs_x86_32.cpp +++ b/src/cpu/x86/vm/vtableStubs_x86_32.cpp @@ -85,7 +85,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ cmpl(Address(rax, in_bytes(InstanceKlass::vtable_length_offset())), vtable_index*vtableEntry::size()); + __ cmpl(Address(rax, InstanceKlass::vtable_length_offset()), vtable_index*vtableEntry::size()); __ jcc(Assembler::greater, L); __ movl(rbx, vtable_index); __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), rcx, rbx); diff --git a/src/cpu/x86/vm/vtableStubs_x86_64.cpp b/src/cpu/x86/vm/vtableStubs_x86_64.cpp --- a/src/cpu/x86/vm/vtableStubs_x86_64.cpp +++ b/src/cpu/x86/vm/vtableStubs_x86_64.cpp @@ -77,7 +77,7 @@ if (DebugVtables) { Label L; // check offset vs vtable length - __ cmpl(Address(rax, in_bytes(InstanceKlass::vtable_length_offset())), + __ cmpl(Address(rax, InstanceKlass::vtable_length_offset()), vtable_index * vtableEntry::size()); __ jcc(Assembler::greater, L); __ movl(rbx, vtable_index); # HG changeset patch # User mgerdin # Date 1452789438 -3600 # Thu Jan 14 17:37:18 2016 +0100 # Node ID 28d471c480749bde69e908d7f130e89fac116447 # Parent 1d78aa11587365b806f52d9450353b6ffd4c4424 [mq]: vtable_start_offset_remove_suffix diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -898,7 +898,7 @@ "caller must use same register for non-constant itable index as for method"); // Compute start of first itableOffsetEntry (which is at the end of the vtable) - int vtable_base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + int vtable_base = in_bytes(InstanceKlass::vtable_start_offset()); int itentry_off = itableMethodEntry::method_offset_in_bytes(); int scan_step = itableOffsetEntry::size() * wordSize; int vte_size = vtableEntry::size_in_bytes(); @@ -963,7 +963,7 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass, RegisterOrConstant vtable_index, Register method_result) { - const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + const int base = in_bytes(InstanceKlass::vtable_start_offset()); assert(vtableEntry::size() * wordSize == 8, "adjust the scaling in the code below"); int vtable_offset_in_bytes = base + vtableEntry::method_offset_in_bytes(); diff --git a/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -1540,7 +1540,7 @@ "caller must use same register for non-constant itable index as for method"); // Compute start of first itableOffsetEntry (which is at the end of the vtable). - int vtable_base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + int vtable_base = in_bytes(InstanceKlass::vtable_start_offset()); int itentry_off = itableMethodEntry::method_offset_in_bytes(); int logMEsize = exact_log2(itableMethodEntry::size() * wordSize); int scan_step = itableOffsetEntry::size() * wordSize; @@ -1614,7 +1614,7 @@ assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg()); - const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + const int base = in_bytes(InstanceKlass::vtable_start_offset()); assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); if (vtable_index.is_register()) { diff --git a/src/cpu/ppc/vm/ppc.ad b/src/cpu/ppc/vm/ppc.ad --- a/src/cpu/ppc/vm/ppc.ad +++ b/src/cpu/ppc/vm/ppc.ad @@ -3635,7 +3635,7 @@ __ load_klass(R11_scratch1, R3); - int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + _vtable_index * vtableEntry::size_in_bytes(); + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset()) + _vtable_index * vtableEntry::size_in_bytes(); int v_off = entry_offset + vtableEntry::method_offset_in_bytes(); __ li(R19_method, v_off); __ ldx(R19_method/*method oop*/, R19_method/*method offset*/, R11_scratch1/*class*/); diff --git a/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/src/cpu/ppc/vm/templateTable_ppc_64.cpp --- a/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -3286,7 +3286,7 @@ const Register Rtarget_method = Rindex; // Get target method & entry point. - const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + const int base = in_bytes(InstanceKlass::vtable_start_offset()); // Calc vtable addr scale the vtable index by 8. __ sldi(Rindex, Rindex, exact_log2(vtableEntry::size_in_bytes())); // Load target. diff --git a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp --- a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp +++ b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp @@ -79,7 +79,7 @@ __ load_klass_with_trap_null_check(rcvr_klass, R3); // Set method (in case of interpreted method), and destination address. - int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + vtable_index*vtableEntry::size_in_bytes(); + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes(); #ifndef PRODUCT if (DebugVtables) { @@ -167,7 +167,7 @@ // Loop over all itable entries until desired interfaceOop(Rinterface) found. BLOCK_COMMENT("Increment itable_entry_addr in loop."); - const int vtable_base_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + const int vtable_base_offset = in_bytes(InstanceKlass::vtable_start_offset()); __ addi(itable_entry_addr, itable_entry_addr, vtable_base_offset + itableOffsetEntry::interface_offset_in_bytes()); const int itable_offset_search_inc = itableOffsetEntry::size() * wordSize; diff --git a/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -2202,7 +2202,7 @@ } // Compute start of first itableOffsetEntry (which is at the end of the vtable) - int vtable_base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + int vtable_base = in_bytes(InstanceKlass::vtable_start_offset()); int scan_step = itableOffsetEntry::size() * wordSize; int vte_size = vtableEntry::size_in_bytes(); @@ -2294,7 +2294,7 @@ Register method_result) { assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg()); Register sethi_temp = method_result; - const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + + const int base = in_bytes(InstanceKlass::vtable_start_offset()) + // method pointer offset within the vtable entry: vtableEntry::method_offset_in_bytes(); RegisterOrConstant vtable_offset = vtable_index; diff --git a/src/cpu/sparc/vm/sparc.ad b/src/cpu/sparc/vm/sparc.ad --- a/src/cpu/sparc/vm/sparc.ad +++ b/src/cpu/sparc/vm/sparc.ad @@ -601,7 +601,7 @@ NativeCall::instruction_size); // sethi; setlo; call; delay slot } else { assert(!UseInlineCaches, "expect vtable calls only if not using ICs"); - int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + vtable_index*vtableEntry::size_in_bytes(); + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes(); int v_off = entry_offset + vtableEntry::method_offset_in_bytes(); int klass_load_size; if (UseCompressedClassPointers) { @@ -2658,7 +2658,7 @@ } else { klass_load_size = 1*BytesPerInstWord; } - int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + vtable_index*vtableEntry::size_in_bytes(); + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes(); int v_off = entry_offset + vtableEntry::method_offset_in_bytes(); if (Assembler::is_simm13(v_off)) { __ ld_ptr(G3, v_off, G5_method); diff --git a/src/cpu/sparc/vm/templateTable_sparc.cpp b/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -3153,7 +3153,7 @@ // // compute start of first itableOffsetEntry (which is at end of vtable) - const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + const int base = in_bytes(InstanceKlass::vtable_start_offset()); Label search; Register Rtemp = O1_flags; diff --git a/src/cpu/x86/vm/macroAssembler_x86.cpp b/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -6039,7 +6039,7 @@ "caller must use same register for non-constant itable index as for method"); // Compute start of first itableOffsetEntry (which is at the end of the vtable) - int vtable_base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + int vtable_base = in_bytes(InstanceKlass::vtable_start_offset()); int itentry_off = itableMethodEntry::method_offset_in_bytes(); int scan_step = itableOffsetEntry::size() * wordSize; int vte_size = vtableEntry::size_in_bytes(); @@ -6102,7 +6102,7 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass, RegisterOrConstant vtable_index, Register method_result) { - const int base = in_bytes(InstanceKlass::vtable_start_offset_bytes()); + const int base = in_bytes(InstanceKlass::vtable_start_offset()); assert(vtableEntry::size() * wordSize == wordSize, "else adjust the scaling in the code below"); Address vtable_entry_addr(recv_klass, vtable_index, Address::times_ptr, diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2972,7 +2972,7 @@ SharedRuntime::get_resolve_virtual_call_stub(), arg_list, info); } else { - int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + x->vtable_index() * vtableEntry::size_in_bytes(); + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset()) + x->vtable_index() * vtableEntry::size_in_bytes(); int vtable_offset = entry_offset + vtableEntry::method_offset_in_bytes(); __ call_virtual(target, receiver, result_register, vtable_offset, arg_list, info); } diff --git a/src/share/vm/oops/instanceKlass.hpp b/src/share/vm/oops/instanceKlass.hpp --- a/src/share/vm/oops/instanceKlass.hpp +++ b/src/share/vm/oops/instanceKlass.hpp @@ -950,11 +950,10 @@ virtual void collect_statistics(KlassSizeStats *sz) const; #endif - static WordSize vtable_start_offset() { return in_WordSize(header_size()); } - static ByteSize vtable_start_offset_bytes() { return in_ByteSize(header_size() * wordSize); } + static ByteSize vtable_start_offset() { return in_ByteSize(header_size() * wordSize); } static ByteSize vtable_length_offset() { return byte_offset_of(InstanceKlass, _vtable_len); } - intptr_t* start_of_vtable() const { return (intptr_t*) ((address)this + in_bytes(vtable_start_offset_bytes())); } + intptr_t* start_of_vtable() const { return (intptr_t*) ((address)this + in_bytes(vtable_start_offset())); } intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; } diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp --- a/src/share/vm/opto/library_call.cpp +++ b/src/share/vm/opto/library_call.cpp @@ -4048,7 +4048,7 @@ assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, "bad index %d", vtable_index); // Get the Method* out of the appropriate vtable entry. - int entry_offset = in_bytes(InstanceKlass::vtable_start_offset_bytes()) + + int entry_offset = in_bytes(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes() + vtableEntry::method_offset_in_bytes(); Node* entry_addr = basic_plus_adr(obj_klass, entry_offset); diff --git a/src/share/vm/shark/sharkTopLevelBlock.cpp b/src/share/vm/shark/sharkTopLevelBlock.cpp --- a/src/share/vm/shark/sharkTopLevelBlock.cpp +++ b/src/share/vm/shark/sharkTopLevelBlock.cpp @@ -1144,7 +1144,7 @@ klass, SharkType::Method_type(), vtableEntry::size_in_bytes(), - InstanceKlass::vtable_start_offset_bytes(), + InstanceKlass::vtable_start_offset(), LLVMValue::intptr_constant(vtable_index)), "callee"); } @@ -1166,7 +1166,7 @@ Value *vtable_start = builder()->CreateAdd( builder()->CreatePtrToInt(object_klass, SharkType::intptr_type()), LLVMValue::intptr_constant( - in_bytes(InstanceKlass::vtable_start_offset_bytes())), + in_bytes(InstanceKlass::vtable_start_offset())), "vtable_start"); Value *vtable_length = builder()->CreateValueOfStructEntry(