* src/vm/jit/patcher-common.c (patcher_handler): Call LOCK_MONITOR_EXIT instead of...
[cacao.git] / src / vm / global.h
index efcd477d80aa7d061183454c3f4eb0d38f1cdf75..ab6165cd98c154c05ed7047c705323d9208a6387 100644 (file)
-/****************************** global.h ***************************************
+/* src/vm/global.h - global definitions
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996-2005, 2007, 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
 
-       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
-       Chages:  Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-                Mark Probst         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: 1997/10/28
+   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., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-*******************************************************************************/
+   $Id: global.h 8210 2007-07-18 12:51:00Z twisti $
 
-#ifndef __global_h_
-#define __global_h_                        /* schani */
+*/
 
-#define STATISTICS                         /* andi   */
 
-/***************************** standard includes ******************************/
+#ifndef _GLOBAL_H
+#define _GLOBAL_H
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include "config.h"
+#include "vm/types.h"
 
-#include "toolbox/memory.h"
-#include "toolbox/chain.h"
-#include "toolbox/list.h"
-#include "toolbox/loging.h"
 
+/* additional data types ******************************************************/
 
-/**************************** system dependent types **************************/
+typedef void *voidptr;                  /* generic pointer                    */
+typedef void (*functionptr) (void);     /* generic function pointer           */
+typedef u1* methodptr;
 
-#include "sysdep/types.h"
+typedef unsigned int bool;              /* boolean data type                  */
 
+#define true         1
+#define false        0
 
-/**************************** additional data types ***************************/
 
-typedef void *voidptr;          /* generic pointer */
+#if defined(ENABLE_SSA)
+/* immediate to get an addidional target Local Var Index */
+/* for IINC in Combination with SSA */
+struct imm {
+       s4 i;
+       s4 op1_t;
+};
+#endif
 
+/* immediate data union */
+
+typedef union {
+       s4          i;
+       s8          l;
+       float       f;
+       double      d;
+       void       *a;
+       functionptr fp;
+       u1          b[8];
+#if defined(ENABLE_SSA)
+       struct imm  _i;
+#endif
+} imm_union;
 
-typedef u1    bool;             /* boolean data type */
 
-#define true  1
-#define false 0
+/* alignment macros ***********************************************************/
 
-typedef void (*functionptr) (); /* generic function pointer */
+#define ALIGN_EVEN(a)                   ((a) = (((a) + 1) & ~1))
+#define ALIGN_ODD(a)                    ((a) =   (a) | 1       )
 
+#define ALIGN_2(a)                      ALIGN_EVEN(a)
 
-#define MAX_ALIGN 8             /* most generic alignment for JavaVM values   */
 
+/* forward typedefs ***********************************************************/
 
-/**************************** shutdown function *******************************/
+typedef struct java_objectheader java_objectheader; 
+typedef struct java_objectarray java_objectarray;
 
-void cacao_shutdown(s4 status);
 
+#define MAX_ALIGN 8             /* most generic alignment for JavaVM values   */
 
-/**************************** basic data types ********************************/
 
-#define TYPE_INT      0         /* the JavaVM types must numbered in the      */
-#define TYPE_LONG     1         /* same order as the ICMD_Ixxx to ICMD_Axxx   */
-#define TYPE_FLOAT    2         /* instructions (LOAD and STORE)              */
-#define TYPE_DOUBLE   3         /* integer, long, float, double, address      */
-#define TYPE_ADDRESS  4         /* all other types can be numbered arbitrarily*/
+/* basic data types ***********************************************************/
 
-#define TYPE_VOID    10
+/* The JavaVM types must numbered in the same order as the ICMD_Ixxx
+   to ICMD_Axxx instructions (LOAD and STORE).  All other types can be
+   numbered arbitrarily. */
 
+#define TYPE_INT     0
+#define TYPE_LNG     1
+#define TYPE_FLT     2
+#define TYPE_DBL     3
+#define TYPE_ADR     4
 
-/**************************** Java class file constants ***********************/
+#define TYPE_RET     8   /* must not share bits with TYPE_FLT or TYPE_LNG */
 
-#define MAGIC         0xcafebabe
-#define MINOR_VERSION 3
-#define MAJOR_VERSION 45
+#define TYPE_VOID    10
 
