* src/vm/jit/reorder.c (reorder): Iterate to m->basicblockcount + 1,
[cacao.git] / src / vm / method.h
index eb653f320874221dcb1e3fc4a4b77e9c1260739b..be9b278fcf26eb8d96ebade3c49daa356da7fbf1 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/method.h - method functions header
 
-   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
 
    Changes: Christian Thalinger
+            Edwin Steiner
 
-   $Id: method.h 2181 2005-04-01 16:53:33Z edwin $
+   $Id: method.h 5079 2006-07-06 11:36:01Z twisti $
 */
 
 
 
 /* forward typedefs ***********************************************************/
 
-typedef struct methodinfo methodinfo; 
 typedef struct exceptiontable exceptiontable;
 typedef struct lineinfo lineinfo; 
 
+#include "config.h"
+#include "vm/types.h"
 
+#include "vm/descriptor.h"
 #include "vm/global.h"
-#include "vm/utf8.h"
+#include "vm/linker.h"
 #include "vm/references.h"
-#include "vm/descriptor.h"
+#include "vm/utf8.h"
+#include "vm/jit/code.h"
 #include "vm/jit/jit.h"
-#include "vm/jit/inline/parseXTA.h"
 
 
 /* methodinfo *****************************************************************/
 
 struct methodinfo {                 /* method structure                       */
        java_objectheader header;       /* we need this in jit's monitorenter     */
-       s4          flags;              /* ACC flags                              */
-       utf        *name;               /* name of method                         */
-       utf        *descriptor;         /* JavaVM descriptor string of method     */
-       methoddesc *parseddesc;         /* parsed descriptor                      */
-
-       s4          returntype;         /* only temporary valid, return type      */
-       classinfo  *returnclass;        /* pointer to classinfo for the rtn type  */ /*XTA*/ 
-
-       s4          paramcount;         /* only temporary valid, parameter count  */
-       u1         *paramtypes;         /* only temporary valid, parameter types  */
-       classinfo **paramclass;         /* pointer to classinfo for a parameter   */ /*XTA*/
-
-       bool        isleafmethod;       /* does method call subroutines           */
-
-       classinfo  *class;              /* class, the method belongs to           */
-       s4          vftblindex;         /* index of method in virtual function    */
+       s4            flags;            /* ACC flags                              */
+       utf          *name;             /* name of method                         */
+       utf          *descriptor;       /* JavaVM descriptor string of method     */
+       methoddesc   *parseddesc;       /* parsed descriptor                      */
+                            
+       classinfo    *class;            /* class, the method belongs to           */
+       s4            vftblindex;       /* index of method in virtual function    */
                                        /* table (if it is a virtual method)      */
-       s4          maxstack;           /* maximum stack depth of method          */
-       s4          maxlocals;          /* maximum number of local variables      */
-       s4          jcodelength;        /* length of JavaVM code                  */
-       u1         *jcode;              /* pointer to JavaVM code                 */
-
-       s4          basicblockcount;    /* number of basic blocks                 */
-       basicblock *basicblocks;        /* points to basic block array            */
-       s4         *basicblockindex;    /* a table which contains for every byte  */
+       s4            maxstack;         /* maximum stack depth of method          */
+       s4            maxlocals;        /* maximum number of local variables      */
+       s4            jcodelength;      /* length of JavaVM code                  */
+       u1           *jcode;            /* pointer to JavaVM code                 */
+                            
+       s4            basicblockcount;  /* number of basic blocks                 */
+       basicblock   *basicblocks;      /* points to basic block array            */
+       s4           *basicblockindex;  /* a table which contains for every byte  */
                                        /* of JavaVM code a basic block index if  */
                                        /* at this byte is the start of a basic   */
                                        /* block                                  */
 
-       s4          instructioncount;   /* number of JavaVM instructions          */
-       instruction *instructions;      /* points to intermediate code instr.     */
+       s4            instructioncount; /* number of JavaVM instructions          */
+       instruction  *instructions;     /* points to intermediate code instr.     */
 
-       s4          stackcount;         /* number of stack elements               */
-       stackelement *stack;            /* points to intermediate code instr.     */
+       s4            stackcount;       /* number of stack elements               */
+       stackelement *stack;            /* points to stack elements               */
 
-       s4          exceptiontablelength;/* exceptiontable length                 */
+       s4            exceptiontablelength; /* exceptiontable length              */
        exceptiontable *exceptiontable; /* the exceptiontable                     */
 
-       u2          thrownexceptionscount;/* number of exceptions attribute       */
-       classinfo **thrownexceptions;   /* checked exceptions a method may throw  */
+       u2            thrownexceptionscount; /* number of exceptions attribute    */
+       classref_or_classinfo *thrownexceptions; /* except. a method may throw    */
 
-       u2          linenumbercount;    /* number of linenumber attributes        */
-       lineinfo   *linenumbers;        /* array of lineinfo items                */
+       u2            linenumbercount;  /* number of linenumber attributes        */
+       lineinfo     *linenumbers;      /* array of lineinfo items                */
 
        int       c_debug_nr;           /* a counter to number all BB with an     */
                                        /* unique value                           */
 
-       u1         *stubroutine;        /* stub for compiling or calling natives  */
-       s4          mcodelength;        /* legth of generated machine code        */
-       functionptr mcode;              /* pointer to machine code                */
-       functionptr entrypoint;         /* entry point in machine code            */
-
-       /*rtainfo   rta;*/
-       xtainfo    *xta;
-
-       bool        methodXTAparsed;    /*  true if xta parsed */
-       s4          methodUsed;         /* marked (might be used later) /not used /used */
-       s4          monoPoly;           /* call is mono or poly or unknown        */ /*RT stats */
-        /* should # method def'd and used be kept after static parse (will it be used?) */
-       s4              subRedefs;
-       s4              subRedefsUsed;
-       s4              nativelyoverloaded; /* used in header.c and only valid there  */
-       /* helper for lsra */
-       s4          maxlifetimes;
+       u1           *stubroutine;      /* stub for compiling or calling natives  */
+       codeinfo     *code;             /* current code of this method            */
+
+#if defined(ENABLE_LSRA)
+       s4            maxlifetimes;     /* helper for lsra                        */
+#endif
 };
 
 
@@ -133,7 +116,7 @@ struct exceptiontable {         /* exceptiontable entry in a method           */
        s4              handlerpc;  /* pc of exception handler                    */
        basicblock     *handler;
 
-       classinfo      *catchtype;  /* catchtype of exception (NULL == catchall)  */
+       classref_or_classinfo catchtype; /* catchtype of exc. (NULL == catchall)  */
        exceptiontable *next;       /* used to build a list of exception when     */
                                    /* loops are copied */
        exceptiontable *down;       /* instead of the old array, a list is used   */
@@ -153,8 +136,15 @@ struct lineinfo {
 void method_free(methodinfo *m);
 bool method_canoverwrite(methodinfo *m, methodinfo *old);
 
-void method_display(methodinfo *m);
-void method_display_w_class(methodinfo *m);
+methodinfo *method_vftbl_lookup(vftbl_t *vftbl, methodinfo* m);
+
+#if !defined(NDEBUG)
+void method_printflags(methodinfo *m);
+void method_print(methodinfo *m);
+void method_println(methodinfo *m);
+void method_methodref_print(constant_FMIref *mr);
+void method_methodref_println(constant_FMIref *mr);
+#endif
 
 #endif /* _METHOD_H */
 
@@ -170,4 +160,5 @@ void method_display_w_class(methodinfo *m);
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */