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

📄 startjvm.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./ * KVM
/*0021./ *=========================================================================
/*0022./ * SYSTEM:    KVM
/*0023./ * SUBSYSTEM: Main Java program
/*0024./ * FILE:      StartJVM.c
/*0025./ * OVERVIEW:  System initialization and start of JVM
/*0026./ * AUTHOR:    Antero Taivalsaari, Sun Labs
/*0027./ *            Edited by Doug Simon 11/1998
/*0028./ *            Frank Yellin
/*0029./ *            Bill Pittore (Java-level debugging)
/*0030./ *=======================================================================*/
/*0031*/
/*0032*//*=========================================================================
/*0033./ * Include files
/*0034./ *=======================================================================*/
/*0035*/
/*0036*/#include <global.h>
/*0037*/
/*0038*//*=========================================================================
/*0039./ * Functions
/*0040./ *=======================================================================*/
/*0041*/
/*0042*//*=========================================================================
/*0043./ * FUNCTION:      readCommandLineArguments()
/*0044./ * TYPE:          constructor (kind of)
/*0045./ * OVERVIEW:      Read the extra command line arguments provided
/*0046./ *                by the user and construct a string array containing
/*0047./ *                the arguments. Note: before executing 'main' the
/*0048./ *                string array must be pushed onto the operand stack.
/*0049./ * INTERFACE:
/*0050./ *   parameters:  command line parameters
/*0051./ *   returns:     string array containing the command line arguments
/*0052./ *=======================================================================*/
/*0053*/
/*0054*/static ARRAY
/*0055*/readCommandLineArguments(int argc, char* argv[])
/*0056*/{
/*0057*/    /*  Get the number of command line arguments */
/*0058*/    ARRAY_CLASS arrayClass = getArrayClass(1, JavaLangString, 0);
/*0059*/    ARRAY stringArray;
/*0060*/    int numberOfArguments = argc;
/*0061*/    int argCount = (numberOfArguments > 0) ? numberOfArguments : 0;
/*0062*/    int i;
/*0063*/
/*0064*/    /*  Create a string array for the arguments */
/*0065*/    START_TEMPORARY_ROOTS
/*0066*/        IS_TEMPORARY_ROOT(stringArray, instantiateArray(arrayClass, argCount));
/*0067*/        for (i = 0; i < numberOfArguments; i++) {
/*0068*/            stringArray->data[i].cellp =
/*0069*/                (cell *)instantiateString(argv[i], strlen(argv[i]));
/*0070*/        }
/*0071*/    END_TEMPORARY_ROOTS
/*0072*/    return stringArray;
/*0073*/}
/*0074*/
/*0075*//*=========================================================================
/*0076./ * FUNCTION:      KVM_Start
/*0077./ * TYPE:          private operation
/*0078./ * OVERVIEW:      Initialize everything.  This operation is called
/*0079./ *                when the VM is launched.
/*0080./ * INTERFACE:
/*0081./ *   parameters:  command line parameters
/*0082./ *   returns:     zero if everything went well, non-zero otherwise
/*0083./ *=======================================================================*/
/*0084*/
/*0085*/int KVM_Start(int argc, char* argv[])
/*0086*/{
/*0087*/    INSTANCE_CLASS mainClass;
/*0088*/    volatile int returnValue = 0; /* Needed to make compiler happy */
/*0089*/
/*0090*/    ERROR_TRY { //\\global.h:345
/*0091*/        /* If ROMIZING and RELOCATABLE_ROM */
/*0092*/        CreateROMImage();
/*0093*/
/*0094*/#if ASYNCHRONOUS_NATIVE_FUNCTIONS
/*0095*/        /* Initialize asynchronous I/O system */
/*0096*/        InitalizeAsynchronousIO();
/*0097*/#endif
/*0098*/
/*0099*/        /* Initialize all the essential runtime structures of the VM */
/*0100*/        InitializeNativeCode();
/*0101*/        InitializeVM(); //\\machine_md.h:96

⌨️ 快捷键说明

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