mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-25 13:04:05 +00:00
8161603: [JVMCI] HotSpotVMConfig.baseVtableLength is incorrectly computed
Reviewed-by: kvn
This commit is contained in:
parent
913ccd67d4
commit
e26d43a2a3
@ -252,7 +252,7 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess {
|
||||
final int universeBaseVtableSize = getFieldValue("CompilerToVM::Data::Universe_base_vtable_size", Integer.class, "int");
|
||||
|
||||
final int baseVtableLength() {
|
||||
return universeBaseVtableSize / vtableEntrySize;
|
||||
return universeBaseVtableSize / (vtableEntrySize / heapWordSize);
|
||||
}
|
||||
|
||||
final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int");
|
||||
|
||||
@ -422,6 +422,25 @@ public class TestResolvedJavaMethod extends MethodUniverse {
|
||||
assertFalse(ResolvedJavaMethod.isSignaturePolymorphic(metaAccess.lookupJavaType(Object.class), "toString", metaAccess));
|
||||
}
|
||||
|
||||
/**
|
||||
* All public non-final methods should be available in the vtable.
|
||||
*/
|
||||
@Test
|
||||
public void testVirtualMethodTableAccess() {
|
||||
for (Class<?> c : classes) {
|
||||
if (c.isPrimitive() || c.isInterface()) {
|
||||
continue;
|
||||
}
|
||||
ResolvedJavaType receiverType = metaAccess.lookupJavaType(c);
|
||||
for (Method m : c.getMethods()) {
|
||||
ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
|
||||
if (!method.isStatic() && !method.isFinal() && !method.getDeclaringClass().isLeaf() && !method.getDeclaringClass().isInterface()) {
|
||||
assertTrue(method + " not available in " + receiverType, method.isInVirtualMethodTable(receiverType));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Method findTestMethod(Method apiMethod) {
|
||||
String testName = apiMethod.getName() + "Test";
|
||||
for (Method m : getClass().getDeclaredMethods()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user