8147461: Use byte offsets for vtable start and vtable length offsets
Reviewed-by: cjplummer, coleenp, dnsimon
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -898,13 +898,13 @@
"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_bytes(InstanceKlass::vtable_start_offset());
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, InstanceKlass::vtable_length_offset() * wordSize));
+ 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));
@@ -958,7 +958,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_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();
--- a/hotspot/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -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()));
__ cmpw(rscratch1, vtable_index * vtableEntry::size());
__ br(Assembler::GT, L);
__ enter();
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2015 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -1583,13 +1583,13 @@
"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_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;
- int log_vte_size= exact_log2(vtableEntry::size() * wordSize);
-
- lwz(scan_temp, InstanceKlass::vtable_length_offset() * wordSize, recv_klass);
+ 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.
// Then the next several instructions would fold away.
@@ -1657,7 +1657,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_bytes(InstanceKlass::vtable_start_offset());
assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below");
if (vtable_index.is_register()) {
--- a/hotspot/src/cpu/ppc/vm/ppc.ad Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
// Copyright 2012, 2015 SAP AG. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
@@ -3562,8 +3562,8 @@
__ load_klass(R11_scratch1, R3);
- int entry_offset = 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()) + _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
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2013, 2015 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -3282,9 +3282,9 @@
const Register Rtarget_method = Rindex;
// Get target method & entry point.
- const int base = InstanceKlass::vtable_start_offset() * wordSize;
+ 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() * 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);
--- a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2015 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -80,14 +80,14 @@
__ load_klass(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_bytes(InstanceKlass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes();
#ifndef PRODUCT
if (DebugVtables) {
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, in_bytes(InstanceKlass::vtable_length_offset()), rcvr_klass);
__ cmpwi(CCR0, vtable_len, vtable_index*vtableEntry::size());
__ bge(CCR0, L);
__ li(R12_scratch2, vtable_index);
@@ -96,7 +96,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);
@@ -163,13 +163,13 @@
__ load_klass(rcvr_klass, R3_ARG1);
BLOCK_COMMENT("Load start of itable entries into itable_entry.");
- __ lwz(vtable_len, InstanceKlass::vtable_length_offset() * wordSize, rcvr_klass);
- __ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size() * wordSize));
+ __ lwz(vtable_len, in_bytes(InstanceKlass::vtable_length_offset()), rcvr_klass);
+ __ 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 = InstanceKlass::vtable_start_offset() * wordSize;
+ 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;
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -2188,16 +2188,16 @@
}
// 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_bytes(InstanceKlass::vtable_start_offset());
int scan_step = itableOffsetEntry::size() * wordSize;
- int vte_size = vtableEntry::size() * wordSize;
-
- lduw(recv_klass, InstanceKlass::vtable_length_offset() * wordSize, scan_temp);
+ 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.
// Then the next several instructions would fold away.
int itb_offset = vtable_base;
- 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);
add(recv_klass, scan_temp, scan_temp);
@@ -2268,16 +2268,16 @@
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 +
- // method pointer offset within the vtable entry:
- vtableEntry::method_offset_in_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;
// 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<<N,t; ld_ptr k,t).
- vtable_offset = regcon_sll_ptr(vtable_index, exact_log2(vtableEntry::size() * wordSize), vtable_offset);
+ vtable_offset = regcon_sll_ptr(vtable_index, exact_log2(vtableEntry::size_in_bytes()), vtable_offset);
vtable_offset = regcon_inc_ptr(vtable_offset, base, vtable_offset, sethi_temp);
Address vtable_entry_addr(recv_klass, ensure_simm13_or_reg(vtable_offset, sethi_temp));
ld_ptr(vtable_entry_addr, method_result);
--- a/hotspot/src/cpu/sparc/vm/sparc.ad Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
//
-// Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1998, 2016, 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
@@ -601,8 +601,8 @@
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 v_off = entry_offset*wordSize + vtableEntry::method_offset_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) {
assert(Universe::heap() != NULL, "java heap should be initialized");
@@ -2658,8 +2658,8 @@
} else {
klass_load_size = 1*BytesPerInstWord;
}
- int entry_offset = 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()) + 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);
} else {
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -3153,11 +3153,11 @@
//
// compute start of first itableOffsetEntry (which is at end of vtable)
- const int base = InstanceKlass::vtable_start_offset() * wordSize;
+ const int base = in_bytes(InstanceKlass::vtable_start_offset());
Label search;
Register Rtemp = O1_flags;
- __ ld(O2_Klass, InstanceKlass::vtable_length_offset() * wordSize, Rtemp);
+ __ ld(O2_Klass, in_bytes(InstanceKlass::vtable_length_offset()), Rtemp);
__ sll(Rtemp, LogBytesPerWord, Rtemp); // Rscratch *= 4;
if (Assembler::is_simm13(base)) {
__ add(Rtemp, base, Rtemp);
--- a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -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, 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);
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -5807,14 +5807,14 @@
"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_bytes(InstanceKlass::vtable_start_offset());
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();
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()));
// %%% Could store the aligned, prescaled offset in the klassoop.
lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base));
@@ -5865,7 +5865,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_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,
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -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()), 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);
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -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()),
vtable_index * vtableEntry::size());
__ jcc(Assembler::greater, L);
__ movl(rbx, vtable_index);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -597,7 +597,7 @@
}
HotSpotVMConfig config = config();
final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved);
- return config.instanceKlassVtableStartOffset() + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset;
+ return config.instanceKlassVtableStartOffset + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset;
}
@Override
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -1036,13 +1036,6 @@
@HotSpotVMConstant(name = "InstanceKlass::linked") @Stable public int instanceKlassStateLinked;
@HotSpotVMConstant(name = "InstanceKlass::fully_initialized") @Stable public int instanceKlassStateFullyInitialized;
- /**
- * See {@code InstanceKlass::vtable_start_offset()}.
- */
- public final int instanceKlassVtableStartOffset() {
- return instanceKlassVtableStartOffset * heapWordSize;
- }
-
@HotSpotVMType(name = "arrayOopDesc", get = HotSpotVMType.Type.SIZE) @Stable public int arrayOopDescSize;
/**
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -2972,8 +2972,8 @@
SharedRuntime::get_resolve_virtual_call_stub(),
arg_list, info);
} else {
- int entry_offset = InstanceKlass::vtable_start_offset() + 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()) + 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;
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -151,8 +151,8 @@
int CompilerToVM::Data::cardtable_shift;
void CompilerToVM::Data::initialize() {
- InstanceKlass_vtable_start_offset = InstanceKlass::vtable_start_offset();
- InstanceKlass_vtable_length_offset = InstanceKlass::vtable_length_offset() * HeapWordSize;
+ InstanceKlass_vtable_start_offset = in_bytes(InstanceKlass::vtable_start_offset());
+ InstanceKlass_vtable_length_offset = in_bytes(InstanceKlass::vtable_length_offset());
Method_extra_stack_entries = Method::extra_stack_entries();
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Wed Jan 27 14:50:56 2016 +0100
@@ -949,10 +949,10 @@
virtual void collect_statistics(KlassSizeStats *sz) const;
#endif
- static int vtable_start_offset() { return header_size(); }
- static int vtable_length_offset() { return offset_of(InstanceKlass, _vtable_len) / HeapWordSize; }
+ 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*)this) + vtable_start_offset(); }
+ 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() + vtable_length(); }
int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; }
--- a/hotspot/src/share/vm/oops/klassVtable.hpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/share/vm/oops/klassVtable.hpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -173,6 +173,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; }
--- a/hotspot/src/share/vm/opto/library_call.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/share/vm/opto/library_call.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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
@@ -3828,8 +3828,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 = (InstanceKlass::vtable_start_offset() +
- vtable_index*vtableEntry::size()) * wordSize +
+ 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);
Node* target_call = make_load(NULL, entry_addr, TypePtr::NOTNULL, T_ADDRESS, MemNode::unordered);
--- a/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Thu Jan 28 07:11:45 2016 +0100
+++ b/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Wed Jan 27 14:50:56 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -1143,8 +1143,8 @@
builder()->CreateArrayAddress(
klass,
SharkType::Method_type(),
- vtableEntry::size() * wordSize,
- in_ByteSize(InstanceKlass::vtable_start_offset() * wordSize),
+ vtableEntry::size_in_bytes(),
+ InstanceKlass::vtable_start_offset(),
LLVMValue::intptr_constant(vtable_index)),
"callee");
}
@@ -1166,12 +1166,12 @@
Value *vtable_start = builder()->CreateAdd(
builder()->CreatePtrToInt(object_klass, SharkType::intptr_type()),
LLVMValue::intptr_constant(
- InstanceKlass::vtable_start_offset() * HeapWordSize),
+ in_bytes(InstanceKlass::vtable_start_offset())),
"vtable_start");
Value *vtable_length = builder()->CreateValueOfStructEntry(
object_klass,
- in_ByteSize(InstanceKlass::vtable_length_offset() * HeapWordSize),
+ InstanceKlass::vtable_length_offset(),
SharkType::jint_type(),
"vtable_length");
vtable_length =
@@ -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(