From c02bfc57a5c853af88a71eb6e4ac691f824092cc Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 18 Jan 2011 08:35:52 -0700 Subject: [PATCH] resolve primitive array classes when generating boot image This is necessary to accomodate classes loaded at runtime which refer to primitive array types. Otherwise, they won't be included unless classes in the bootimage refer to them. --- src/bootimage.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/bootimage.cpp b/src/bootimage.cpp index 252028dd79..13907b6b01 100644 --- a/src/bootimage.cpp +++ b/src/bootimage.cpp @@ -411,6 +411,41 @@ writeBootImage(Thread* t, FILE* out, BootImage* image, uint8_t* code, set(t, type(t, Machine::JdoubleType), ClassName, name); } + // resolve primitive array classes in case they are needed at + // runtime: + { resolveSystemClass + (t, root(t, Machine::BootLoader), makeByteArray(t, "[B"), true); + if (t->exception) return; + + resolveSystemClass + (t, root(t, Machine::BootLoader), makeByteArray(t, "[Z"), true); + if (t->exception) return; + + resolveSystemClass + (t, root(t, Machine::BootLoader), makeByteArray(t, "[S"), true); + if (t->exception) return; + + resolveSystemClass + (t, root(t, Machine::BootLoader), makeByteArray(t, "[C"), true); + if (t->exception) return; + + resolveSystemClass + (t, root(t, Machine::BootLoader), makeByteArray(t, "[I"), true); + if (t->exception) return; + + resolveSystemClass + (t, root(t, Machine::BootLoader), makeByteArray(t, "[J"), true); + if (t->exception) return; + + resolveSystemClass + (t, root(t, Machine::BootLoader), makeByteArray(t, "[F"), true); + if (t->exception) return; + + resolveSystemClass + (t, root(t, Machine::BootLoader), makeByteArray(t, "[D"), true); + if (t->exception) return; + } + collect(t, Heap::MajorCollection); uintptr_t* heap = static_cast