📄 bytecodes.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:
* ---------
* bytecodes.h
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
*
*
* Author:
* -------
*
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* 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: bytecodes.c
* OVERVIEW: This file defines the implementation of each of the
* Java bytecodes.
* The code has been separated from interpret.c so that we
* can more easily use different kinds of interpretation
* techniques and customize the VM to use sub/supersets
* of bytecodes.
* AUTHOR: Rewritten for better performance and customizability
* by Nik Shaylor 9/5/2000
*=======================================================================*/
/* --------------------------------------------------------------------- */
#ifdef CLDC11
/* XXX!!! - CLDC 11 bytecodes, not refeind. refine that later. */
#if !REPLACESTANDARDBYTECODE
#if STANDARDBYTECODES
SELECT(NOP) /* Do nothing */
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ACONST_NULL) /* Push null reference onto the operand stack */
pushStack(0);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ICONST_M1) /* Push integer constant -1 onto the operand stack */
pushStack(-1);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ICONST_0) /* Push integer constant 0 onto the operand stack */
pushStack(0);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ICONST_1) /* Push integer constant 1 onto the operand stack */
pushStack(1);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ICONST_2) /* Push integer constant 2 onto the operand stack */
pushStack(2);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ICONST_3) /* Push integer constant 3 onto the operand stack */
pushStack(3);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ICONST_4) /* Push integer constant 4 onto the operand stack */
pushStack(4);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ICONST_5) /* Push integer constant 5 onto the operand stack */
pushStack(5);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LCONST_0) /* Push long integer constant 0 onto the operand stack */
#if COMPILER_SUPPORTS_LONG
pushLongVal(0);
#else
{
ulong64 localZERO={0,0};
pushLongVal(localZERO);
}
#endif /* COMPILER_SUPPORTS_LONG */
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LCONST_1) /* Push long integer constant 1 onto the operand stack */
#if COMPILER_SUPPORTS_LONG
pushLongVal(1);
#else
#if BIG_ENDIAN
ulong64 localONE={0,1};
#else /* LITTLE_ENDIAN */
ulong64 localONE={1,0};
#endif /* BIG_ENDIAN */
pushLongVal(localONE);
#endif /* COMPILER_SUPPORTS_LONG */
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(FCONST_0) /* Push float constant 0 onto the operand stack */
oneMore;
*(float*)sp = 0.0f;
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(FCONST_1) /* Push float constant 1 onto the operand stack */
oneMore;
*(float*)sp = 1.0f;
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(FCONST_2) /* Push float constant 2 onto the operand stack */
oneMore;
*(float*)sp = 2.0f;
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(DCONST_0) /* Push double float constant 0 onto the operand stack */
#if UPTODOWNSTACK
moreStack(2);
SET_DOUBLE(sp, 0.0);
#else
oneMore;
SET_DOUBLE(sp, 0.0);
oneMore;
#endif
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(DCONST_1) /* Push double float constant 1 onto the operand stack */
#if UPTODOWNSTACK
moreStack(2);
SET_DOUBLE(sp, 1.0);
#else
oneMore;
SET_DOUBLE(sp, 1.0);
oneMore;
#endif
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(BIPUSH) /* Push byte constant onto the operand stack */
int i = ((signed char *)ip)[1];
pushStack(i);
DONE(2)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(SIPUSH) /* Push short constant onto the operand stack */
short s = getShort(ip + 1);
pushStack((int)s); /* Extends sign for negative numbers */
DONE(3)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LDC) /* Push item from constant pool onto the operand stack */
unsigned int cpIndex = ip[1];
CONSTANTPOOL_ENTRY thisEntry = &cp->entries[cpIndex];
pushStack(thisEntry->integer);
DONE(2)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LDC_W) /* Push item from constant pool (wide index) */
unsigned int cpIndex = getUShort(ip + 1);
CONSTANTPOOL_ENTRY thisEntry = &cp->entries[cpIndex];
pushStack(thisEntry->integer);
DONE(3)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LDC2_W) /* Push double or long from constant pool (wide index) */
unsigned int cpIndex = getUShort(ip + 1);
CONSTANTPOOL_ENTRY thisEntry = &cp->entries[cpIndex];
unsigned long hiBytes = (unsigned long)(thisEntry[0].integer);
unsigned long loBytes = (unsigned long)(thisEntry[1].integer);
#if UPTODOWNSTACK
moreStack(2);
SET_LONG_FROM_HALVES(sp, hiBytes, loBytes);
#else
oneMore;
SET_LONG_FROM_HALVES(sp, hiBytes, loBytes);
oneMore;
#endif /* UPTODOWNSTACK */
DONE(3)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ILOAD) /* Load integer from local variable */
unsigned int index = ip[1];
pushStack(lp[index]);
DONE(2)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LLOAD) /* Load long integer from local variable */
unsigned int index = ip[1];
pushStack(lp[index]);
pushStack(lp[index+1]);
DONE(2)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(FLOAD) /* Load float from local variable */
unsigned int index = ip[1];
pushStack(lp[index]);
DONE(2)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(DLOAD) /* Load double float from local variable */
unsigned int index = ip[1];
pushStack(lp[index]);
pushStack(lp[index+1]);
DONE(2)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ALOAD) /* Load address from local variable */
unsigned int index = ip[1];
pushStack(lp[index]);
DONE(2)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ILOAD_0) /* Load integer from first (zeroeth) local variable */
pushStack(lp[0]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ILOAD_1) /* Load integer from second local variable */
pushStack(lp[1]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ILOAD_2) /* Load integer from third local variable */
pushStack(lp[2]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(ILOAD_3) /* Load integer from fourth local variable */
pushStack(lp[3]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LLOAD_0) /* Load integer from first (zeroeth) local variable */
pushStack(lp[0]);
pushStack(lp[1]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LLOAD_1) /* Load integer from second local variable */
pushStack(lp[1]);
pushStack(lp[2]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LLOAD_2) /* Load integer from third local variable */
pushStack(lp[2]);
pushStack(lp[3]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if STANDARDBYTECODES
SELECT(LLOAD_3) /* Load integer from fourth local variable */
pushStack(lp[3]);
pushStack(lp[4]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(FLOAD_0) /* Load integer from first (zeroeth) local variable */
pushStack(lp[0]);
DONE(1)
#endif
/* --------------------------------------------------------------------- */
#if FLOATBYTECODES
SELECT(FLOAD_1) /* Load integer from second local variable */
pushStack(lp[1]);
DONE(1)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -