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

📄 rom.h

📁 This is a java virtual machine implement in c
💻 H
📖 第 1 页 / 共 2 页
字号:
/*0178*/    const struct internedStringInstanceStruct* String;
/*0179*/}; 
/*0180*/
/*0181*/#  define ROM_NTH_METHOD(clazz,index) \
/*0182*/         (&AllMethods.clazz ## _MethodSection.clazz.methods[index])
/*0183*/#  define ROM_NTH_FIELD(clazz,index)  (&AllFields.clazz.fields[index])
/*0184*/
/*0185*/
/*0186*/#if __GNUC__
/*0187*/#  define ROM_CPOOL_LENGTH(l)            { value: (l)  }
/*0188*/#  define ROM_CPOOL_INT(l)               { value: (l)  } 
/*0189*/#  define ROM_CPOOL_CLASS(c)             { clazz: (&AllClassblocks . c.clazz) }
/*0190*/#  define ROM_CPOOL_STRING(s)            { String: (s) }
/*0191*/#  define ROM_CPOOL_METHOD(clazz,index)  { method: ROM_NTH_METHOD(clazz,index) }
/*0192*/#  define ROM_CPOOL_FIELD(clazz, index)  { field:  ROM_NTH_FIELD(clazz,index) }
/*0193*/#else
/*0194*/#  define ROM_CPOOL_LENGTH(l)            { (long)(l)  }
/*0195*/#  define ROM_CPOOL_INT(l)               { (long)(l)  } 
/*0196*/#  define ROM_CPOOL_CLASS(c)             { (long)(&AllClassblocks . c) }
/*0197*/#  define ROM_CPOOL_STRING(s)            { (long)(s) }
/*0198*/#  define ROM_CPOOL_METHOD(clazz, index) { (long)ROM_NTH_METHOD(clazz,index) }
/*0199*/#  define ROM_CPOOL_FIELD(clazz,  index) { (long)ROM_NTH_FIELD(clazz,index)  }
/*0200*/#endif /* __GNUC__ */
/*0201*/
/*0202*//* In the KVM, constant pool items are always saved in big-endian order.
/*0203./ * But this may change in the future.
/*0204./ */
/*0205*/#define ROM_CPOOL_LONG(a, b)     ROM_CPOOL_INT(a), ROM_CPOOL_INT(b)
/*0206*/#define ROM_CPOOL_DOUBLE(a, b)   ROM_CPOOL_INT(a), ROM_CPOOL_INT(b)
/*0207*/
/*0208*/#define ROM_STATIC_INT(a)          a
/*0209*/#define ROM_STATIC_STRING(string) ((INSTANCE)string)
/*0210*/
/*0211*/#ifndef ROM_STATIC_LONG
/*0212*/#  if BIG_ENDIAN
/*0213*/#     define ROM_STATIC_LONG(a, b)   a,b
/*0214*/#  elif LITTLE_ENDIAN
/*0215*/#     define ROM_STATIC_LONG(a, b)   b,a
/*0216*/#  else
/*0217*/#     error Must set BIG_ENDIAN or LITTLE_ENDIAN
/*0218*/#  endif
/*0219*/#endif
/*0220*/
/*0221*/#ifndef ROM_STATIC_DOUBLE
/*0222*/#  if BIG_ENDIAN
/*0223*/#    define ROM_STATIC_DOUBLE(a, b)   a,b
/*0224*/#  elif LITTLE_ENDIAN
/*0225*/#    define ROM_STATIC_DOUBLE(a, b)   b,a
/*0226*/#  else
/*0227*/#     error Must set BIG_ENDIAN or LITTLE_ENDIAN
/*0228*/#  endif
/*0229*/#endif
/*0230*/
/*0231*/#define ROM_CLINIT_METHOD(clazz, index) ROM_NTH_METHOD(clazz, index)
/*0232*/
/*0233*/#define NameAndTypeKey(name, type) { { name, type } }
/*0234*/
/*0235*/#if __GNUC__
/*0236*/#   define FIELD_INFO(class, flags, off, nameTypeKey) \
/*0237*/       { nameTypeKey, flags, &AllClassblocks . class, { offset: off} }
/*0238*/#    define STATIC_FIELD_INFO(class, flags, off, nameTypeKey) \
/*0239*/       { nameTypeKey, flags, &AllClassblocks . class, { staticAddress: (KVM_staticData + off) } }
/*0240*/#else
/*0241*/#   define FIELD_INFO(class, flags, offset, nameTypeKey) \
/*0242*/       { nameTypeKey, flags, &AllClassblocks . class, { offset } }
/*0243*/#    define STATIC_FIELD_INFO(class, flags, offset, nameTypeKey) \
/*0244*/       { nameTypeKey, flags, &AllClassblocks . class, { (long)(KVM_staticData + offset) } }
/*0245*/#endif /* __GNUC__ */
/*0246*/
/*0247*/#define SIZEOF_T_CHAR 2
/*0248*/#define SIZEOF_T_BYTE 1
/*0249*/#define SIZEOF_T_SHORT 2
/*0250*/#define SIZEOF_T_INT 4
/*0251*/#define SIZEOF_T_LONG 8
/*0252*/#define SIZEOF_T_BOOLEAN 1
/*0253*/#define SIZEOF_T_FLOAT 4
/*0254*/#define SIZEOF_T_DOUBLE 8
/*0255*/#define SIZEOF_T_CLASS 4
/*0256*/
/*0257*//*
/*0258./ * In ROMjava.c we need to make several "forward static" declarations,
/*0259./ * where the forward declaration has no initializer and the later
/*0260./ * declaration has an initializer. Some compilers allow you to specify
/*0261./ * simply "static" in both places. Other compiler treat this as a 
/*0262./ * redefinition error and require the "forward" declaration to be
/*0263./ * "external". So, jcc emits the identifier
/*0264./ * "FORWARD_STATIC_DECLARATION", and each specific compiler will
/*0265./ * have to define this to be what is appropriate for that compiler.
/*0266./ *
/*0267./ * If a compiler has not defined this to be something else, we define
/*0268./ * it here for the most common case.
/*0269./ */
/*0270*/#ifndef FORWARD_STATIC_DECLARATION
/*0271*/#define FORWARD_STATIC_DECLARATION static
/*0272*/#endif
/*0273*/
/*0274*/#ifndef CONST
/*0275*/#if RELOCATABLE_ROM
/*0276*/#   define CONST
/*0277*/#else
/*0278*/#   define CONST const
/*0279*/#endif
/*0280*/#endif
/*0281*/
/*0282*//* These definitions are very specific to the Palm memory model */
/*0283*/#if RELOCATABLE_ROM
/*0284*/
/*0285*/struct NativeRelocationStruct {
/*0286*/    unsigned short resource;
/*0287*/    unsigned short offset;
/*0288*/    NativeFunctionPtr function;
/*0289*/};
/*0290*/
/*0291*/extern struct NativeRelocationStruct NativeRelocations[];
/*0292*/
/*0293*/#define NATIVE_RELOCATION_METHOD(clazz, index, nativeCode)           \
/*0294*/   {    clazz ## _MethodSectionNumber,                               \
/*0295*/        offsetof(struct AllMethods_Struct,                           \
/*0296*/        clazz ## _MethodSection.clazz.methods[index]) -              \
/*0297*/        offsetof(struct AllMethods_Struct, clazz ## _MethodSection), \
/*0298*/        nativeCode                                                   \
/*0299*/   }
/*0300*/
/*0301*//* These are the various resources that are stored as part of the kvm
/*0302./ * image on the Palm.    Each one is stored as a resource in KVM.prc
/*0303./ * The resource name is 'jROM'.  The resource ID is 1000 greater than 
/*0304./ * the resource number indicated in the enumeration below.
/*0305./ * (.e.g the table of contents is 'jROM' #1000.
/*0306./ *
/*0307./ * The StaticDataResource is somewhat special.  Various static fields point
/*0308./ * into this resource.  However it must be initialized.  It should also be
/*0309./ * set to 0's.
/*0310./ */
/*0311*/typedef enum { 
/*0312*/    TOCResource,
/*0313*/    UTFResource,
/*0314*/    StringResource,
/*0315*/    ClassDefsResource,
/*0316*/    HandlersResource,
/*0317*/    FieldsResource,
/*0318*/    ConstantPoolsResource,
/*0319*/    InterfacesResource,
/*0320*/    StackmapsResource,
/*0321*/    MasterStaticDataResource,
/*0322*/    StaticDataResource,
/*0323*/    LastResource = StaticDataResource
/*0324*/    /* Then follow the methodtable resources *
/*0325./     * ..... 
/*0326./     * Then follow the code resources
/*0327./     * .....
/*0328./     * Then a single unused resource 
/*0329./     */
/*0330*/} ROMResourceType;
/*0331*/
/*0332*/#define MAX_RESOURCE 40
/*0333*/
/*0334*/typedef struct ROMTableOfContentsType { 
/*0335*/    long methodTableResourceCount;
/*0336*/    long codeResourceCount;
/*0337*/    HASHTABLE hashtables[3];
/*0338*/    INSTANCE_CLASS classes[10];
/*0339*/    ARRAY_CLASS* arrayClasses;
/*0340*/#define ROM_FLAGS_DIRTY 0x01
/*0341*/    long flags;
/*0342*/    struct { 
/*0343*/        void *startAddress;
/*0344*/        union { 
/*0345*/            void *endAddress;
/*0346*/            long size;
/*0347*/        } u;
/*0348*/    } resources[MAX_RESOURCE];
/*0349*/} ROMTableOfContentsType, *ROMTableOfContentsPtr;
/*0350*/
/*0351*/#endif /* RELOCATABLE_ROM */
/*0352*/
/*0353*/

⌨️ 快捷键说明

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