diff options
Diffstat (limited to 'libjava/java/lang/natClass.cc')
-rw-r--r-- | libjava/java/lang/natClass.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc index 419ed7d..3ceda11 100644 --- a/libjava/java/lang/natClass.cc +++ b/libjava/java/lang/natClass.cc @@ -790,6 +790,9 @@ java::lang::Class::initializeClass (void) } } + if (isInterface ()) + _Jv_LayoutInterfaceMethods (this); + _Jv_PrepareConstantTimeTables (this); if (vtable == NULL) @@ -1787,6 +1790,20 @@ _Jv_abstractMethodError (void) throw new java::lang::AbstractMethodError(); } +// Set itable method indexes for members of interface IFACE. +void +_Jv_LayoutInterfaceMethods (jclass iface) +{ + if (! iface->isInterface()) + return; + + // itable indexes start at 1. + // FIXME: Static initalizers currently get a NULL placeholder entry in the + // itable so they are also assigned an index here. + for (int i = 0; i < iface->method_count; i++) + iface->methods[i].index = i + 1; +} + // Prepare virtual method declarations in KLASS, and any superclasses as // required, by determining their vtable index, setting method->index, and // finally setting the class's vtable_method_count. Must be called with the |