Edwin Steiner
Christian Thalinger
- $Id: method.c 5974 2006-11-12 15:14:19Z edwin $
+ $Id: method.c 7228 2007-01-19 01:13:48Z edwin $
*/
#include "vm/jit/methodheader.h"
-#if !defined(NDEBUG)
-extern bool inline_debug_log;
-#define INLINELOG(code) do { if (inline_debug_log) { code } } while (0)
+#if !defined(NDEBUG) && defined(ENABLE_INLINING)
+#define INLINELOG(code) do { if (opt_inline_debug_log) { code } } while (0)
#else
#define INLINELOG(code)
#endif
}
+/* method_count_implementations ************************************************
+
+ Count the implementations of a method in a class cone (a class and all its
+ subclasses.)
+
+ IN:
+ m................the method to count
+ c................class at which to start the counting (this class and
+ all its subclasses will be searched)
+
+ OUT:
+ *found...........if found != NULL, *found receives the method
+ implementation that was found. This value is only
+ meaningful if the return value is 1.
+
+ RETURN VALUE:
+ the number of implementations found
+
+*******************************************************************************/
+
+s4 method_count_implementations(methodinfo *m, classinfo *c, methodinfo **found)
+{
+ s4 count;
+ methodinfo *mp;
+ methodinfo *mend;
+ classinfo *child;
+
+ count = 0;
+
+ mp = c->methods;
+ mend = mp + c->methodscount;
+
+ for (; mp < mend; ++mp) {
+ if (method_canoverwrite(mp, m)) {
+ if (found)
+ *found = mp;
+ count++;
+ break;
+ }
+ }
+
+ for (child = c->sub; child != NULL; child = child->nextsub) {
+ count += method_count_implementations(m, child, found);
+ }
+
+ return count;
+}
+
+
/* method_add_to_worklist ******************************************************
Add the method to the given worklist. If the method already occurs in
the worklist, the worklist remains unchanged.
- Worklist items are allocated in dump memory.
-
*******************************************************************************/
static void method_add_to_worklist(methodinfo *m, method_worklist **wl)
if (wi->m == m)
return;
- wi = DNEW(method_worklist);
+ wi = NEW(method_worklist);
wi->next = *wl;
wi->m = m;
if (m->flags & ACC_NATIVE) printf(" NATIVE");
if (m->flags & ACC_INTERFACE) printf(" INTERFACE");
if (m->flags & ACC_ABSTRACT) printf(" ABSTRACT");
+ if (m->flags & ACC_METHOD_MONOMORPHIC) printf(" (mono)");
+ if (m->flags & ACC_METHOD_IMPLEMENTED) printf(" (impl)");
}
#endif /* !defined(NDEBUG) */