From 6a20d0289ca9578dd52cf8c09c3a98d3fec06b1d Mon Sep 17 00:00:00 2001 From: Matt Weaver Date: Fri, 2 Mar 2012 16:00:08 -0700 Subject: [PATCH 1/4] switching to armv7 --- makefile | 2 +- src/binaryToObject/mach-o.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index 147bb6f3de..08287d14f9 100755 --- a/makefile +++ b/makefile @@ -321,7 +321,7 @@ ifeq ($(platform),darwin) ifeq ($(build-arch),powerpc) converter-cflags += -DOPPOSITE_ENDIAN endif - flags = -arch armv6 -isysroot \ + flags = -arch armv7 -isysroot \ /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/ openjdk-extra-cflags += $(flags) cflags += $(flags) diff --git a/src/binaryToObject/mach-o.cpp b/src/binaryToObject/mach-o.cpp index fefde4a467..2b750a1ba1 100644 --- a/src/binaryToObject/mach-o.cpp +++ b/src/binaryToObject/mach-o.cpp @@ -38,7 +38,7 @@ #define CPU_SUBTYPE_I386_ALL 3 #define CPU_SUBTYPE_X86_64_ALL CPU_SUBTYPE_I386_ALL #define CPU_SUBTYPE_POWERPC_ALL 0 -#define CPU_SUBTYPE_ARM_V6 6 +#define CPU_SUBTYPE_ARM_V7 7 #if (BITS_PER_WORD == 64) # define Magic MH_MAGIC_64 @@ -321,7 +321,7 @@ MAKE_NAME(writeMachO, BITS_PER_WORD, Object) cpuSubType = CPU_SUBTYPE_POWERPC_ALL; } else if (strcmp(architecture, "arm") == 0) { cpuType = CPU_TYPE_ARM; - cpuSubType = CPU_SUBTYPE_ARM_V6; + cpuSubType = CPU_SUBTYPE_ARM_V7; } else { fprintf(stderr, "unsupported architecture: %s\n", architecture); return false; From a7157199f3893a296b202194e88cc37b93ce9c7a Mon Sep 17 00:00:00 2001 From: Matt Weaver Date: Fri, 2 Mar 2012 16:06:22 -0700 Subject: [PATCH 2/4] armv7 is actually 9 --- src/binaryToObject/mach-o.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/binaryToObject/mach-o.cpp b/src/binaryToObject/mach-o.cpp index 2b750a1ba1..8b37e85aaf 100644 --- a/src/binaryToObject/mach-o.cpp +++ b/src/binaryToObject/mach-o.cpp @@ -38,7 +38,7 @@ #define CPU_SUBTYPE_I386_ALL 3 #define CPU_SUBTYPE_X86_64_ALL CPU_SUBTYPE_I386_ALL #define CPU_SUBTYPE_POWERPC_ALL 0 -#define CPU_SUBTYPE_ARM_V7 7 +#define CPU_SUBTYPE_ARM_V7 9 #if (BITS_PER_WORD == 64) # define Magic MH_MAGIC_64 From 1d77b0654082f61cfe4577cbcfed030541036913 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sat, 3 Mar 2012 18:37:27 -0700 Subject: [PATCH 3/4] fix recent throwNew/makeThrowable regression 6fceca9 introduced a string formatting regression in these methods, which this commit fixes. --- src/machine.cpp | 6 +++--- src/machine.h | 51 +++++++++++++++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index 65213cd637..47b53dccbf 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -3058,7 +3058,7 @@ popResources(Thread* t) } object -makeByteArray(Thread* t, const char* format, va_list a, int size) +makeByteArrayV(Thread* t, const char* format, va_list a, int size) { THREAD_RUNTIME_ARRAY(t, char, buffer, size); @@ -3080,7 +3080,7 @@ makeByteArray(Thread* t, const char* format, ...) while (true) { va_list a; va_start(a, format); - object s = makeByteArray(t, format, a, size); + object s = makeByteArrayV(t, format, a, size); va_end(a); if (s) { @@ -3098,7 +3098,7 @@ makeString(Thread* t, const char* format, ...) while (true) { va_list a; va_start(a, format); - object s = makeByteArray(t, format, a, size); + object s = makeByteArrayV(t, format, a, size); va_end(a); if (s) { diff --git a/src/machine.h b/src/machine.h index 44b239c690..a52cf30a73 100644 --- a/src/machine.h +++ b/src/machine.h @@ -2216,7 +2216,7 @@ make(Thread* t, object class_) } object -makeByteArray(Thread* t, const char* format, va_list a, int size); +makeByteArrayV(Thread* t, const char* format, va_list a, int size); object makeByteArray(Thread* t, const char* format, ...); @@ -2642,25 +2642,37 @@ makeThrowable } inline object -makeThrowable(Thread* t, Machine::Type type, const char* format, va_list a) +makeThrowableV(Thread* t, Machine::Type type, const char* format, va_list a, + int size) { - object s = makeByteArray(t, format, a); + object s = makeByteArrayV(t, format, a, size); - object message = t->m->classpath->makeString - (t, s, 0, byteArrayLength(t, s) - 1); + if (s) { + object message = t->m->classpath->makeString + (t, s, 0, byteArrayLength(t, s) - 1); - return makeThrowable(t, type, message); + return makeThrowable(t, type, message); + } else { + return 0; + } } inline object makeThrowable(Thread* t, Machine::Type type, const char* format, ...) { - va_list a; - va_start(a, format); - object r = makeThrowable(t, type, format, a); - va_end(a); + int size = 256; + while (true) { + va_list a; + va_start(a, format); + object r = makeThrowableV(t, type, format, a, size); + va_end(a); - return r; + if (r) { + return r; + } else { + size *= 2; + } + } } void @@ -2696,12 +2708,19 @@ throwNew inline void NO_RETURN throwNew(Thread* t, Machine::Type type, const char* format, ...) { - va_list a; - va_start(a, format); - object r = makeThrowable(t, type, format, a); - va_end(a); + int size = 256; + while (true) { + va_list a; + va_start(a, format); + object r = makeThrowableV(t, type, format, a, size); + va_end(a); - throw_(t, r); + if (r) { + throw_(t, r); + } else { + size *= 2; + } + } } object From ac63d084505cd14cbb2828a3fd93207d6a7eaf1b Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sun, 4 Mar 2012 11:38:12 -0700 Subject: [PATCH 4/4] fix bootimage field offset calculation for derived classes There was a subtle bug in that we were not considering alignment padding for fields defined in superclasses when calculating field offsets for a derived class when the superclass(es) were visited by the bootimage generator before the derived class. --- src/bootimage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootimage.cpp b/src/bootimage.cpp index 28f45dd382..3d75f4401c 100644 --- a/src/bootimage.cpp +++ b/src/bootimage.cpp @@ -435,6 +435,10 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code, memberFields[memberIndex] = *f; + while (targetMemberOffset % f->targetSize) { + ++ targetMemberOffset; + } + targetMemberOffset += f->targetSize; ++ memberIndex;