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

📄 bytecodes.c

📁 Nucleus_2_kvm_Hello 是kvm移植到Nucleus系统的源代码。。。好东西啊
💻 C
📖 第 1 页 / 共 5 页
字号:
/* * Copyright (c) 2000-2002 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. * * 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 *=======================================================================*//* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(NOP)             /* Do nothing */DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ACONST_NULL)     /* Push null reference onto the operand stack */        pushStack(0);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ICONST_M1)     /* Push integer constant -1 onto the operand stack */        pushStack(-1);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ICONST_0)      /* Push integer constant 0 onto the operand stack */        pushStack(0);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ICONST_1)      /* Push integer constant 1 onto the operand stack */        pushStack(1);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ICONST_2)      /* Push integer constant 2 onto the operand stack */        pushStack(2);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ICONST_3)      /* Push integer constant 3 onto the operand stack */        pushStack(3);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ICONST_4)      /* Push integer constant 4 onto the operand stack */        pushStack(4);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ICONST_5)      /* Push integer constant 5 onto the operand stack */        pushStack(5);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(LCONST_0) /* Push long integer constant 0 onto the operand stack */        oneMore;        ((long *)sp)[0] = 0;        ((long *)sp)[1] = 0;        oneMore;DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(LCONST_1)  /* Push long integer constant 1 onto the operand stack */        oneMore;#if BIG_ENDIAN        ((long *)sp)[0] = 0;        ((long *)sp)[1] = 1;#elif LITTLE_ENDIAN || !COMPILER_SUPPORTS_LONG        ((long *)sp)[0] = 1;        ((long *)sp)[1] = 0;#else        SET_LONG(sp, (ulong64)(1));#endif        oneMore;DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(FCONST_0)        /* Push float constant 0 onto the operand stack */        oneMore;        *(float*)sp = 0.0f;DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(FCONST_1)        /* Push float constant 1 onto the operand stack */        oneMore;        *(float*)sp = 1.0f;DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(FCONST_2)        /* Push float constant 2 onto the operand stack */        oneMore;        *(float*)sp = 2.0f;DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(DCONST_0)  /* Push double float constant 0 onto the operand stack */        oneMore;        SET_DOUBLE(sp, 0.0);        oneMore;DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(DCONST_1)  /* Push double float constant 1 onto the operand stack */        oneMore;        SET_DOUBLE(sp, 1.0);        oneMore;DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(BIPUSH)             /* Push byte constant onto the operand stack */        int i = ((signed char *)ip)[1];        pushStack(i);DONE(2)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(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 STANDARDBYTECODESSELECT(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 STANDARDBYTECODESSELECT(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 STANDARDBYTECODESSELECT(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);        oneMore;        SET_LONG_FROM_HALVES(sp, hiBytes, loBytes);        oneMore;DONE(3)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ILOAD)           /* Load integer from local variable */        unsigned int index = ip[1];        pushStack(lp[index]);DONE(2)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(LLOAD)           /* Load long integer from local variable */        unsigned int index = ip[1];        pushStack(lp[index]);        pushStack(lp[index+1]);DONE(2)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(FLOAD)           /* Load float from local variable */        unsigned int index = ip[1];        pushStack(lp[index]);DONE(2)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(DLOAD)           /* Load double float from local variable */        unsigned int index = ip[1];        pushStack(lp[index]);        pushStack(lp[index+1]);DONE(2)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ALOAD)           /* Load address from local variable */        unsigned int index = ip[1];        pushStack(lp[index]);DONE(2)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ILOAD_0)      /* Load integer from first (zeroeth) local variable */        pushStack(lp[0]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ILOAD_1)         /* Load integer from second local variable */        pushStack(lp[1]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ILOAD_2)         /* Load integer from third local variable */        pushStack(lp[2]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ILOAD_3)         /* Load integer from fourth local variable */        pushStack(lp[3]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(LLOAD_0)      /* Load integer from first (zeroeth) local variable */        pushStack(lp[0]);        pushStack(lp[1]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(LLOAD_1)          /* Load integer from second local variable */        pushStack(lp[1]);        pushStack(lp[2]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(LLOAD_2)         /* Load integer from third local variable */        pushStack(lp[2]);        pushStack(lp[3]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(LLOAD_3)         /* Load integer from fourth local variable */        pushStack(lp[3]);        pushStack(lp[4]);DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(FLOAD_0)      /* Load integer from first (zeroeth) local variable */        pushStack(lp[0]);DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(FLOAD_1)         /* Load integer from second local variable */        pushStack(lp[1]);DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(FLOAD_2)         /* Load integer from third local variable */        pushStack(lp[2]);DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(FLOAD_3)         /* Load integer from fourth local variable */        pushStack(lp[3]);DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(DLOAD_0)      /* Load integer from first (zeroeth) local variable */        pushStack(lp[0]);        pushStack(lp[1]);DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(DLOAD_1)         /* Load integer from second local variable */        pushStack(lp[1]);        pushStack(lp[2]);DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(DLOAD_2)         /* Load integer from third local variable */        pushStack(lp[2]);        pushStack(lp[3]);DONE(1)#endif/* --------------------------------------------------------------------- */#if FLOATBYTECODESSELECT(DLOAD_3)         /* Load integer from fourth local variable */        pushStack(lp[3]);        pushStack(lp[4]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ALOAD_0)      /* Load integer from first (zeroeth) local variable */        pushStack(lp[0]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ALOAD_1)         /* Load integer from second local variable */        pushStack(lp[1]);DONE(1)#endif/* --------------------------------------------------------------------- */#if STANDARDBYTECODESSELECT(ALOAD_2)         /* Load integer from third local variable */        pushStack(lp[2]);DONE(1)#endif

⌨️ 快捷键说明

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