-#define CONSTANT_Class                7
-#define CONSTANT_Fieldref             9
-#define CONSTANT_Methodref           10
-#define CONSTANT_InterfaceMethodref  11
-#define CONSTANT_String               8
-#define CONSTANT_Integer              3
-#define CONSTANT_Float                4
-#define CONSTANT_Long                 5
-#define CONSTANT_Double               6
-#define CONSTANT_NameAndType         12
-#define CONSTANT_Utf8                 1
 
-#define CONSTANT_Arraydescriptor     13
-#define CONSTANT_UNUSED               0
+#define IS_INT_LNG_TYPE(a)      (!((a) & TYPE_FLT))
+#define IS_FLT_DBL_TYPE(a)      ((a) & TYPE_FLT)
+#define IS_2_WORD_TYPE(a)       ((a) & TYPE_LNG)
 
+#define IS_INT_TYPE(a)          ((a) == TYPE_INT)
+#define IS_LNG_TYPE(a)          ((a) == TYPE_LNG)
+#define IS_FLT_TYPE(a)          ((a) == TYPE_FLT)
+#define IS_DBL_TYPE(a)          ((a) == TYPE_DBL)
+#define IS_ADR_TYPE(a)          ((a) == TYPE_ADR)
 
-#define ACC_PUBLIC                0x0001
-#define ACC_PRIVATE               0x0002
-#define ACC_PROTECTED             0x0004
-#define ACC_STATIC                0x0008
-#define ACC_FINAL                 0x0010
-#define ACC_SYNCHRONIZED          0x0020
-#define ACC_VOLATILE              0x0040
-#define ACC_TRANSIENT             0x0080
-#define ACC_NATIVE                0x0100
-#define ACC_INTERFACE             0x0200
-#define ACC_ABSTRACT              0x0400
+#define IS_VOID_TYPE(a)         ((a) == TYPE_VOID)
 
 
+/* some Java related defines **************************************************/
 
-/**************************** resolve typedef-cycles **************************/
+#define JAVA_VERSION    "1.5.0"         /* this version is supported by CACAO */
+#define CLASS_VERSION   "50.0"
 
-typedef struct unicode unicode;
-typedef struct classinfo classinfo; 
-typedef struct vftbl vftbl;
-typedef u1* methodptr;
 
+/* Java class file constants **************************************************/
 
-/********************** data structures of UNICODE symbol *********************/
+#define MAGIC             0xCAFEBABE
+#define MAJOR_VERSION     50
+#define MINOR_VERSION     0
 
-struct unicode {
-  unicode   *hashlink; /* externe Verkettung f"ur die unicode-Hashtabelle */
-  u4         key;      /* Hash-Schl"ussel (h"angt nur vom Text ab) */
-  int        length;   /* L"ange des Textes */           
-  u2        *text;     /* Zeiger auf den Text (jeder Buchstabe 16 Bit) */
-  classinfo *class;    /* gegebenenfalls Referenz auf die Klasse dieses 
-                         Namens (oder NULL, wenn es keine solche gibt)  */
-  struct java_objectheader *string;
-  /* gegebenenfalls Referenz auf einen konstanten
-     String mit dem entsprechenden Wert */ 
-};
 
-/* Alle Unicode-Symbole werden in einer einzigen globalen Tabelle 
-          (Hashtabelle) verwaltet, jedes Symbol wird nur einmal angelegt.
-          -> Speicherersparnis, und "Uberpr"ufung auf Gleichheit durch einfachen
-          Zeigervergleich */
+/* Constant pool tags *********************************************************/
 
+#define CONSTANT_Class                 7
+#define CONSTANT_Fieldref              9
+#define CONSTANT_Methodref            10
+#define CONSTANT_InterfaceMethodref   11
+#define CONSTANT_String                8
+#define CONSTANT_Integer               3
+#define CONSTANT_Float                 4
+#define CONSTANT_Long                  5
+#define CONSTANT_Double                6
+#define CONSTANT_NameAndType          12
+#define CONSTANT_Utf8                  1
 
-/************ data structures of remaining constant pool entries **************/
+#define CONSTANT_UNUSED                0
 
 
-typedef struct {
-  classinfo *class;
-  unicode   *name;
-  unicode   *descriptor;
-} constant_FMIref;
+/* Class/Field/Method access and property flags *******************************/
 
+#define ACC_UNDEF               -1      /* used internally                    */
+#define ACC_NONE                 0      /* used internally                    */
 
-typedef struct {
-  s4 value;
-} constant_integer;
-       
-typedef struct {
-  float value;
-} constant_float;
-
-typedef struct {
-  s8 value;
-} constant_long;
-       
-typedef struct {
-  double value;
-} constant_double;
+#define ACC_PUBLIC          0x0001
+#define ACC_PRIVATE         0x0002
+#define ACC_PROTECTED       0x0004
+#define ACC_STATIC          0x0008
+#define ACC_FINAL           0x0010
+#define ACC_SUPER           0x0020
+#define ACC_SYNCHRONIZED    0x0020
+#define ACC_VOLATILE        0x0040
+#define ACC_BRIDGE          0x0040
+#define ACC_TRANSIENT       0x0080
+#define ACC_VARARGS         0x0080
+#define ACC_NATIVE          0x0100
+#define ACC_INTERFACE       0x0200
+#define ACC_ABSTRACT        0x0400
+#define ACC_STRICT          0x0800
+#define ACC_SYNTHETIC       0x1000
+#define ACC_ANNOTATION      0x2000
+#define ACC_ENUM            0x4000
+#define ACC_MIRANDA         0x8000
 
+/* special flags used in classinfo ********************************************/
 
-typedef struct {
-  unicode *name;
-  unicode *descriptor;
-} constant_nameandtype;
+#define ACC_CLASS_REFLECT_MASK      0x0000ffff/* flags reported by reflection */
 
+#define ACC_CLASS_PRIMITIVE         0x00010000/* class is a primitive class   */
 
-typedef struct constant_arraydescriptor {
-  int arraytype;
-  classinfo *objectclass;
-  struct constant_arraydescriptor *elementdescriptor;
-} constant_arraydescriptor;
+#define ACC_CLASS_HAS_POINTERS      0x00020000/* instance contains pointers   */
 
-/* Mit einem Arraydescriptor kann ein Array-Typ dargestellt werden.
-          Bei normalen Arrays (z.B. Array von Bytes,...) gen"ugt dazu,
-       dass das Feld arraytype die entsprechende Kennzahl enth"alt
-       (z.B. ARRAYTYPE_BYTE).
-       Bei Arrays von Objekten (arraytype=ARRAYTYPE_OBJECT) muss das 
-       Feld objectclass auf die Klassenstruktur der m"oglichen
-       Element-Objekte zeigen.
-       Bei Arrays von Arrays (arraytype=ARRAYTYPE_ARRAY) muss das
-       Feld elementdescriptor auf eine weiter arraydescriptor-Struktur
-       zeigen, die die Element-Typen beschreibt.
-       */
+#define ACC_CLASS_REFERENCE_MASK    0x001c0000
+#define ACC_CLASS_REFERENCE_SOFT    0x00040000
+#define ACC_CLASS_REFERENCE_WEAK    0x00080000
+#define ACC_CLASS_REFERENCE_PHANTOM 0x00100000
 
 
+/* special flags used in methodinfo *******************************************/
 
-/********* Anmerkungen zum Constant-Pool:
+#define ACC_METHOD_BUILTIN     0x00010000     /* use for descriptor parsing   */
+#define ACC_METHOD_IMPLEMENTED 0x00020000     /* there is an implementation   */
+#define ACC_METHOD_MONOMORPHIC 0x00040000     /* currently monomorphic method */
 
