📄 global.h
字号:
/*
* Copyright (c) 1998-2001 Sun Microsystems, Inc. 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.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*
*/
/*=========================================================================
* SYSTEM: KVM
* SUBSYSTEM: Global definitions
* FILE: global.h
* OVERVIEW: Global system-wide definitions.
* AUTHOR: Antero Taivalsaari, Sun Labs
* Many others since then...
*=======================================================================*/
/*=========================================================================
* COMMENT:
* This file contains declarations that do not belong to any
* particular structure or subsystem of the VM. There are many
* other additional global variable declarations in other files.
*=======================================================================*/
/*=========================================================================
* System include files
*=======================================================================*/
/* The performs per-machine initialization */
#include <MIDP\machine_md.h>
/*=========================================================================
* Global compile-time constants and typedefs
*=======================================================================*/
#undef TRUE
#undef FALSE
#define NIL 0
typedef enum {
FALSE = 0,
TRUE = 1
} bool_t;
/*=========================================================================
* Global data type declarations
*=======================================================================*/
/*=========================================================================
* NOTE: These type declarations are not quite as portable as they
* could be. It might be useful to declare specific type names for
* all Java-specific types (e.g., jint instead of normal int, jlong
* instead of long64, and so forth).
*=======================================================================*/
#define CELL 4 /* Size of a java word (= 4 bytes) */
#define log2CELL 2 /* Shift amount equivalent to dividing by CELL */
#define SHORTSIZE 2
typedef unsigned char BYTE;
typedef unsigned long cell; /* Must be 32 bits long! */
/*=========================================================================
* System-wide structure declarations
*=======================================================================*/
typedef struct classStruct* CLASS;
typedef struct instanceClassStruct* INSTANCE_CLASS;
typedef struct arrayClassStruct* ARRAY_CLASS;
typedef struct objectStruct* OBJECT;
typedef struct instanceStruct* INSTANCE;
typedef struct arrayStruct* ARRAY;
typedef struct stringInstanceStruct* STRING_INSTANCE;
typedef struct throwableInstanceStruct* THROWABLE_INSTANCE;
typedef struct internedStringInstanceStruct* INTERNED_STRING_INSTANCE;
typedef struct classInstanceStruct* CLASS_INSTANCE;
typedef struct byteArrayStruct* BYTEARRAY;
typedef struct shortArrayStruct* SHORTARRAY;
typedef struct pointerListStruct* POINTERLIST;
typedef struct weakPointerListStruct* WEAKPOINTERLIST;
typedef struct fieldStruct* FIELD;
typedef struct fieldTableStruct* FIELDTABLE;
typedef struct methodStruct* METHOD;
typedef struct methodTableStruct* METHODTABLE;
typedef struct stackMapStruct* STACKMAP;
typedef struct icacheStruct* ICACHE;
typedef struct chunkStruct* CHUNK;
typedef struct staticChunkStruct* STATICCHUNK;
typedef struct threadQueue* THREAD;
typedef struct javaThreadStruct* JAVATHREAD;
typedef struct monitorStruct* MONITOR;
typedef struct stackStruct* STACK;
typedef struct frameStruct* FRAME;
typedef struct exceptionHandlerStruct* HANDLER;
typedef struct exceptionHandlerTableStruct* HANDLERTABLE;
typedef struct filePointerStruct* FILEPOINTER;
typedef union constantPoolEntryStruct* CONSTANTPOOL_ENTRY;
typedef struct constantPoolStruct* CONSTANTPOOL;
typedef char* BYTES;
typedef FILEPOINTER *FILEPOINTER_HANDLE;
typedef OBJECT *OBJECT_HANDLE;
typedef INSTANCE *INSTANCE_HANDLE;
typedef ARRAY *ARRAY_HANDLE;
typedef POINTERLIST *POINTERLIST_HANDLE;
typedef WEAKPOINTERLIST *WEAKPOINTERLIST_HANDLE;
typedef JAVATHREAD *JAVATHREAD_HANDLE;
typedef BYTES *BYTES_HANDLE;
typedef METHOD *METHOD_HANDLE;
typedef FRAME *FRAME_HANDLE;
typedef const char* *CONST_CHAR_HANDLE;
typedef unsigned char* *UNSIGNED_CHAR_HANDLE;
typedef STRING_INSTANCE *STRING_INSTANCE_HANDLE;
typedef THROWABLE_INSTANCE *THROWABLE_INSTANCE_HANDLE;
typedef THREAD *THREAD_HANDLE;
#define ByteSizeToCellSize(n) (((n) + (CELL - 1)) >> log2CELL)
#define StructSizeInCells(structName) ((sizeof(struct structName) + 3) >> 2)
#define UnionSizeInCells(structName) ((sizeof(union structName) + 3) >> 2)
/* Field and Method key types */
typedef unsigned short NameKey;
typedef unsigned short MethodTypeKey;
typedef unsigned short FieldTypeKey;
typedef union {
struct {
unsigned short nameKey;
unsigned short typeKey; /* either MethodTypeKey or FieldTypeKey */
} nt;
unsigned long i;
} NameTypeKey;
/* Machines such as the Palm that use something other than FILE* for stdin
* and stdout should redefine this in their machine_md.h
*/
#ifndef LOGFILEPTR
#define LOGFILEPTR FILE*
#endif
/*=========================================================================
* Locally defined include files
*=======================================================================*/
#include <MIDP\messages.h>
#include <MIDP\main.h>
#include <MIDP\long.h>
#include <MIDP\garbage.h>
#include <MIDP\interpret.h>
#include <MIDP\hashtable.h>
#if ENABLE_JAVA_DEBUGGER
#include <MIDP\debuggerStreams.h>
#include <MIDP\debugger.h>
#endif /* ENABLE_JAVA_DEBUGGER */
#include <MIDP\class.h>
#include <MIDP\thread.h>
#include <MIDP\pool.h>
#include <MIDP\fields.h>
#include <MIDP\frame.h>
#include <MIDP\loader.h>
#include <MIDP\native.h>
#include <MIDP\cache.h>
#include <MIDP\runtime.h>
#include <MIDP\profiling.h>
#include <MIDP\verifier.h>
#include <MIDP\log.h>
#include <MIDP\property.h>
/* The network protocol implementations. These */
/* are not part of the CLDC Specification. */
#include <MIDP\commProtocol.h>
#include <MIDP\datagramProtocol.h>
#include <MIDP\socketProtocol.h>
/*=========================================================================
* Miscellaneous global variables
*=======================================================================*/
/* Shared string buffer that is used internally by the VM */
extern char str_buffer[];
/* Requested heap size when starting the VM from command line */
extern long RequestedHeapSize;
/*=========================================================================
* Global execution modes
*=======================================================================*/
/* Flags for toggling certain global modes on and off */
extern bool_t JamEnabled;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -