home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
kaffe-0.5p4-src.tgz
/
tar.out
/
contrib
/
kaffe
/
kaffevm
/
classMethod.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-28
|
3KB
|
142 lines
/*
* classMethod.h
* Class, method and field tables.
*
* Copyright (c) 1996 Systems Architecture Research Centre,
* City University, London, UK.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* Written by Tim Wilkinson <tim@sarc.city.ac.uk>, February 1996.
*/
#ifndef __classmethod_h
#define __classmethod_h
#define MAXMETHOD 64
/* Class state */
#define CSTATE_OK 0
#define CSTATE_NEEDINIT 1
#define CSTATE_DOINGINIT 2
struct _constants;
struct _methods;
struct _fields;
struct _methodTable;
struct _dispatchTable;
struct _jexception;
typedef struct _classes {
object head; /* A class is an object too */
struct _classes* next;
char* name;
char* sig;
int accflags;
char* supername;
struct _classes* superclass;
struct _constants* constants;
struct _methods* methodList;
int msize;
struct _fields* fieldList;
int fsize;
struct _fields* staticFieldList;
int sfsize;
struct _methodTable* mtable;
struct _dispatchTable* dtable;
int* staticFields;
struct _classes** interfaces;
int interface_len;
struct _classes* nextInit;
struct _classes* prevInit;
int state;
bool final;
} classes;
typedef struct _methods {
struct _methods* next;
strpair* pair;
accessFlags accflags;
char* code;
int codelen;
struct _instn* insn;
nativecode* ncode;
nativecode* ncode_end;
struct _constants* constants;
struct _jexception* exception_table;
int exception_table_len;
struct _methods* exception_next;
int stacksz;
int localsz;
int ins;
int outs;
char outtype;
classes* class;
int idx;
} methods;
typedef struct _methodTable {
classes* class;
struct {
strpair* tag;
void* method;
} m[MAXMETHOD];
} methodTable;
typedef struct _dispatchTable {
classes* class;
methodTable* mtable;
struct {
void* method;
} m[1];
} dispatchTable;
#define DTABLE_CLASS 0
#define DTABLE_MTABLEOFFSET 4
#define DTABLE_METHODOFFSET 8
#define DTABLE_METHODSIZE 4
#define MTABLE_CLASS 0
#define MTABLE_METHODOFFSET 4
#define MTABLE_METHODSIZE 8
#define MTABLE_TAG 0
#define MTABLE_METHOD 4
typedef struct _fields {
struct _fields* next;
char* name;
char* sig;
accessFlags accflags;
classes* class;
int size;
int offset;
} fields;
#define CLASSHASHSZ 128
#define CLASSMAXSIG 256
struct _Code;
struct _method_info;
struct _field_info;
struct _classFile;
classes* addClass(constIndex, constIndex, u2, struct _constants*);
methods* addMethod(classes*, struct _method_info*);
void addMethodCode(methods*, struct _Code*);
void finishClassMethods(classes*);
fields* addField(classes*, struct _field_info*);
void addCode(methods*, uint32, struct _classFile*);
classes* lookupClass(char*);
classes* simpleLookupClass(char*);
classes* lookupArray(char*);
fields* lookupClassField(char*, char*, bool);
void countInsAndOuts(char*, int*, int*, char*);
int sizeofSig(char**);
int sizeofSigItem(char**, char*);
void establishMethod(methods*);
void addInterfaces(classes*, int, classes**);
#endif