-       Die Typen der Eintr"age in den Constant-Pool werden durch die oben
-       definierten CONSTANT_.. Werte angegeben.
-       Bei allen Typen muss zus"atzlich noch eine Datenstruktur hinzugef"ugt
-       werden, die den wirklichen Wert angibt.
-       Bei manchen Typen reicht es, einen Verweis auf eine schon bereits
-       existierende Struktur (z.B. unicode-Texte) einzutragen, bei anderen
-       muss diese Struktur erst extra erzeugt werden.
-       Ich habe folgende Datenstrukturen f"ur diese Typen verwendet:
-       
-               Typ                      Struktur                    extra erzeugt?
-       ----------------------------------------------------------------------
-    CONSTANT_Class               classinfo                         nein
-    CONSTANT_Fieldref            constant_FMIref                     ja
-    CONSTANT_Methodref           constant_FMIref                     ja
-    CONSTANT_InterfaceMethodref  constant_FMIref                     ja
-    CONSTANT_String              unicode                           nein
-    CONSTANT_Integer             constant_integer                    ja
-    CONSTANT_Float               constant_float                      ja
-    CONSTANT_Long                constant_long                       ja
-    CONSTANT_Double              constant_double                     ja
-    CONSTANT_NameAndType         constant_nameandtype                ja
-    CONSTANT_Utf8                unicode                           nein
-    CONSTANT_Arraydescriptor     constant_arraydescriptor            ja
-    CONSTANT_UNUSED              -
 
-*******************************/
+/* data structures of the runtime system **************************************/
 
+/* java_objectheader ***********************************************************
 
+   All objects (and arrays) which resides on the heap need the
+   following header at the beginning of the data structure.
 
-/***************** Die Datenstrukturen fuer das Laufzeitsystem ***************/
+   TODO: Include detailed description from the Wiki (ObjectHeader) here.
 
+*******************************************************************************/
 
-       /********* Objekte **********
+#define HDRFLAG_FLC 0x01
 
-       Alle Objekte (und Arrays), die am Heap gespeichert werden, m"ussen eine 
-       folgende spezielle Datenstruktur ganz vorne stehen haben: 
+struct java_objectheader {             /* header for all objects              */
+       struct _vftbl            *vftbl;   /* pointer to virtual function table   */
+#if defined(ENABLE_THREADS)
+       struct lock_record_t *monitorPtr;
+#endif
+#if defined(ENABLE_THREADS) || defined(ENABLE_GC_CACAO)
+       ptrint                hdrflags;    /* word containing the FLC and GC bits */
+#endif
+};
 
-       */
 
-typedef struct java_objectheader {    /* Der Header f"ur alle Objekte */
-  vftbl *vftbl;                     /* Zeiger auf die Function Table */
-} java_objectheader;
+/* arrays **********************************************************************
 
+       All arrays are objects (they need the object header with a pointer
+       to a vftbl (array class table). There is one class for each array
+       type. The array type is described by an arraydescriptor struct
+       which is referenced by the vftbl.
+*/
 
-
-/********* Arrays ***********
-       
-       Alle Arrays in Java sind auch gleichzeitig Objekte (d.h. sie haben auch
-       den obligatorischen Object-Header und darin einen Verweis auf eine Klasse)
-       Es gibt aber (der Einfachheit halber) nur eine einzige Klasse f"ur alle
-       m"oglichen Typen von Arrays, deshalb wird der tats"achliche Typ in einem
-       Feld im Array-Objekt selbst gespeichert.
-       Die Typen sind: */
-
-#define ARRAYTYPE_INT      0
-#define ARRAYTYPE_LONG     1
-#define ARRAYTYPE_FLOAT    2
-#define ARRAYTYPE_DOUBLE   3
-#define ARRAYTYPE_BYTE     4
-#define ARRAYTYPE_CHAR     5
-#define ARRAYTYPE_SHORT    6
-#define ARRAYTYPE_BOOLEAN  7
-#define ARRAYTYPE_OBJECT   8
-#define ARRAYTYPE_ARRAY    9
-
-
-/** Der Header f"ur ein Java-Array **/
-
-typedef struct java_arrayheader {  /* Der Arrayheader f"ur alle Arrays */
-  java_objectheader objheader;       /* Der Object-Header */
-  s4 size;                           /* Gr"osse des Arrays */
-  s4 arraytype;                      /* Typ der Elemente */
+typedef struct java_arrayheader {       /* header for all arrays              */
+       java_objectheader objheader;        /* object header                      */
+       s4 size;                            /* array size                         */
 } java_arrayheader;
 
 
 
-/** Die Unterschiedlichen Strukturen f"ur alle Typen von Arrays **/
+/* structs for all kinds of arrays ********************************************/
 
-typedef struct java_chararray {
-  java_arrayheader header;
-  u2 data[1];
-} java_chararray;
-
-typedef struct java_floatheader {
-  java_arrayheader header;
-  float data[1];
-} java_floatarray;
-
-typedef struct java_doublearray {
-  java_arrayheader header;
-  double data[1];
-} java_doublearray;
-
-
-/* achtung: die beiden Stukturen booleanarray und bytearray m"ussen 
-      identisches memory-layout haben, weil mit den selben Funktionen 
-      darauf zugegriffen wird */
+/*  booleanarray and bytearray need identical memory layout (access methods
+    use the same machine code */
 
 typedef struct java_booleanarray {
-  java_arrayheader header;
-  u1 data[1];
+       java_arrayheader header;
+       u1 data[1];
 } java_booleanarray;
 
 typedef struct java_bytearray {
-  java_arrayheader header;
-  s1 data[1];
+       java_arrayheader header;
+       s1 data[1];
 } java_bytearray;
 
+typedef struct java_chararray {
+       java_arrayheader header;
+       u2 data[1];
+} java_chararray;
+
 typedef struct java_shortarray {
-  java_arrayheader header;
-  s2 data[1];
+       java_arrayheader header;
+       s2 data[1];
 } java_shortarray;
 
 typedef struct java_intarray {
-  java_arrayheader header;
-  s4 data[1];
+       java_arrayheader header;
+       s4 data[1];
 } java_intarray;
 
 typedef struct java_longarray {
-  java_arrayheader header;
-  s8 data[1];
+       java_arrayheader header;
+       s8 data[1];
 } java_longarray;
 
+typedef struct java_floatarray {
+       java_arrayheader header;
+       float data[1];
+} java_floatarray;
 
-/* ACHTUNG: die beiden folgenden Strukturen m"ussen unbedingt gleiches
-          Memory-Layout haben, weil mit ein und der selben Funktion auf die
-          data-Eintr"age beider Typen zugegriffen wird !!!! */
+typedef struct java_doublearray {
+       java_arrayheader header;
+       double data[1];
+} java_doublearray;
 
-typedef struct java_objectarray {
-  java_arrayheader header;
-  classinfo *elementtype;
-  java_objectheader *data[1];
-} java_objectarray;
-
-typedef struct java_arrayarray {
-  java_arrayheader header;
-  constant_arraydescriptor *elementdescriptor;
-  java_arrayheader *data[1];
-} java_arrayarray;
-
-
-
-
-/************** Strukturen f"ur Klassen, Felder & Methoden *****************/
-
-
-    /*** Struktur: fieldinfo ***/
-
-typedef struct fieldinfo {   /* Struktur f"ur ein Feld einer Klasse */
-  s4       flags;              /* die ACC-Flags */
-  s4       type;               /* Grunddatentyp */
-  unicode *name;               /* Name des Felds */
-  unicode *descriptor;         /* Typedescriptor in JavaVM-Form */
-       
-  s4       offset;             /* Offset vom Anfang des Objektes */
-  /* (bei Instanzvariablen) */
-
-  union {                      /* Speicher f"ur den Wert */
-    s4 i;                    /* (bei Klassenvariablen) */    
-    s8 l;
-    float f;
-    double d;
-    void *a; 
-  } value;
-               
-} fieldinfo;
-
-
-/*** Struktur: exceptiontable ***/
-
-typedef struct exceptiontable {  /* Exceptionhandler-Eintrag in einer Methode */ 
-  s4         startpc;            /* Anfang des G"ultigkeitsbereichs */
-  s4         endpc;              /* Ende des Bereichs (exklusive) */
-  s4         handlerpc;          /* JavaVM-Position des Handlers */
-  classinfo *catchtype;          /* Typ der behandelten Exceptions (oder 
-                                   NULL, wenn alle behandelt werden sollen) */
-} exceptiontable;
-
-
-
-/*** Struktur: methodinfo ***/
-
-typedef struct methodinfo {  /* Struktur f"ur eine Methode einer Klasse */
-  s4          flags;            /* die ACC-Flags */
-  unicode   *name;             /* Name der Methode */
-  unicode   *descriptor;       /* der JavaVM-Descriptorstring f"ur Methoden */
-  s4        returntype;        /* only temporary valid, return type */
-  s4        paramcount;        /* only temporary valid, number of parameters */
-  u1        *paramtypes;       /* only temporary valid, parameter types */
-  classinfo *class;            /* Die Klasse, der die Methode geh"ort */
-  u4         vftblindex;       /* Index dieser Methode f"ur die Virtual
-                                 Function Table (wenn es keine statische
-                                 Methode ist) */
-
-  s4    maxstack;                  /* maximale Stacktiefe des JavaVM-Codes */
-  s4   maxlocals;                 /* maximale Anzahl der JavaVM-Variablen */
-  u4   jcodelength;               /* L"ange des JavaVM-Codes */
-  u1  *jcode;                     /* und Zeiger auf den JavaVM-Code */
-
-  s4   exceptiontablelength;      /* L"ange der Exceptintable */
-  exceptiontable *exceptiontable; /* Die Exceptiontable selber */
-
-  u1  *stubroutine;               /* STUB-Routine for compiling or calling 
-                                    natives */ 
-  u4   mcodelength;               /* L"ange des generierten Maschinencodes */
-  u1  *mcode;                     /* Zeiger auf den Maschinencode */
-  u1  *entrypoint;                /* Entrypoint to the Maschine-Code */        
-} methodinfo;
-
-
-/*** Struktur: classinfo ***/
-
-struct classinfo {           /* Datenstruktur f"ur eine Klasse */
-  java_objectheader header;     /* Weil auch Klassen als Objekte angesprochen 
-                                  werden */
-
-  s4 flags;                     /* Die ACC-Flags */
-  unicode *name;                /* Name der Klasse */ 
-       
-  s4       cpcount;             /* Anzahl der Eintr"age im Constant-Pool */
-  u1      *cptags;              /* Die TAGs f"ur den Constant-Pool */
-  voidptr *cpinfos;             /* Die Zeiger auf die Info-Strukturen */
-       
-  classinfo *super;             /* Zeiger auf die "ubergeordnete Klasse */
-       
-  s4          interfacescount;  /* Anzahl der Interfaces */
-  classinfo **interfaces;       /* Zeiger auf die Interfaces */
-       
-  s4          fieldscount;      /* Anzahl der Felder */
-  fieldinfo  *fields;           /* Die Tabelle der Felder */
-       
-  s4          methodscount;     /* Anzahl der Methoden */
-  methodinfo *methods;          /* Die Tabelle der Methoden */
-       
-       
-  listnode    listnode;         /* Verkettungsstruktur (f"ur Listen) */
-
-  bool        initialized;      /* true, wenn Klasse bereits Initialisiert */ 
-  bool        linked;           /* wird von `class_link` auf true gesetzt */
-  s4                   index;            /* Hierarchietiefe  (bei normalen Klassen)  
-                                            oder fortlaufende Nummer (bei Interfaces)*/ 
-  u4          instancesize;     /* Gr"osse eines Objektes dieser Klasse */
-
-  vftbl       *vftbl;
-
-  methodinfo* finalizer;        /* Finalizer-Methode f"ur die Klasse */
-#ifdef JIT_MARKER_SUPPORT
-  methodinfo* marker; 
-#endif
-};
-       
+/*  objectarray and arrayarray need identical memory layout (access methods
+    use the same machine code */
 
-struct vftbl {
-  classinfo  *class;            /* Class, the function table belongs to */
+struct java_objectarray {
+       java_arrayheader   header;
+       java_objectheader *data[1];
+};
 
-  s4          vftbllength;      /* L"aenge der Virtual Function Table */
 
-  s4          interfacetablelength;   /* L"ange der Interfacetable */   
-  u4         *interfacevftbllength;   /* -> siehe unten */   
-  methodptr **interfacevftbl;
-       
-  methodptr   table[1];
-};
+/* global constants related to the verifier ***********************************/
 
-/*********** Anmerkungen zur Interfacetable: 
-
-       "Ahnlich wie die 'normalen' virtuellen Methoden k"onnen auch die
-       Interface-Methoden mit Hilfe einer Art Virtual Function Table 
-       aufgerufen werden.
-       Dazu werden alle Interfaces im System fortlaufend nummeriert (beginnend
-       bei 0), und f"ur jede Klasse wird eine ganze Tabelle von 
-       Virtual Function Tables erzeugt, n"amlich zu jedem Interface, das die
-       Klasse implementiert, eine.
-
-       z.B. Nehmen wir an, eine Klasse implementiert zwei Interfaces (die durch
-       die Nummerierung die Indizes 0 und 3 bekommen haben)
-
-       Das sieht dann ungef"ahr so aus:
-                               --------------           ------------- 
-       interfacevftbl ---> | Eintrag 0  |---------> | Methode 0 |---> Methode X 
-                        | Eintrag 1  |--> NULL   | Methode 1 |---> Methode Y
-                        | Eintrag 2  |--> NULL   | Methode 2 |---> Methode Z
-                        | Eintrag 3  |-----+     ------------- 
-                        --------------     |
-                                           +---> -------------
-                                                 | Methode 0 |---> Methode X
-                                                 | Methode 1 |---> Methode A
-                                                 -------------
-                              ---------------
-       interfacevftlblength ---> | Wert 0 = 3  |
-                                 | Wert 1 = 0  |
-                                 | Wert 2 = 0  |
-                                 | Wert 3 = 2  |
-                                 ---------------
-
-       Der Aufruf einer Interface-Methode geht dann so vor sich:
-       Zur Compilezeit steht der Index (i) des Interfaces und die Stelle (s), wo
-       in der entsprechenden Untertabelle die Methode eingetragen ist, schon fest.
-       Also muss zur Laufzeit nur mehr der n-te Eintrag aus der Interfacetable 
-       gelesen werden, von dieser Tabelle aus wird der s-te Eintrag geholt,
-       und diese Methode wird angesprungen.
-
-****************/
-
-
-
-/************************* Referenzen auf die wichtigen Systemklassen ********************/
-
-extern classinfo *class_java_lang_Object;
-extern classinfo *class_java_lang_String;
-extern classinfo *class_java_lang_ClassCastException;
-extern classinfo *class_java_lang_NullPointerException;
-extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
-extern classinfo *class_java_lang_NegativeArraySizeException;
-extern classinfo *class_java_lang_OutOfMemoryError;
-extern classinfo *class_java_lang_ArithmeticException;
-extern classinfo *class_java_lang_ArrayStoreException;
-extern classinfo *class_java_lang_ThreadDeath;              /* schani */
-extern classinfo *class_array;
-
-
-/********************** Vorgefertigte Instanzen einiger Systemklassen ********************/
-
-extern java_objectheader *proto_java_lang_ClassCastException;
-extern java_objectheader *proto_java_lang_NullPointerException;
-extern java_objectheader *proto_java_lang_ArrayIndexOutOfBoundsException;
-extern java_objectheader *proto_java_lang_NegativeArraySizeException;
-extern java_objectheader *proto_java_lang_OutOfMemoryError;
-extern java_objectheader *proto_java_lang_ArithmeticException;
-extern java_objectheader *proto_java_lang_ArrayStoreException;
-extern java_objectheader *proto_java_lang_ThreadDeath;      /* schani */
-
-
-/********************** flag variables *********************/
-
-extern bool compileall;
-extern bool runverbose;         
-extern bool verbose;         
-                                
-
-/********************** trace variables ********************/
-
-extern int count_class_infos;
-extern int count_const_pool_len;
-extern int count_vftbl_len;
-extern int count_unicode_len;
-extern int count_all_methods;
-extern int count_vmcode_len;
-extern int count_extable_len;
+/* The verifier needs additional variables in the variable array. Since these */
+/* must be reserved and set by parse.c and stack.c, we define these numbers   */
+/* here to avoid mysterious hard-coded constants.                             */
+/* stack.c needs an extra variable if the verifier is disabled.               */
 
+#if defined(ENABLE_VERIFIER)
+#    define VERIFIER_EXTRA_LOCALS  1
+#    define VERIFIER_EXTRA_VARS    1
+#    define STACK_EXTRA_VARS       0
+#else
+#    define VERIFIER_EXTRA_LOCALS  0
+#    define VERIFIER_EXTRA_VARS    0
+#    define STACK_EXTRA_VARS       1
 #endif
 
+#endif /* _GLOBAL_H */
+
 
 /*
  * These are local overrides for various environment variables in Emacs.
@@ -554,4 +318,5 @@ extern int count_extable_len;
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */