-/* 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 */
/* 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 {
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 */
/* 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);
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 */