* src/vm/vm.c (vm_call_method_intern): Removed.
[cacao.git] / src / cacaoh / headers.c
index 415161536e957d2c4b0bdeb60d5bb83a8f3cd658..fca1676476e505fab38fa23b69029df726c055c3 100644 (file)
@@ -1,9 +1,9 @@
 /* src/cacaoh/headers.c - functions for header generation
 
-   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
-   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
-   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
-   Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Reinhard Grafl
 
@@ -30,7 +30,7 @@
             Philipp Tomsich
             Christian Thalinger
 
-   $Id: headers.c 4150 2006-01-12 21:11:00Z twisti $
+   $Id: headers.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -97,19 +97,8 @@ java_objectheader *native_new_and_init_int(classinfo *c, s4 i) { return NULL; }
 java_objectheader *native_new_and_init_throwable(classinfo *c, java_lang_Throwable *t) { return NULL; }
 
 
-#if defined(ENABLE_JIT)
-java_objectheader *asm_calljavafunction(methodinfo *m,
-                                                                               void *arg1, void *arg2,
-                                                                               void *arg3, void *arg4)
-{ return NULL; }
-#endif
-
-#if defined(ENABLE_INTRP)
-java_objectheader *intrp_asm_calljavafunction(methodinfo *m,
-                                                                                         void *arg1, void *arg2,
-                                                                                         void *arg3, void *arg4)
+java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
 { return NULL; }
-#endif
 
 
 /* code patching functions */
@@ -478,8 +467,6 @@ void print_dynamic_super_statistics(void) {}
 
 /************************ global variables **********************/
 
-chain *nativemethod_chain;              /* chain with native methods          */
-chain *nativeclass_chain;               /* chain with processed classes       */
 chain *ident_chain;     /* chain with method and field names in current class */
 FILE *file = NULL;
 static u4 outputsize;
@@ -705,7 +692,14 @@ void printmethod(methodinfo *m)
 
        fprintf(file, "_");
        printID(m->name);
-       if (m->nativelyoverloaded) printOverloadPart(m->descriptor);
+
+       /* ATTENTION: We use the methodinfo's isleafmethod variable as
+          nativelyoverloaded, so we can save some space during
+          runtime. */
+
+       if (m->isleafmethod)
+               printOverloadPart(m->descriptor);
+
        fprintf(file, "(JNIEnv *env");
        
        utf_ptr = m->descriptor->text + 1;
@@ -758,13 +752,14 @@ void headerfile_generate(classinfo *c, char *opt_directory)
        char uclassname[1024];
        u2 i;
        methodinfo *m;                  
-       u2 i2;
+       u2 j;
        methodinfo *m2;
-       u2 nativelyoverloaded;                  
-                     
-       /* store class in chain */                    
-       chain_addlast(nativeclass_chain, c);
-                               
+       bool nativelyoverloaded;
+
+       /* prevent compiler warnings */
+
+       nativelyoverloaded = false;
+
        /* open headerfile for class */
        gen_header_filename(classname, c->name);
 
@@ -817,34 +812,41 @@ void headerfile_generate(classinfo *c, char *opt_directory)
        /* create method-prototypes */
                                
        /* find overloaded methods */
-       for (i = 0; i < c->methodscount; i++) {
 
+       for (i = 0; i < c->methodscount; i++) {
                m = &(c->methods[i]);
 
-               if (!(m->flags & ACC_NATIVE)) continue;
-               if (!m->nativelyoverloaded) {
-                       nativelyoverloaded=false;
-                       for (i2=i+1;i2<c->methodscount; i2++) {
-                               m2 = &(c->methods[i2]);
-                               if (!(m2->flags & ACC_NATIVE)) continue;
-                               if (m->name==m2->name) {
-                                       m2->nativelyoverloaded=true;
-                                       nativelyoverloaded=true;
+               if (!(m->flags & ACC_NATIVE))
+                       continue;
+
+               /* We use the methodinfo's isleafmethod variable as
+                  nativelyoverloaded, so we can save some space during
+                  runtime. */
+
+               if (!m->isleafmethod) {
+                       nativelyoverloaded = false;
+
+                       for (j = i + 1; j < c->methodscount; j++) {
+                               m2 = &(c->methods[j]);
+
+                               if (!(m2->flags & ACC_NATIVE))
+                                       continue;
+
+                               if (m->name == m2->name) {
+                                       m2->isleafmethod = true;
+                                       nativelyoverloaded = true;
                                }
                        }
-                       m->nativelyoverloaded=nativelyoverloaded;
                }
 
+               m->isleafmethod = nativelyoverloaded;
        }
 
        for (i = 0; i < c->methodscount; i++) {
-
                m = &(c->methods[i]);
 
-               if (m->flags & ACC_NATIVE) {
-                       chain_addlast(nativemethod_chain, m);
+               if (m->flags & ACC_NATIVE)
                        printmethod(m);
-               }
        }
 
        chain_free(ident_chain);