📄 execute.h
字号:
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*******************************************************************************
* Filename:
* ---------
* execute.h
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
*
*
* Author:
* -------
*
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
/*
* Copyright ?2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*/
/*=========================================================================
* SYSTEM: KVM
* SUBSYSTEM: Bytecode interpreter
* FILE: execute.h
* OVERVIEW: This file defines macros for the Java interpreter
* execution loop. These macros are needed by the
* redesigned interpreter loop.
* AUTHOR: Nik Shaylor 9/5/2000
*=======================================================================*/
/*=========================================================================
* Include files
*=======================================================================*/
/*=========================================================================
* Additional build options (standard options are defined in main.h)
*=======================================================================*/
/* The following options are intended for interpreter debugging
* and customization. Normally you should not change these
* definitions, and that's why they are here instead of
* main.h where the user-level customization options are.
*/
/* COMMONBRANCHING effects the BRANCHIF macro. The original macro
* would load the ip in the body of the macro. This option causes a
* branch to a common place where this is done. There seems no
* disadvantage to doing it this way.
*/
#ifndef COMMONBRANCHING
#define COMMONBRANCHING 1
#endif
/* Private instrumentation code that is useful for
* measuring changes to the interpreter.
*/
#ifndef INSTRUMENT
#define INSTRUMENT 0
#endif
/* Turn this on to do a GC between every bytecode
* (Painfully/ridiculously slow...)
*/
#ifndef VERY_EXCESSIVE_GARBAGE_COLLECTION
#define VERY_EXCESSIVE_GARBAGE_COLLECTION 0
#endif
/*=========================================================================
* Setup default local register values if LOCALVMREGISTERS is enabled
*=======================================================================*/
#if LOCALVMREGISTERS
/* IP = Instruction pointer */
#ifndef IPISLOCAL
#define IPISLOCAL 1
#endif
/* SP = (Operand) Stack pointer */
#ifndef SPISLOCAL
#define SPISLOCAL 1
#endif
/* LP = Locals Pointer */
#ifndef LPISLOCAL
#ifdef CLDC11
#define LPISLOCAL 0
#else
#define LPISLOCAL 1
#endif /* CLDC11 */
#endif
/* FP = Frame Pointer */
#ifndef FPISLOCAL
#define FPISLOCAL 0
#endif
/* CP = Constant Pool Pointer */
#ifndef CPISLOCAL
#define CPISLOCAL 0
#endif
#else
/*=========================================================================
* Setup default local register values if LOCALVMREGISTERS is not enabled
*=======================================================================*/
#ifdef IPISLOCAL
#undef IPISLOCAL
#endif
#ifdef SPISLOCAL
#undef SPISLOCAL
#endif
#ifdef LPISLOCAL
#undef LPISLOCAL
#endif
#ifdef FPISLOCAL
#undef FPISLOCAL
#endif
#ifdef CPISLOCAL
#undef CPISLOCAL
#endif
#define IPISLOCAL 0
#define FPISLOCAL 0
#define SPISLOCAL 0
#define LPISLOCAL 0
#define CPISLOCAL 0
#endif /* LOCALVMREGISTERS */
/*=========================================================================
* Extreme debug option to call the garbage collector before every bytecode
*=======================================================================*/
#if VERY_EXCESSIVE_GARBAGE_COLLECTION
#define DO_VERY_EXCESSIVE_GARBAGE_COLLECTION { \
VMSAVE \
garbageCollect(0); \
VMRESTORE \
}
#else
#if ASYNCHRONOUS_NATIVE_FUNCTIONS && EXCESSIVE_GARBAGE_COLLECTION
#define DO_VERY_EXCESSIVE_GARBAGE_COLLECTION { \
extern bool_t veryExcessiveGCrequested; \
if (veryExcessiveGCrequested) { \
VMSAVE \
garbageCollect(0); \
VMRESTORE \
veryExcessiveGCrequested = FALSE; \
} \
}
#else
#define DO_VERY_EXCESSIVE_GARBAGE_COLLECTION /**/
#endif
#endif
/*=========================================================================
* Instrumentation macros
*=======================================================================*/
#if INSTRUMENT
#define INC_CALLS calls++;
#define INC_RESHED reshed++;
#define INC_BYTECODES bytecodes++;
#define INC_SLOWCODES slowcodes++;
#define INC_BRANCHES branches++;
#else
#define INC_CALLS /**/
#define INC_RESHED /**/
#define INC_BYTECODES /**/
#define INC_SLOWCODES /**/
#define INC_BRANCHES /**/
#endif /* INSTRUMENT */
/*=========================================================================
* SELECT - Macros to define bytecode(s)
*=======================================================================*/
#define SELECT(l1) case l1: {
#define SELECT2(l1, l2) case l1: case l2: {
#define SELECT3(l1, l2, l3) case l1: case l2: case l3: {
#define SELECT4(l1, l2, l3, l4) case l1: case l2: case l3: case l4: {
#define SELECT5(l1, l2, l3, l4, l5) case l1: case l2: case l3: case l4: case l5: {
#define SELECT6(l1, l2, l3, l4, l5, l6) case l1: case l2: case l3: case l4: case l5: case l6: {
/*=========================================================================
* DONE - To end a bytecode definition and increment ip
*=======================================================================*/
#define DONE(n) } goto next##n;
#if FASTBYTECODEFLASHVER
#define DONE_F(n) goto next##n;
#endif /* end of #if FASTBYTECODEFLASHVER */
/*=========================================================================
* DONEX - To end a bytecode definition without goto
*=======================================================================*/
#define DONEX }
/*=========================================================================
* DONE_R - To end a bytecode definition and test for thread rescheduling
*=======================================================================*/
#define DONE_R } goto reschedulePoint;
/*=========================================================================
* CHECKARRAY - To check for valid array access
*=======================================================================*/
#define CHECKARRAY(thisArray, index) \
if (thisArray) { \
/* Check that the given index is within array boundaries */ \
if (index >= 0 && index < (long)thisArray->length) {
/*=========================================================================
* ENDCHECKARRAY - Finish the check for valid array access
*=======================================================================*/
#define ENDCHECKARRAY \
} else goto handleArrayIndexOutOfBoundsException; \
} else goto handleNullPointerException; \
/*=========================================================================
* CALL_VIRTUAL_METHOD - Branch to common code for Invokevirtual
*=======================================================================*/
#define CALL_VIRTUAL_METHOD { \
goto callMethod_virtual; \
}
/*=========================================================================
* CALL_STATIC_METHOD - Branch to common code for Invokestatic
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -