📄 oobj.h
字号:
/* * @(#)oobj.h 1.5 00/04/12 * * Copyright 1995-1998 by Sun Microsystems, Inc., * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. * All rights reserved. * * This software is the confidential and proprietary information * of Sun Microsystems, Inc. ("Confidential Information"). You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with Sun. * Use is subject to license terms. *//* * Java object header format */#ifndef _OOBJ_H_#define _OOBJ_H_#include <stddef.h>#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <limits.h>#include <typedefs.h>#include <signature.h>#define JAVA_CLASSFILE_MAGIC 0xCafeBabe#define JAVASRCEXT "java"#define JAVASRCEXTLEN 4#define JAVAOBJEXT "class"#define JAVAOBJEXTLEN 5#define JAVA_VERSION 45#define JAVA_MINOR_VERSION 3#define ARRAYHEADER long alloclen/* The size (in bytes) of a statically allocated area that the * verifier uses internally in various string operations. */#ifndef STRINGBUFFERSIZE#define STRINGBUFFERSIZE 512#endif#define MAXOPTIONS 2048 /* maximum # of parameters *//* maximum size allowed for package name of a class file */#define MAXPACKAGENAME 1024#define MAXPATHLEN 255#define HandleTo(T) typedef struct H##T { Class##T *obj; struct methodtable *methods;} H##Ttypedef long OBJECT;typedef OBJECT Classjava_lang_Object;typedef OBJECT ClassObject;HandleTo(java_lang_Object);typedef Hjava_lang_Object JHandle;typedef Hjava_lang_Object HObject;typedef unsigned short unicode;extern unicode *str2unicode(char *, unicode *, long);extern char *int642CString(int64_t number, char *buf, int buflen);#define ALIGN(n) (((n)+3)&~3)#define UCALIGN(n) ((unsigned char *)ALIGN((int)(n)))struct Hjava_lang_Class; /* forward reference for some compilers */struct Classjava_lang_Class; /* forward reference for some compilers */typedef struct Classjava_lang_Class Classjava_lang_Class;HandleTo(java_lang_Class);typedef struct Hjava_lang_Class ClassClass;struct fieldblock { ClassClass *clazz; char *signature; char *name; unsigned long ID; unsigned short access; union { unsigned long offset; /* info of data */ OBJECT static_value; void *static_address; } u; unsigned deprecated:1; unsigned synthetic:1;};#define fieldname(fb) ((fb)->name)#define fieldsig(fb) ((fb)->signature)#define fieldIsArray(fb) (fieldsig(fb)[0] == SIGNATURE_ARRAY)#define fieldIsClass(fb) (fieldsig(fb)[0] == SIGNATURE_CLASS)#define fieldclass(fb) ((fb)->clazz)struct execenv;#define VERIFIER_TOOL/* Includes/eliminates a large amount of optional debugging code * (such as class and stack frame printing operations) in/from * the system. By eliminating debug code, the system will be smaller. * Inclusion of debugging code increases the size of the system but * does not introduce any performance overhead unless calls to the * debugging routines are added to the source code or various tracing * options are turned on. */#ifndef INCLUDEDEBUGCODE#define INCLUDEDEBUGCODE 0#endif#define DEBUG_VERIFIER 1#define DEBUG_READFROMFILE 0enum { ITEM_Bogus, ITEM_Void, /* only as a function return value */ ITEM_Integer, ITEM_Float, ITEM_Double, ITEM_Double_2, /* 2nd word of double in register */ ITEM_Long, ITEM_Long_2, /* 2nd word of long in register */ ITEM_InitObject, /* "this" is init method, before call to super() */ ITEM_Object, /* Extra info field gives name. */ ITEM_NewObject, /* Like object, but uninitialized. */ ITEM_ReturnAddress, /* Extra info gives instr # of start pc */ /* The following three are only used within array types. * Normally, we use ITEM_Integer, instead. */ ITEM_Boolean, ITEM_Byte, ITEM_Short, ITEM_Char};/* These are the constants that appear in class files. */enum { CF_ITEM_Bogus, CF_ITEM_Integer, CF_ITEM_Float, CF_ITEM_Double, CF_ITEM_Long, CF_ITEM_Null, CF_ITEM_InitObject, CF_ITEM_Object, CF_ITEM_NewObject,};struct map_entry { unsigned char type; long info;};struct stack_map { int offset; int nlocals; struct map_entry *locals; int nstacks; struct map_entry *stacks;};struct methodblock { struct fieldblock fb; unsigned char *code; /* the code */ struct CatchFrame *exception_table; struct lineno *line_number_table; struct localvar *localvar_table; unsigned long code_length; unsigned long exception_table_length; unsigned long line_number_table_length; unsigned long localvar_table_length; bool_t (*invoker) (JHandle *o, struct methodblock *mb, int args_size, struct execenv *ee); unsigned short args_size; /* total size of all arguments */ unsigned short maxstack; /* maximum stack usage */ unsigned short nlocals; /* maximum number of locals */ /* 2 spare bytes here */ void *CompiledCode; /* it's type is machine dependent */ void *CompiledCodeInfo; /* it's type is machine dependent */ long CompiledCodeFlags; /* machine dependent bits */ unsigned long inlining; /* possible inlining of code */ unsigned short nexceptions; /* number of checked exceptions */ unsigned short *exceptions; /* constant pool indices */ char *mp_marks; int n_stack_maps; struct stack_map *stack_maps;};struct HIOstream;struct methodtable { ClassClass *classdescriptor; struct methodblock *methods[1];};struct imethodtable { int icount; /* number of interfaces to follow */ struct { ClassClass *classdescriptor; unsigned long *offsets; /* info of data */ } itable[1];};typedef struct { char body[1];} ArrayOfByte;typedef ArrayOfByte ClassArrayOfByte;HandleTo(ArrayOfByte);typedef struct { unicode body[1];} ArrayOfChar;typedef ArrayOfChar ClassArrayOfChar;HandleTo(ArrayOfChar);typedef struct { signed short body[1];} ArrayOfShort;typedef ArrayOfShort ClassArrayOfShort;HandleTo(ArrayOfShort);typedef struct { long body[1];} ArrayOfInt;typedef ArrayOfInt ClassArrayOfInt;HandleTo(ArrayOfInt);typedef struct { int64_t body[1];} ArrayOfLong;typedef ArrayOfLong ClassArrayOfLong;HandleTo(ArrayOfLong);typedef struct { float body[1];} ArrayOfFloat;typedef ArrayOfFloat ClassArrayOfFloat;HandleTo(ArrayOfFloat);typedef struct { double body[1];} ArrayOfDouble;typedef ArrayOfDouble ClassArrayOfDouble;HandleTo(ArrayOfDouble);typedef struct { JHandle *(body[1]);} ArrayOfArray;typedef ArrayOfArray ClassArrayOfArray;HandleTo(ArrayOfArray);typedef struct { HObject *(body[1]);} ArrayOfObject;typedef ArrayOfObject ClassArrayOfObject;HandleTo(ArrayOfObject);typedef struct Hjava_lang_String HString;typedef struct { HString *(body[1]);} ArrayOfString;typedef ArrayOfString ClassArrayOfString;HandleTo(ArrayOfString);/* Note: any handles in this structure must also have explicit code in the ScanClasses() routine of the garbage collector to mark the handle. */struct Classjava_lang_Class { /* Things following here are saved in the .class file */ unsigned short major_version; unsigned short minor_version; char *name; char *super_name; char *source_name; ClassClass *superclass; ClassClass *HandleToSelf; struct Hjava_lang_ClassLoader *loader; struct methodblock *finalizer; union cp_item_type *constantpool; struct methodblock *methods; struct fieldblock *fields; short *implements; struct methodtable *methodtable; struct methodtable *methodtable_mem; struct fieldblock **slottable; HString *classname; union { struct { unsigned long thishash; /* unused */ unsigned long totalhash; /* unused */ } cbhash; struct { unsigned char typecode; /* VM typecode */ char typesig; /* signature constant */ unsigned char slotsize; /* (bytes) in slot */ unsigned char elementsize; /* (bytes) in array */ unsigned long xxspare; } cbtypeinfo; } hashinfo; unsigned short constantpool_count; /* number of items in pool */ unsigned short methods_count; /* number of methods */ unsigned short fields_count; /* number of fields */ unsigned short implements_count; /* number of protocols */ unsigned short methodtable_size; /* the size of method table */ unsigned short slottbl_size; /* size of slottable */ unsigned short instance_size; /* (bytes) of an instance */ unsigned short access; /* how this class can be accesses */ unsigned short flags; /* see the CCF_* macros */ struct HArrayOfObject *signers; struct imethodtable *imethodtable; void *init_thread; /* EE of initializing thread */ ClassClass *last_subclass_of; void *reserved_for_jit; char *absolute_source_name; struct { int high, low; } timestamp; int n_new_class_entries;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -