[vmkit-commits] [PATCH] Don't try to emit methods from primitive classes' VT, they're bogus.

Will Dietz wdietz2 at illinois.edu
Sun Nov 6 19:04:08 PST 2011


Inlined below.

I honestly don't know why this didn't cause problems before, since we
explicitly attempt to emit the VT for primitive classes (while
precompiling) in a few places.  However, this is needed for the "emit
null for j.l.Class" patch to work, which was a bit unexpected :).

Thanks!

~Will

>From 8a795a7a5f6c69ef97407ef9582d8b8a524ba456 Mon Sep 17 00:00:00 2001
From: Will Dietz <w at wdtz.org>
Date: Sun, 6 Nov 2011 20:16:44 -0600
Subject: [PATCH 8/8] Don't try to emit methods from primitive classes' VT,
 they're bogus.

---
 lib/J3/Compiler/JavaAOTCompiler.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/J3/Compiler/JavaAOTCompiler.cpp
b/lib/J3/Compiler/JavaAOTCompiler.cpp
index 2ae8973..c4dc364 100644
--- a/lib/J3/Compiler/JavaAOTCompiler.cpp
+++ b/lib/J3/Compiler/JavaAOTCompiler.cpp
@@ -1775,7 +1775,10 @@ Constant*
JavaAOTCompiler::CreateConstantFromVT(JavaVirtualTable* VT) {
   // methods
   for (uint32 i = JavaVirtualTable::getFirstJavaMethodIndex(); i < size; ++i) {
     JavaMethod* meth = ((JavaMethod**)RealVT)[i];
-    if (isAbstract(meth->access)) {
+    // Primitive classes don't have methods--abstract or otherwise.
+    // (But we do have placeholders for j.l.Object methods in their VTs,
+    // so just emit NULL's here)
+    if (isAbstract(meth->access) || classDef->isPrimitive()) {
       Elemts.push_back(Constant::getNullValue(PTy));
     } else {
       Function* F = getMethodOrStub(meth, maybeCustomize);
-- 
1.7.5.1



More information about the vmkit-commits mailing list