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

📄 frame.h

📁 java 1.1 gemini 08_16
💻 H
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************
*  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:
 * ---------
 *  frame.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: Interpreter stack frames
 * FILE:      frame.h
 * OVERVIEW:  Definitions for execution frame & exception handling
 *            manipulation.
 * AUTHOR:    Antero Taivalsaari, Sun Labs, 1998
 *            Edited by Doug Simon 11/1998 (exception handling)
 *            Sheng Liang (chunky stacks), Frank Yellin
 *=======================================================================*/

/*=========================================================================
 * COMMENTS:
 * This file defines the VM-specific internal runtime structures for
 * manipulating stack frames and performing the necessary exception
 * handling operations.
 *=======================================================================*/

/*=========================================================================
 * Include files
 *=======================================================================*/

/*=========================================================================
 * Global variables and definitions
 *=======================================================================*/

/*
 * Number of cells reserved for native methods. Native method must push
 * a new frame when they use more than 3 stack slots.
 */
#define RESERVEDFORNATIVE 3

/* frame pointer => pointer to locals */
#if UPTODOWNSTACK
#define FRAMELOCALS(fp) ((cell*)(fp) + SIZEOF_FRAME)
#else
#define FRAMELOCALS(fp) ((cell*)(fp) - fp->thisMethod->frameSize)
#endif   /* end of #if UPTODOWNSTACK */

/* Maximum number of stack and locals that a method can have. 
 * This limit is enforced by the loader 
 */
#define MAXIMUM_STACK_AND_LOCALS 512

/*=========================================================================
 * Chunky stack operations
 *=======================================================================*/

/*
 * KVM execution stacks can grow and shrink dynamically as 
 * necessary.  This allows us to create a large number of
 * Java threads even with very limited heap space. 
 *
 * The data structure for chunky stacks is defined below.
 * The physical Java execution stack consists of a linked
 * list of these structures.  This way, we don't have to 
 * allocate a huge contiguous memory area for each execution
 * stack.  Initially, each thread has just one stack chunk.
 * More chunks are created as necessary.
 */
#if ASMBYTECODE
#ifndef STACKOVERDUMMYSIZE
#define STACKOVERDUMMYSIZE 110   /* That means O.S. needs 440 bytes to do context switching in user-defined stack */
#endif   /* end of #ifndef STACKOVERDUMMYSIZE */
#endif   /* end of #if ASMBYTECODE */

/* STACK */
struct stackStruct {
    STACK    next;
    short    size;
    short    xxunusedxx; /* must be multiple of 4 on all platforms */
#if ASMBYTECODE
    cell     Contextswitchdummycells[STACKOVERDUMMYSIZE];   /* This elements is used to reserve one big enough */
                                                                  /* space while O.S. takes advantage of the user-   */
                                                                  /* defined stack to behave the context switching.  */
                                                                  /* Otherwise, it's not necessary to allocate this  */
                                                                  /* space if O.S. uses the system stack to do       */
                                                                  /* context switching.                              */
#endif   /* end of #if ASMBYTECODE */
    cell     cells[STACKCHUNKSIZE];
};

#if UPTODOWNSTACK
#define getStackHeight() (getFP() - getSP())
#define setStackHeight(x) setSP(((cell *)getFP()) - x)
#else
#define getStackHeight() (getSP() - ((cell*)getFP()) - SIZEOF_FRAME + 1)
#define setStackHeight(x) setSP(((cell *)getFP()) + (SIZEOF_FRAME - 1) + x)
#endif   /* end of #if UPTODOWNSTACK */

#define STACK_CONTAINS(stack, p) \
  ((p) >= (stack)->cells && (p) < (stack)->cells + (stack)->size)

/*=========================================================================
 * COMMENT:
 * The overall stack frame organization for individual stack frames
 * is as follows (starting from the "bottom" of the execution stack
 * towards the "top" of the stack:
 * 1) Method call parameters + local variables
 * 2) The actual frameStruct (see below)
 * 3) Operand stack
 *
 * Note: there is no separate "operand stack" for data manipulation.
 * The necessary operands are always stored on top of the current
 * execution stack frame.  We sometimes use the term operand stack
 * to refer to the portion of the execution stack allocated for the
 * operands and data of the currently executing method.
 *
 * Remember that in virtual function calls, the first local variable
 * (zeroeth actually) always contains the self-reference ('this').
 * In static function calls, the first local variable contains the
 * first method parameter (if any).
 *=======================================================================*/

/* FRAME (allocated inside execution stacks of threads) */
#if ASMBYTECODE
struct frameStruct {
    METHOD   thisMethod; /* Pointer to the method currently under execution */
    FRAME    previousFp; /* Stores the previous frame pointer */
    cell*    previousSp; /* Stores the previous stack pointer */
    BYTE*    previousIp; /* Stores the previous program counter */
    OBJECT   syncObject; /* Holds monitor object if synchronized method call */
    STACK    stack;      /* Stack chunk containing the frame */
};
#else
struct frameStruct {
    FRAME    previousFp; /* Stores the previous frame pointer */
    BYTE*    previousIp; /* Stores the previous program counter */
    cell*    previousSp; /* Stores the previous stack pointer */
    METHOD   thisMethod; /* Pointer to the method currently under execution */
    STACK    stack;      /* Stack chunk containing the frame */
    OBJECT   syncObject; /* Holds monitor object if synchronized method call */
};
#endif   /* end of #if ASMBYTECODE */

/* HANDLER */
struct exceptionHandlerStruct {
    unsigned short startPC;   /* Start and end program counter indices; these */
    unsigned short endPC;     /* determine the code range where the handler is valid */
    unsigned short handlerPC; /* Location that is called upon exception */
    unsigned short exception; /* Class of the exception (as a constant pool index) */
                              /* Note: 0 in 'exception' indicates an 'any' handler */
};

/* HANDLERTABLE */
struct exceptionHandlerTableStruct {
    long length;
    struct exceptionHandlerStruct handlers[1];
};

/*=========================================================================
 * Sizes for the above structures

⌨️ 快捷键说明

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