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

📄 main.h

📁 一个操作系统源代码 用于嵌入式设备 在Vc++环境下仿真 成功移植到多款处理器上
💻 H
📖 第 1 页 / 共 2 页
字号:
 * checking. When turned on, the system checks that the given constant
 * pool references point to appropriate constant pool entries at
 * runtime, thus verifying the structural integrity of the class.
 * As obvious, the system runs slightly faster with the integrity
 * checking turned off. This check is not required by the JVM
 * spec, but provides some additional assurance that the VM is
 * behaving properly and that classfiles don't contain illegal code.
 */
#ifndef VERIFYCONSTANTPOOLINTEGRITY
#define VERIFYCONSTANTPOOLINTEGRITY 1
#endif

/* This macro makes the virtual machine sleep when it has
 * no better things to do. The default implementation is
 * a busy loop. Most ports usually require a more efficient
 * implementation that allow the VM to utilize the host-
 * specific battery power conservation features.
 *
 */
#ifndef SLEEP_UNTIL
#   define SLEEP_UNTIL(wakeupTime)                              \
        for (;;) {                                              \
                ulong64 now = CurrentTime_md();                 \
                if (ll_compare_ge(now, wakeupTime)) {           \
                        break;                                  \
                }                                               \
    }
#endif

/*=========================================================================
 * KVM 1.0.2 interpreter execution options (redesigned interpreter)
 *=======================================================================*/

/* Enabling this option will cause the interpreter to permit
 * thread rescheduling only at branch and return statements.
 * Disabling the options allows thread rescheduling to occur
 * at the start of every bytecode (as in KVM 1.0).  Turning
 * this option on will speed up the interpreter by about 5%
 * (simply because the time slice counter will be updated
 * less frequently.)
 */
#ifndef RESCHEDULEATBRANCH
#define RESCHEDULEATBRANCH 1
#endif

/* The time slice factor is used to calculate the base time slice and to
 * set up a timeslice when a thread has its priority changed. This
 * value determines how much execution time each thread receives
 * before a thread switch occurs. Default value 100 is used when  
 * the RESCHEDULEATBRANCH option is on (meaning that the VM will
 * switch threads when 100 branch instructions have been executed.)
 * If RESCHEDULEATBRANCH option is off, we use value 1000 (meaning
 * that thread switch occurs after this many bytecodes have been
 * executed.)
 */
#ifndef TIMESLICEFACTOR
#if RESCHEDULEATBRANCH
#define TIMESLICEFACTOR 100
#else
#define TIMESLICEFACTOR 1000
#endif
#endif

/* The value of this macro determines the basic frequency (as a number
 * of bytecodes executed) by which the virtual machine performs thread
 * switching, event notification, and some other periodically needed
 * operations. A smaller number reduces event handling and thread
 * switching latency, but causes the interpreter to run slower.
 */
#ifndef BASETIMESLICE
#define BASETIMESLICE     TIMESLICEFACTOR
#endif

/* This option will cause the infrequently called Java bytecodes to be 
 * split into a separate interpreter loop. It has been found that 
 * doing so gives a small space and performance benefit on many systems.
 * 
 * IMPORTANT: This option works well only if ENABLEFASTBYTECODES
 * option is also turned on.  For this reason, we currently 
 * should not use this option on the Palm.
 */
#ifndef SPLITINFREQUENTBYTECODES
#define SPLITINFREQUENTBYTECODES 1
#endif

/* This option when enabled will cause the main switch() statement in the
 * interpreter loop to be padded with entries for unused bytecodes. It has
 * been found that doing so on some systems will cause the code for the
 * switch table to be larger, but the resulting code runs substantially 
 * faster. Use this option only when space is not absolutely critical.
 */
#ifndef PADTABLE
#define PADTABLE 0
#endif

/* Turning this option on will allow the VM to allocate all the
 * virtual machine registers (ip, fp, sp, lp and cp) in native
 * registers inside the Interpret() routine.  Enabling this feature
 * significantly speeds up the interpreter (actual performance 
 * improvement depends on how good a job your C compiler does 
 * when compiling the interpreter loop.)  This option is specific
 * to KVM 1.0.2. When turned off, the interpreter speed is about 
 * the same as in KVM 1.0.
 */
#ifndef LOCALVMREGISTERS
#define LOCALVMREGISTERS 1
#endif

