From 2ee377112599facd0571e168660182331c486004 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 26 Mar 2012 18:06:16 -0600 Subject: [PATCH] make find[Field|Method]InClass non-inline functions It seems that GCC 4.6.1 gets confused at LTO time when we take the address of inline functions, so I'm switching them to non-inline linkage to make it happy. --- src/machine.cpp | 68 +++++++++++++++++++++++++++++-------------------- src/machine.h | 19 +++----------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index 182308f8d4..744d6d2a46 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -2416,6 +2416,38 @@ isInitializing(Thread* t, object c) return false; } +object +findInTable(Thread* t, object table, object name, object spec, + object& (*getName)(Thread*, object), + object& (*getSpec)(Thread*, object)) +{ + if (table) { + for (unsigned i = 0; i < arrayLength(t, table); ++i) { + object o = arrayBody(t, table, i); + if (vm::strcmp(&byteArrayBody(t, getName(t, o), 0), + &byteArrayBody(t, name, 0)) == 0 and + vm::strcmp(&byteArrayBody(t, getSpec(t, o), 0), + &byteArrayBody(t, spec, 0)) == 0) + { + return o; + } + } + +// fprintf(stderr, "%s %s not in\n", +// &byteArrayBody(t, name, 0), +// &byteArrayBody(t, spec, 0)); + +// for (unsigned i = 0; i < arrayLength(t, table); ++i) { +// object o = arrayBody(t, table, i); +// fprintf(stderr, "\t%s %s\n", +// &byteArrayBody(t, getName(t, o), 0), +// &byteArrayBody(t, getSpec(t, o), 0)); +// } + } + + return 0; +} + } // namespace namespace vm { @@ -3884,35 +3916,17 @@ makeObjectArray(Thread* t, object elementClass, unsigned count) } object -findInTable(Thread* t, object table, object name, object spec, - object& (*getName)(Thread*, object), - object& (*getSpec)(Thread*, object)) +findFieldInClass(Thread* t, object class_, object name, object spec) { - if (table) { - for (unsigned i = 0; i < arrayLength(t, table); ++i) { - object o = arrayBody(t, table, i); - if (vm::strcmp(&byteArrayBody(t, getName(t, o), 0), - &byteArrayBody(t, name, 0)) == 0 and - vm::strcmp(&byteArrayBody(t, getSpec(t, o), 0), - &byteArrayBody(t, spec, 0)) == 0) - { - return o; - } - } + return findInTable + (t, classFieldTable(t, class_), name, spec, fieldName, fieldSpec); +} -// fprintf(stderr, "%s %s not in\n", -// &byteArrayBody(t, name, 0), -// &byteArrayBody(t, spec, 0)); - -// for (unsigned i = 0; i < arrayLength(t, table); ++i) { -// object o = arrayBody(t, table, i); -// fprintf(stderr, "\t%s %s\n", -// &byteArrayBody(t, getName(t, o), 0), -// &byteArrayBody(t, getSpec(t, o), 0)); -// } - } - - return 0; +object +findMethodInClass(Thread* t, object class_, object name, object spec) +{ + return findInTable + (t, classMethodTable(t, class_), name, spec, methodName, methodSpec); } object diff --git a/src/machine.h b/src/machine.h index 08884e40d0..cdb3ecf039 100644 --- a/src/machine.h +++ b/src/machine.h @@ -2595,16 +2595,7 @@ makeObjectArray(Thread* t, unsigned count) } object -findInTable(Thread* t, object table, object name, object spec, - object& (*getName)(Thread*, object), - object& (*getSpec)(Thread*, object)); - -inline object -findFieldInClass(Thread* t, object class_, object name, object spec) -{ - return findInTable - (t, classFieldTable(t, class_), name, spec, fieldName, fieldSpec); -} +findFieldInClass(Thread* t, object class_, object name, object spec); inline object findFieldInClass2(Thread* t, object class_, const char* name, const char* spec) @@ -2616,12 +2607,8 @@ findFieldInClass2(Thread* t, object class_, const char* name, const char* spec) return findFieldInClass(t, class_, n, s); } -inline object -findMethodInClass(Thread* t, object class_, object name, object spec) -{ - return findInTable - (t, classMethodTable(t, class_), name, spec, methodName, methodSpec); -} +object +findMethodInClass(Thread* t, object class_, object name, object spec); inline object makeThrowable