-/* global.h ********************************************************************
+/* global.h - global definitions
- Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+ M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+ P. Tomsich, J. Wenninger
- See file COPYRIGHT for information on usage and disclaimer of warranties
+ This file is part of CACAO.
- Contains global definitions which are used in the whole program, includes
- some files and contains global used macros.
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
- Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
- Andreas Krall (andi) EMAIL: cacao@complang.tuwien.ac.at
- Changes: Mark Probst (schani) EMAIL: cacao@complang.tuwien.ac.at
- Philipp Tomsich (phil) EMAIL: cacao@complang.tuwien.ac.at
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- Last Change: $Id: global.h 227 2003-02-12 13:23:24Z stefan $
+ 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: Reinhard Grafl
+ Andreas Krall
+
+ Changes: Mark Probst
+ Philipp Tomsich
+
+ $Id: global.h 557 2003-11-02 22:51:59Z twisti $
+
+*/
-*******************************************************************************/
-#ifndef __global_h_
-#define __global_h_
+#ifndef _GLOBAL_H
+#define _GLOBAL_H
#include "config.h"
+#include "types.h"
+#include "toolbox/list.h"
+
-#define NEW_GC /* if enabled, includes the new gc. -- phil. */
+#define _GNU_SOURCE
#define STATISTICS /* if enabled collects program statistics */
/*
- * JIT_MARKER_SUPPORT is the define used to toggle Just-in-time generated
- * marker functions on and off.
- *
* SIZE_FROM_CLASSINFO toggles between the bitmap_based and the new method
* of determining the sizes of objects on the heap.
*/
-#undef JIT_MARKER_SUPPORT /* phil */
#define SIZE_FROM_CLASSINFO
-/* standard includes **********************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "toolbox/memory.h"
-#include "toolbox/chain.h"
-#include "toolbox/list.h"
-#include "toolbox/loging.h"
-
-/* system dependent types *****************************************************/
-
-#include "types.h"
-
/* additional data types ******************************************************/
#define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
-
/* shutdown function **********************************************************/
void cacao_shutdown(s4 status);
typedef struct classinfo classinfo;
typedef struct vftbl vftbl;
typedef u1* methodptr;
+typedef struct fieldinfo fieldinfo;
+typedef struct methodinfo methodinfo;
/* constant pool entries *******************************************************
char *text; /* pointer to text */
};
+
/* data structure of internal javastrings stored in global hashtable **********/
struct literalstring {
java_objectheader *string;
};
+
/* data structure for accessing hashtables ************************************/
typedef struct {
- u4 size;
- u4 entries; /* number of entries in the table */
- void **ptr; /* pointer to hashtable */
+ u4 size;
+ u4 entries; /* number of entries in the table */
+ void **ptr; /* pointer to hashtable */
} hashtable;
+
/* data structures of remaining constant pool entries *************************/
typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
utf *descriptor; /* field/method/interface type descriptor string */
} constant_FMIref;
+
typedef struct { /* Integer */
s4 value;
} constant_integer;
+
typedef struct { /* Float */
float value;
} constant_float;
+
typedef struct { /* Long */
s8 value;
} constant_long;
+
typedef struct { /* Double */
double value;
} constant_double;
+
typedef struct { /* NameAndType (Field or Method) */
utf *name; /* field/method name */
utf *descriptor; /* field/method type descriptor string */
} constant_nameandtype;
-/* arraydescriptor describes array types. Basic array types contain their
- type in the arraytype field, objectclass contains a class pointer for
- arrays of objects (arraytype == ARRAYTYPE_OBJECT), elementdescriptor
- contains a pointer to an arraydescriptor which describes the element
- types in the case of arrays of arrays (arraytype == ARRAYTYPE_ARRAY).
+
+/*
+ arraydescriptor describes array types. Basic array types contain their
+ type in the arraytype field, objectclass contains a class pointer for
+ arrays of objects (arraytype == ARRAYTYPE_OBJECT), elementdescriptor
+ contains a pointer to an arraydescriptor which describes the element
+ types in the case of arrays of arrays (arraytype == ARRAYTYPE_ARRAY).
*/
typedef struct constant_arraydescriptor {
char *name; /* name of primitive class */
} primitivetypeinfo;
+
/* field, method and class structures *****************************************/
+#include "sets.h"
+typedef struct xtafldinfo {
+ bool fieldChecked;
+ classinfo *fldClassType;
+ classSet *XTAclassSet; /* field class type set */
+} xtafldinfo;
+
+
/* fieldinfo ******************************************************************/
-typedef struct fieldinfo {/* field of a class */
- s4 flags; /* ACC flags */
- s4 type; /* basic data type */
+struct fieldinfo { /* field of a class */
+ s4 flags; /* ACC flags */
+ s4 type; /* basic data type */
utf *name; /* name of field */
utf *descriptor; /* JavaVM descriptor string of field */
- s4 offset; /* offset from start of object (instance variables) */
+ s4 offset; /* offset from start of object (instance variables) */
union { /* storage for static values (class variables) */
s4 i;
double d;
void *a;
} value;
-
-} fieldinfo;
+
+ xtafldinfo *xta;
+};
struct basicblock;
} exceptiontable;
+/* methodinfo static info ****************************************************/
+typedef struct xtainfo {
+ s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
+ classSet *XTAclassSet; /* method class type set */
+ /*classSet *PartClassSet */ /* method class type set */
+
+ classSetNode *paramClassSet; /* cone set of methods parameters */
+
+ methSet *calls; /* methods this method calls */
+ methSet *calledBy; /* methods that call this method */
+ methSet *marked; /* methods that marked by this method */
+ /*methSet *markedBy*/
+ fldSet *fldsUsed; /* fields used by this method */
+ /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
+ bool chgdSinceLastParse; /* Changed since last parse ? */
+} xtainfo;
+
/* methodinfo *****************************************************************/
-typedef struct methodinfo { /* method structure */
+struct methodinfo { /* method structure */
s4 flags; /* ACC flags */
utf *name; /* name of method */
utf *descriptor; /* JavaVM descriptor string of method */
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*/
+
classinfo *class; /* class, the method belongs to */
s4 vftblindex; /* index of method in virtual function table
(if it is a virtual method) */
u1 *mcode; /* pointer to machine code */
u1 *entrypoint; /* entry point in machine code */
-} methodinfo;
+ /*rtainfo rta;*/
+ xtainfo *xta;
+
+ 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;
+};
+
/* innerclassinfo *************************************************************/
bool initialized; /* true, if class already initialised */
bool linked; /* true, if class already linked */
- s4 index; /* hierarchy depth (classes) or index
+ s4 index; /* hierarchy depth (classes) or index
(interfaces) */
s4 instancesize; /* size of an instance of this class */
#ifdef SIZE_FROM_CLASSINFO
s4 alignedsize; /* size of an instance, aligned to the
- allocation size on the heap */
+ allocation size on the heap */
#endif
vftbl *vftbl; /* pointer to virtual function table */
methodinfo *finalizer; /* finalizer method */
-#ifdef JIT_MARKER_SUPPORT
- methodinfo *marker;
-#endif
u2 innerclasscount; /* number of inner classes */
innerclassinfo *innerclass;
classinfo *hashlink; /* link for external hash chain */
+ bool classvftbl; /* has its own copy of the Class vtbl */
- s4 baseval; /* base for runtime type check */
- s4 diffval; /* high - base for runtime type check */
+ s4 classUsed; /* 0= not used 1 = used CO-RT */
+ classSetNode *impldBy; /* implemented by class set */
};
s4 vftbllength; /* virtual function table length */
s4 interfacetablelength; /* interface table length */
+ s4 baseval; /* base for runtime type check */
+ s4 diffval; /* high - base for runtime type check */
+
s4 *interfacevftbllength; /* length of interface vftbls */
methodptr table[1]; /* class vftbl */
extern bool compileall;
extern bool runverbose;
extern bool verbose;
+extern bool opt_rt; /* Rapid Type Analysis for better inlining CO-RT*/
+extern bool opt_xta; /* X Type Analysis for better inlining CO-XTA*/
+extern bool opt_vta; /* Variable Type Analysis for better inlining CO-VTA*/
+extern int pClassHeir;
+extern int pCallgraph;
+extern int pOpcodes;
+extern int pStats;
+
+extern void RT_jit_parse(methodinfo *m);
+extern void printCallgraph ();
+extern void printRThierarchyInfo(methodinfo *m);
+extern void printObjectClassHeirarchy();
+
+extern void XTA_jit_parse(methodinfo *m);
/* statistic variables ********************************************************/
extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
-#endif
+#endif /* _GLOBAL_H */
/*