⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rom.h

📁 This is a java virtual machine implement in c
💻 H
📖 第 1 页 / 共 2 页
字号:
/*0001*//*
/*0002./ * Copyright (c) 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
/*0003./ * 
/*0004./ * This software is the confidential and proprietary information of Sun
/*0005./ * Microsystems, Inc. ("Confidential Information").  You shall not
/*0006./ * disclose such Confidential Information and shall use it only in
/*0007./ * accordance with the terms of the license agreement you entered into
/*0008./ * with Sun.
/*0009./ * 
/*0010./ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
/*0011./ * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
/*0012./ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/*0013./ * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
/*0014./ * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
/*0015./ * THIS SOFTWARE OR ITS DERIVATIVES.
/*0016./ * 
/*0017./ */
/*0018*/
/*0019*//*=========================================================================
/*0020./ * SYSTEM:    KVM 
/*0021./ * SUBSYSTEM: Romizer
/*0022./ * FILE:      rom.h
/*0023./ * OVERVIEW:  Macros needed by ROMjava.c
/*0024./ * AUTHOR:    Frank Yellin
/*0025./ *
/*0026./ * IMPORTANT: The data structure definitions in this file are heavily
/*0027./ *            tied to the structure definitions in other VM files
/*0028./ *            (class.h, fields.h, ...).  If you change the order of
/*0029./ *            data elements in internal KVM runtime structures, the
/*0030./ *            definitions in this file must also change.  Otherwise,
/*0031./ *            the romizer will not work correctly.
/*0032./ *=======================================================================*/
/*0033*/
/*0034*//*******
/*0035./ * NOTE:  The code will compile with gcc even if the __GNUC__ conditionals
/*0036./ * below are removed.
/*0037./ * 
/*0038./ * However the gnu C compiler has special syntax that can be used for 
/*0039./ * initializing a union.  We use that syntax for added type checking.
/*0040./ * We avoid having to do lots of casts.
/*0041./ *
/*0042./ * Some compilers do not allow you to cast a pointer to a long as part of
/*0043./ * constant initialization.  Hopefully, these compilers do have some
/*0044./ * means of initializing union types.   Porters can use the __GNUC__ code
/*0045./ * as a starting point. 
/*0046./ *********/
/*0047*/
/*0048*//* A character array of a specific length.  We need to add the junk header,
/*0049./ * since the GC may look at it (some code accesses it), even though it
/*0050./ * doesn't care what value it has.   This is particularly a problem on the 
/*0051./ * Palm, where the header word might not even exist.
/*0052./ */
/*0053*/
/*0054*//* The layout of an originally created string */
/*0055*/
/*0056*/
/*0057*/#define KVM_INIT_JAVA_STRING(offset, length, next) \
/*0058*/    { &AllClassblocks.java_lang_String, { NULL }, \
/*0059*/      (SHORTARRAY)&stringCharArrayInternal, offset, length, \
/*0060*/      (INTERNED_STRING_INSTANCE)next }
/*0061*/
/*0062*/#define CHARARRAY_X(len)              \
/*0063*/    struct {                          \
/*0064*/      COMMON_OBJECT_INFO(ARRAY_CLASS) \
/*0065*/      cell  length;                   \
/*0066*/      unsigned short sdata[len];      \
/*0067*/    }
/*0068*/
/*0069*/#define CHARARRAY_HEADER(len) \
/*0070*/    &AllClassblocks.manufacturedArrayOfChar, { NULL}, len
/*0071*/
/*0072*//* A hashtable of a specific length, and its header */
/*0073*/
/*0074*/#define HASHTABLE_X(size)     \
/*0075*/    struct {                  \
/*0076*/        long bucketCount;      \
/*0077*/        long count;            \
/*0078*/        void *bucket[size];   \
/*0079*/    }
/*0080*/
/*0081*/#define HASHTABLE_HEADER(size, count) \
/*0082*/    size, count
/*0083*/
/*0084*/#define HANDLERTABLE_X(len) \
/*0085*/    struct {                \
/*0086*/        long length;        \
/*0087*/        struct exceptionHandlerStruct handlers[len]; \
/*0088*/    }
/*0089*/
/*0090*/#define HANDLER_HEADER(len) len
/*0091*/
/*0092*/#define HANDLER_ENTRY(start, end, handler, exception) \
/*0093*/{ start, end, handler, exception }
/*0094*/
/*0095*/#define DECLARE_USTRING_STRUCT(len)  \
/*0096*/    struct UTF_Hash_Entry_ ## len {  \
/*0097*/        UString next;                \
/*0098*/        unsigned short length;       \
/*0099*/        unsigned short key;          \
/*0100*/        char string[len + 1];        \
/*0101*/}
/*0102*/
/*0103*/#define USTRING_STRUCT(len) \
/*0104*/    struct UTF_Hash_Entry_ ## len 
/*0105*/
/*0106*/#define USTRING(key, next, len, string) \
/*0107*/    { (UString)next, len, 0x ## key, string }
/*0108*/
/*0109*/
/*0110*/#define INSTANCE_INFO(package, base, next, key, access, size, status,   \
/*0111*/                       super, methods, fields, constants, intfs)        \
/*0112*/{ { &AllClassblocks.java_lang_Class, { NULL } , \
/*0113*/    (UString)package, (UString)base, (CLASS)next, access, key },        \
/*0114*/    super, (CONSTANTPOOL)constants, (FIELDTABLE)fields,                 \
/*0115*/    (METHODTABLE)methods, (unsigned short*)intfs, NULL /* statics */, size, status, NULL }
/*0116*/
/*0117*/#define RAW_CLASS_INFO(package, base, next, key, access, ignore)        \
/*0118*/{ { &AllClassblocks.java_lang_Class, { NULL } , \
/*0119*/    (UString)package, (UString)base, (CLASS)next, access, key } }
/*0120*/
/*0121*/
/*0122*/#define ARRAY_OF_PRIMITIVE(package, base, next, key, access, typeName)  \
/*0123*/{ { &AllClassblocks.java_lang_Class, { NULL } , \
/*0124*/    (UString)package, (UString)base, (CLASS)next, access, key },        \
/*0125*/   { (CLASS)(T_ ## typeName) }, SIZEOF_T_ ## typeName, GCT_ARRAY }
/*0126*/
/*0127*/
/*0128*/#define ARRAY_OF_OBJECT(package, base, next, key, access, elem)         \
/*0129*/{ { &AllClassblocks.java_lang_Class, { NULL } , \
/*0130*/    (UString)package, (UString)base, (CLASS)next, access, key },        \
/*0131*/    { (CLASS)&elem }, SIZEOF_T_CLASS, GCT_OBJECTARRAY }
/*0132*/
/*0133*/#ifdef __GNUC__
/*0134*/#   define METHOD_INFO(class, code, handlers, stackMaps, flags, argSize, frameSize, maxStackSize, codeSize, nameTypeKey) \
/*0135*/        { nameTypeKey, \
/*0136*/        { java:{ code, (HANDLERTABLE)handlers, {(STACKMAP)stackMaps}, codeSize, maxStackSize } }, \
/*0137*/        flags, &AllClassblocks . class, \
/*0138*/        frameSize, argSize }
/*0139*/
/*0140*/#   define ABSTRACT_METHOD_INFO(class, flags, argSize, nameTypeKey)     \
/*0141*/        { nameTypeKey,                                                  \
/*0142*/        { java:{ 0, 0, {NULL}, 0} },                                    \
/*0143*/        flags, &AllClassblocks . class,                                 \
/*0144*/        0, argSize }
/*0145*/
/*0146*/#   define NATIVE_METHOD_INFO(class, nativeCode, flags, argSize, nameTypeKey) \
/*0147*/        { nameTypeKey,                                                  \
/*0148*/        { native:{ nativeCode } },                                      \
/*0149*/        flags, &AllClassblocks . class,                                 \
/*0150*/        0, argSize }
/*0151*/
/*0152*/#else
/*0153*/#   define METHOD_INFO(class, code, handlers, stackMaps, flags, argSize, frameSize, maxStackSize, codeSize, nameTypeKey)                         \
/*0154*/        { nameTypeKey,                                                  \
/*0155*/        { {(BYTE*)code, (HANDLERTABLE)handlers, {(STACKMAP)stackMaps}, codeSize, maxStackSize } },                                                       \
/*0156*/        flags, &AllClassblocks . class,                                 \
/*0157*/        frameSize, argSize }
/*0158*/
/*0159*/#   define ABSTRACT_METHOD_INFO(class, flags, argSize, nameTypeKey)     \
/*0160*/        { nameTypeKey,                                                  \
/*0161*/        { { NULL, NULL, {NULL}, 0} },                                   \
/*0162*/        flags, &AllClassblocks . class, 0, argSize }
/*0163*/
/*0164*/#   define NATIVE_METHOD_INFO(class, nativeCode, flags, argSize, nameTypeKey) \
/*0165*/        { nameTypeKey,                                                  \
/*0166*/        { { (unsigned char *)nativeCode } },                            \
/*0167*/        flags, &AllClassblocks . class, 0, argSize }
/*0168*/
/*0169*/#endif /* __GNUC__ */
/*0170*/
/*0171*/
/*0172*//* Constant Pool */
/*0173*/union ROMconstantPoolEntryStruct {
/*0174*/    long            value;
/*0175*/    const struct classStruct *clazz;
/*0176*/    const struct fieldStruct *field;
/*0177*/    const struct methodStruct *method;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -