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

📄 class.c

📁 This is a java virtual machine implement in c
💻 C
字号:
/*0001*//*
/*0002./ * Copyright (c) 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
/*0003./ *
/*0004./ * This software is the confidential and proprietary information of Sun
/*0005./ * Microsystems, Inc. ("Confidential Information").  You shall not
/*0006./ * disclose such Confidential Information and shall use it only in
/*0007./ * accordance with the terms of the license agreement you entered into
/*0008./ * with Sun.
/*0009./ *
/*0010./ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
/*0011./ * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
/*0012./ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/*0013./ * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
/*0014./ * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
/*0015./ * THIS SOFTWARE OR ITS DERIVATIVES.
/*0016./ *
/*0017./ */
/*0018*/
/*0019*//*=========================================================================
/*0020./ * SYSTEM:    KVM
/*0021./ * SUBSYSTEM: Internal runtime structures
/*0022./ * FILE:      class.c
/*0023./ * OVERVIEW:  Internal runtime class structures (see Class.h).
/*0024./ * AUTHOR:    Antero Taivalsaari, Sun Labs
/*0025./ *            Edited by Doug Simon 11/1998 (added the string pool)
/*0026./ *            Added access checks by Sheng Liang for VM-spec compliance
/*0027./ *            Frank Yellin (more checks for JLS compliance)
/*0028./ *=======================================================================*/
/*0029*/
/*0030*//*=========================================================================
/*0031./ * Include files
/*0032./ *=======================================================================*/
/*0033*/
/*0034*/#include <global.h>
/*0035*/#include <stddef.h>
/*0036*/
/*0037*//*=========================================================================
/*0038./ * Global variables and definitions
/*0039./ *=======================================================================*/
/*0040*/
/*0041*//*  Pointers to the most important Java classes needed by the VM */
/*0042*//*  If Romizing, these are defined and initialized in ROMjava.c */
/*0043*/
/*0044*/#if ROMIZING
/*0045*/#  define EXTERN_IF_ROMIZING extern
/*0046*/#else
/*0047*/#  define EXTERN_IF_ROMIZING
/*0048*/#endif
/*0049*/
/*0050*/EXTERN_IF_ROMIZING
/*0051*/INSTANCE_CLASS JavaLangObject;    /*  Pointer to class 'java.lang.Object' */
/*0052*/
/*0053*/EXTERN_IF_ROMIZING
/*0054*/INSTANCE_CLASS JavaLangClass;     /*  Pointer to class 'java.lang.Class' */
/*0055*/
/*0056*/EXTERN_IF_ROMIZING
/*0057*/INSTANCE_CLASS JavaLangSystem;    /*  Pointer to class 'java.lang.System' */
/*0058*/
/*0059*/EXTERN_IF_ROMIZING
/*0060*/INSTANCE_CLASS JavaLangString;    /*  Pointer to class 'java.lang.String' */
/*0061*/
/*0062*/EXTERN_IF_ROMIZING
/*0063*/INSTANCE_CLASS JavaLangThread;    /*  Pointer to class 'java.lang.Thread' */
/*0064*/
/*0065*/EXTERN_IF_ROMIZING
/*0066*/INSTANCE_CLASS JavaLangThrowable; /*  Pointer to class 'java.lang.Throwable' */
/*0067*/
/*0068*/EXTERN_IF_ROMIZING
/*0069*/INSTANCE_CLASS JavaLangError; /*  Pointer to class 'java.lang.Error' */
/*0070*/
/*0071*/EXTERN_IF_ROMIZING METHOD RunCustomCodeMethod;
/*0072*/
/*0073*/EXTERN_IF_ROMIZING NameTypeKey initNameAndType;   /* void <init>() */
/*0074*/EXTERN_IF_ROMIZING NameTypeKey clinitNameAndType; /* void <clinit>() */
/*0075*/EXTERN_IF_ROMIZING NameTypeKey runNameAndType;    /* void run() */
/*0076*/EXTERN_IF_ROMIZING NameTypeKey mainNameAndType;   /* void main(String[]) */
/*0077*/
/*0078*/EXTERN_IF_ROMIZING ARRAY_CLASS PrimitiveArrayClasses[T_LASTPRIMITIVETYPE + 1];
/*0079*/
/*0080*/INSTANCE_CLASS JavaLangOutOfMemoryError;
/*0081*/THROWABLE_INSTANCE OutOfMemoryObject;
/*0082*/THROWABLE_INSTANCE StackOverflowObject;
/*0083*/
/*0084*//*=========================================================================
/*0085./ * Static methods (only used in this file)
/*0086./ *=======================================================================*/
/*0087*/
/*0088*/static void runClinit(FRAME_HANDLE);
/*0089*/static void runClinitException(FRAME_HANDLE);
/*0090*/
/*0091*//*=========================================================================
/*0092./ * Constructors
/*0093./ *=======================================================================*/
/*0094*/
/*0095*//*=========================================================================
/*0096./ * FUNCTION:      initializeClass()
/*0097./ * TYPE:          constructor
/*0098./ * OVERVIEW:      After loading a class, it must be initialized
/*0099./ *                by executing the possible internal static
/*0100./ *                constructor '<clinit>'. This will initialize the
/*0101./ *                necessary static structures.
/*0102./ *
/*0103./ *                This function sets up the necessary Class.runClinit
/*0104./ *                frame and returns to the interpreter.
/*0105./ * INTERFACE:
/*0106./ *   parameters:  class pointer
/*0107./ *   returns:     <nothing>
/*0108./ *=======================================================================*/
/*0109*/
/*0110*/void initializeClass(INSTANCE_CLASS thisClass)
/*0111*/{
			//\\112~140:暗浪琩

⌨️ 快捷键说明

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