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

📄 class.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:
 * ---------
 *  class.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: Internal runtime structures
 * FILE:      class.h
 * OVERVIEW:  Internal runtime class structures.
 * AUTHOR:    Antero Taivalsaari, Sun Labs, 1998
 *            Edited by Doug Simon 11/1998 (added the string pool)
 *            Frank Yellin
 *=======================================================================*/

/*=========================================================================
 * COMMENTS:
 * This file defines the VM-specific internal runtime structures
 * needed for representing classes and their instances in the system.
 *=======================================================================*/

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

/*=========================================================================
 * Global definitions
 *=======================================================================*/

/* Class status flags */
#define CLASS_RAW       0 /* this value must be 0 */
#define CLASS_LOADING   1
#define CLASS_LOADED    2
#define CLASS_LINKED    3
#define CLASS_VERIFIED  4
#define CLASS_READY     5
#define CLASS_ERROR    -1

/* A class is considered initialized if it's ready or being initialized
 * by the current thread.
 */
#define CLASS_INITIALIZED(c) \
    ((c)->status == CLASS_READY || (c)->initThread == CurrentThread)

#define IS_ARRAY_CLASS(c) (( ((CLASS)(c))->accessFlags & ACC_ARRAY_CLASS) != 0)

/* Use the 13th bit to indicate whether a class instance has been
 * initialized.
 */
#define ITEM_NewObject_Flag 0x1000
#define ITEM_NewObject_Mask 0x0FFF

#define ENCODE_NEWOBJECT(pc) ((((pc) & 0x7000)<<1) | 0x1000 | ((pc) & 0x0FFF)) 
#define DECODE_NEWOBJECT(no) ((((no) & 0xE000)>>1) | ((no) & 0x0FFF))

/* Abstract types used by the byte code verifier. */
enum {
    ITEM_Bogus,       /* Unused */
    ITEM_Integer,
    ITEM_Float,
    ITEM_Double,
    ITEM_Long,
    ITEM_Null,        /* Result of aconst_null */
    ITEM_InitObject,  /* "this" is in <init> method, before call to super() */

    ITEM_Object,      /* Extra info field gives name. */
    ITEM_NewObject,   /* Like object, but uninitialized. */

    /* The following codes are used by the verifier but don't actually occur in
     * class files.
     */
    ITEM_Long_2,      /* 2nd word of long in register */
    ITEM_Double_2,    /* 2nd word of double in register */

    ITEM_Category1,
    ITEM_Category2,
    ITEM_DoubleWord,
    ITEM_Reference
};

/*=========================================================================
 * Internal runtime class and instance data structures
 *=======================================================================*/

/*=========================================================================
 * Every object in KVM looks roughly like this:
 * 
 *               +--------------------------+
 *               | GC header word (32 bits) |
 *               +==========================+
 * object ptr -> | class pointer            |
 *               +--------------------------+
 *               | monitorOrHashCode field  |
 *               +--------------------------+
 *               | ... the rest of the      |
 *               .     data ...             .
 *               .                          .
 *
 * The data type declarations below define the various 
 * class and instance data structures that the KVM uses
 * internally at runtime.
 * 
 * The "real" (upper-caps) names for these data types 
 * are defined in file 'global.h'.
 *
 * IMPORTANT: If you change the order of any of the data elements
 * in these data structures, make sure that the order matches
 * with the corresponding data structures in 'rom.h'.
 *=======================================================================*/

/** 
 * The low two bits of the monitorOrHashCode (mhc) field of an object
 * say what it is.  See thread.h for more information.
 */
typedef union monitorOrHashCode { 
    void *address;          /* low 2 bits MHC_MONITOR,  
                                          MHC_SIMPLE_LOCK, 
                                          MHC_EXTENDED_LOCK */
    long  hashCode;         /* low 2 bits MHC_UNLOCKED */
} monitorOrHashCode;

/* Macro that defines the most common part of the objects */
#define COMMON_OBJECT_INFO(_type_) \
    _type_ ofClass; /* Pointer to the class of the instance */ \
    monitorOrHashCode mhc;

/* CLASS */
struct classStruct {
    COMMON_OBJECT_INFO(INSTANCE_CLASS)

    /* Note that arrays classes have the same packageName as their base
     * class.  the baseName for arrays is [...[L<className>; or
     * [...[<primitive type>, where [...[ indicates the appropriate
     * number of left brackets for the depth */
    UString packageName;            /* Everything before the final '/' */
    UString baseName;               /* Everything after the final '/' */
    CLASS   next;                   /* Next item in this hash table bucket */
    
    unsigned short accessFlags;     /* Access information */
    unsigned short key;             /* Class key */
};

#ifdef CLDC11
typedef void (*NativeFuncPtr) (INSTANCE_HANDLE);
#endif /* CLDC11 */

/* INSTANCE_CLASS */
struct instanceClassStruct {
    struct classStruct clazz;       /* common info */

    /* And specific to instance classes */
    INSTANCE_CLASS superClass;      /* Superclass, unless java.lang.Object */
    CONSTANTPOOL constPool;         /* Pointer to constant pool */
    FIELDTABLE  fieldTable;         /* Pointer to instance variable table */
    METHODTABLE methodTable;        /* Pointer to virtual method table */
    unsigned short* ifaceTable;     /* Pointer to interface table */
    POINTERLIST staticFields;       /* Holds static fields of the class */
    short   instSize;               /* The size of class instances */
    short status;                   /* Class readiness status */
    THREAD initThread;              /* Thread performing class initialization */
#ifdef CLDC11
    NativeFuncPtr finalizer;        /* Pointer to finalizer */
#endif /* CLDC11 */
};

/* ARRAY_CLASS */
struct arrayClassStruct {
    struct classStruct clazz;       /* Common info */

    /* And stuff specific to an array class */
    union {
        CLASS elemClass;            /* Element class of object arrays */
        long primType;              /* Element type for primitive arrays */
    } u;
    long itemSize;                  /* Size (bytes) of individual elements */
                                    /* wants to be GCT_ObjectType rather than */
                                    /* an int. But the Palm makes enumerations*/
                                    /* into "short" */
    long gcType;                    /* GCT_ARRAY or GCT_OBJECTARRAY */
    long flags;                     /*   */
};

#define ARRAY_FLAG_BASE_NOT_LOADED 1

/* OBJECT (Generic Java object) */
struct objectStruct {
    COMMON_OBJECT_INFO(CLASS)
};

/* INSTANCE */
struct instanceStruct {
    COMMON_OBJECT_INFO(INSTANCE_CLASS)
    union {
        cell *cellp;
        cell cell;
    } data[1];
};

/* These are never created directly. */
/* It's what a java.lang.String looks like */
/* STRING_INSTANCE */
struct stringInstanceStruct {
    COMMON_OBJECT_INFO(INSTANCE_CLASS)

    SHORTARRAY array;
    cell offset;
    cell length;
};

/* INTERNED_STRING_INSTANCE */
struct internedStringInstanceStruct { 
    COMMON_OBJECT_INFO(INSTANCE_CLASS)

    SHORTARRAY array;

⌨️ 快捷键说明

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