/* The following definitions determine which virtual machine registers
 * should be made local to the main interpreter loop.  These macros
 * allow you to more precisely control the allocation of these VM 
 * registers to hardware registers, yet in a portable fashion. This
 * is valuable especially on those target platforms that have a 
 * limited number of hardware registers. Note that these macros
 * have effect only if the LOCALVMREGISTERS option above is turned on.
 *
 * The macros below are defined in the order of "most-to-least
 * bang-for-the-buck". In order to improve Java interpreter
 * performance, IP and SP are most critical, then LP, FP and CP.
 */
/* IP = Instruction Pointer */
#ifndef IPISLOCAL
#define IPISLOCAL 1
#endif

/* SP = Stack Pointer */
#ifndef SPISLOCAL
#define SPISLOCAL 1
#endif

/* LP = Locals Pointer */
#ifndef LPISLOCAL
#define LPISLOCAL 0
#endif

/* FP = Frame Pointer */
#ifndef FPISLOCAL
#define FPISLOCAL 0
#endif

/* CP = Constant Pool Pointer */
#ifndef CPISLOCAL
#define CPISLOCAL 0
#endif

/*=========================================================================
 * Java-level debugging options
 *=======================================================================*/

/* KVM includes an interface that allows the virtual machine
 * to be plugged into a third-party source-level Java debugger
 * such as Forte, CodeWarrior or JBuilder.
 *
 * The macros below are related to the use of the new
 * Java-level debugger.  Actual debugger code is located
 * in directory VmExtra.
 */

/* Include code that interacts with an external Java debugger.
 */
#ifndef ENABLE_JAVA_DEBUGGER
#define ENABLE_JAVA_DEBUGGER 1
#endif

/*=========================================================================
 * Debugging and tracing options
 *=======================================================================*/

/* The macros below enable/disable the debugging of the KVM itself
 * (at the C code level).  These macros, inherited from KVM 1.0,
 * are independent of the Java-level debugging macros defined above.
 */

/* 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.  This option is normally turned off in 
 * production builds.
 */
#ifndef INCLUDEDEBUGCODE
#define INCLUDEDEBUGCODE 0
#endif

/* Turns VM execution profiling and additional safety/sanity
 * checks on/off.  VM will run slightly slower with this option on.
 * This option should normally be turned off in production builds.
 */
#ifndef ENABLEPROFILING
#define ENABLEPROFILING 0
#endif

/*=========================================================================
 * Compile-time flags for choosing different tracing/debugging options.
 * These options can make the system very verbose. Turn them all off
 * for normal VM operation.  When turning them on, it is useful to
 * turn INCLUDEDEBUGCODE on, too, since many of the routines utilize
 * debugging code to provide more detailed information to the user.
 *=======================================================================*/

/* Prints out less verbose messages on small machines */
#ifndef TERSE_MESSAGES
#define TERSE_MESSAGES 0
#endif

/*  Turns exception handling backtrace information on/off */
#ifndef PRINT_BACKTRACE
#define PRINT_BACKTRACE INCLUDEDEBUGCODE
#endif

/*=========================================================================
 * Miscellaneous macros and options
 *=======================================================================*/

/* Some functions in the reference implementation take arguments
 * that they do not use. Some compilers will issue warnings; others
 * do not. For those compilers that issue warnings, this macro
 * can be used to indicate that the corresponding variable,
 * though and argument to the function, isn't actually used.
 */
#ifndef UNUSEDPARAMETER
#define UNUSEDPARAMETER(x)
#endif

/* Some ROMized implementations may want to forbid any new classes 
 * from being loaded into any system package.  The following macro
 * defines whether a package name is one of these restricted packages.
 * By default, we prevent dynamic class loading to java.* and javax.*.
 */
#ifndef IS_RESTRICTED_PACKAGE_NAME
#define IS_RESTRICTED_PACKAGE_NAME(name) \
     ((strncmp(name, "java.", 5) == 0) || (strncmp(name, "javax.", 6) == 0))  
#endif

/*=========================================================================
 * VM startup function prototypes
 *=======================================================================*/

int StartJVM(int argc, char* argv[]);
int KVM_Initialize(void);
int KVM_Start(int argc, char* argv[]);
void KVM_Cleanup(void);


⌨️ 快捷键说明

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