Mercurial > hg > graal-jvmci-8
changeset 23728:995af926c06b
Fixed vtable size computation in HotSpotVMConfig and add test
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Fri, 15 Jul 2016 09:38:27 -0700 |
parents | f692440ebf9d |
children | fec2e64c06a8 |
files | jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java |
diffstat | 2 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Mon Jul 11 12:11:36 2016 +0000 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Fri Jul 15 09:38:27 2016 -0700 @@ -218,7 +218,7 @@ 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");
--- a/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java Mon Jul 11 12:11:36 2016 +0000 +++ b/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java Fri Jul 15 09:38:27 2016 -0700 @@ -402,6 +402,25 @@ 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()) {