Merge from subtype.
[cacao.git] / src / vm / descriptor.h
index a905771417f600e615af90f3e3d1bff1c312a6ad..bf6c69efb458d7d3360f72bf23170af3b75a18a7 100644 (file)
@@ -1,9 +1,7 @@
-/* vm/descriptor.h - checking and parsing of field / method descriptors
+/* src/vm/descriptor.h - checking and parsing of field / method descriptors
 
-   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, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    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.
-
-   Contact: cacao@complang.tuwien.ac.at
-
-   Authors: Edwin Steiner
-
-   Changes:
-
-   $Id: descriptor.h 3838 2005-12-01 23:50:48Z twisti $
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
 */
 
 /* forward typedefs ***********************************************************/
 
 typedef struct descriptor_pool descriptor_pool;
-typedef struct paramdesc paramdesc;
+typedef struct typedesc        typedesc;
+typedef struct paramdesc       paramdesc;
+typedef struct methoddesc      methoddesc;
+
+
+#include "config.h"
 
-#include "vm/class.h"
+#include <stdint.h>
+
+#include "vm/types.h"
+
+#include "toolbox/hashtable.h"
+
+#include "vm/class.hpp"
 #include "vm/global.h"
-#include "vm/hashtable.h"
-#include "vm/method.h"
+#include "vm/method.hpp"
 #include "vm/references.h"
+#include "vm/utf8.h"
 
+#include "arch.h"              /* needed for HAS_ADDRESS_REGISTER_FILE */
 
-/* data structures ************************************************************/ 
+
+/* data structures ************************************************************/
 
 /*----------------------------------------------------------------------------*/
 /* Descriptor Pools                                                           */
@@ -95,21 +98,25 @@ struct descriptor_pool {
 /* data structures for parsed field/method descriptors ************************/
 
 struct typedesc {
-       constant_classref *classref;   /* class reference for TYPE_ADR types      */
-       u1                 type;       /* TYPE_??? constant [1]                   */
-       u1                 decltype;   /* (PRIMITIVE)TYPE_??? constant [2]        */
-       u1                 arraydim;   /* array dimension (0 if no array)         */
+       constant_classref *classref;      /* class reference for TYPE_ADR types   */
+       u1                 type;          /* TYPE_??? constant [1]                */
+       u1                 primitivetype; /* (PRIMITIVE)TYPE_??? constant [2]     */
+       u1                 arraydim;      /* array dimension (0 if no array)      */
 };
 
 /* [1]...the type field contains the basic type used within the VM. So ints,  */
 /*       shorts, chars, bytes, booleans all have TYPE_INT.                    */
-/* [2]...the decltype field contains the declared type.                       */
+/* [2]...the primitivetype field contains the declared type.                  */
 /*       So short is PRIMITIVETYPE_SHORT, char is PRIMITIVETYPE_CHAR.         */
-/*       For non-primitive types decltype is TYPE_ADR.                        */
+/*       For non-primitive types primitivetype is TYPE_ADR.                   */
 
 struct paramdesc {
-       bool inmemory;              /* argument in register or on stack           */
-       s4   regoff;                /* register index or stack offset             */
+#if defined(__MIPS__)
+       u1   type;                  /* TYPE_??? of the register allocated         */
+#endif
+       bool     inmemory;          /* argument in register or on stack           */
+       uint32_t index;             /* index into argument register array         */
+       uint32_t regoff;            /* register index or stack offset             */
 };
 
 struct methoddesc {
@@ -117,6 +124,9 @@ struct methoddesc {
        s2         paramslots;      /* like above but LONG,DOUBLE count twice     */
        s4         argintreguse;    /* number of used integer argument registers  */
        s4         argfltreguse;    /* number of used float argument registers    */
+#if defined(HAS_ADDRESS_REGISTER_FILE)
+       s4         argadrreguse;    /* number of used address registers */
+#endif
        s4         memuse;          /* number of stack slots used                 */
        paramdesc *params;          /* allocated parameter descriptions [3]       */
        typedesc   returntype;      /* parsed descriptor of the return type       */
@@ -141,13 +151,17 @@ struct methoddesc {
 
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 descriptor_pool * descriptor_pool_new(classinfo *referer);
 
 bool descriptor_pool_add_class(descriptor_pool *pool,utf *name);
 bool descriptor_pool_add(descriptor_pool *pool,utf *desc,int *paramslots);
 
-u2 descriptor_to_basic_type(utf *desc);
-u2 descriptor_typesize(typedesc *td);
+int  descriptor_to_basic_type(utf *desc);
+int  descriptor_typesize(typedesc *td);
 
 constant_classref * descriptor_pool_create_classrefs(descriptor_pool *pool,
                                                                                                         s4 *count);
@@ -172,8 +186,9 @@ void descriptor_debug_print_paramdesc(FILE *file,paramdesc *d);
 void descriptor_pool_debug_dump(descriptor_pool *pool, FILE *file);
 #endif /* !defined(NDEBUG) */
 
-/* machine dependent descriptor function */
-void md_param_alloc(methoddesc *md);
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _DESCRIPTOR_H */