8161603: [JVMCI] HotSpotVMConfig.baseVtableLength is incorrectly computed

Reviewed-by: kvn
This commit is contained in:
Tom Rodriguez 2016-07-19 18:17:40 -07:00
parent 913ccd67d4
commit e26d43a2a3
2 changed files with 20 additions and 1 deletions

View File

@ -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");

View File

@ -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()) {