ccm_runtime.h
来自「This is a resource based on j2me embedde」· C头文件 代码 · 共 641 行 · 第 1/2 页
H
641 行
/* * @(#)ccm_runtime.h 1.49 06/10/10 * * Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. * */#ifndef _INCLUDED_CCM_RUNTIME_H#define _INCLUDED_CCM_RUNTIME_H#include "javavm/include/defs.h"#include "javavm/include/basictypes.h"/* Types of CCM runtime helper functions: ===================================== All CCM runtime helper functions can be categorized as follows: 1. STATE_FLUSHED: The thread's state has been adequatedly flushed and this helper function can become GC safe without any complication. If this function needs to throw an exception, it may call CVMCCMhandleException() to directly unwind the stack and handle the exception. 2. STATE_FLUSHED_TOTALLY: Same as STATE_FLUSHED with the addition that the Java stack pointer needs to be flushed to the top most frame. This is not necessary for GC safety because the frame's PC (which is flushed) will get us to the appropriate stackmap which will tell us about references in the stack frame independent of the topOfStack pointer. However, we need to flush the topOfStack pointer for any helpers that may push a frame (usually for the purpose of calling another Java method) on to the Java stack. 3. STATE_NOT_FLUSHED: The thread's state has not been adequatedly flushed. Hence, this helper function is not allowed to become GC safe. If this function needs to throw an exception, it will have to call CVMCCMreturnWithException() which stores away the needed info to throw the exception, set a condition flag, and return to the compiled code. The compiled code is responsible for checking the condition flag. If the condition flag indicates that an exception was detected, then the compiled code should flush its state (in preparation of becoming GC safe), and call CVMCCMruntimeThrowClass() to throw the exception that occurred. STATE_NOT_FLUSHED helper functions can be further sub-categorized as follows: 1. THROWS_NONE: The helper does not any exceptions. 2. THROWS_SINGLE: The helper can throw only one type of exception. Hence the type of the actual exception thrown is known at method compile time. 3. THROWS_MULTIPLE: The helper can throw more than one type of exception. Hence, the type of the actual exception thrown is NOT known at method compile time.*//* Purpose: Computes value1 / value2. *//* Type: STATE_NOT_FLUSHED THROWS_SINGLE *//* Throws: ArithmeticException("/ by zero"). */CVMJavaInt CVMCCMruntimeIDiv(CVMJavaInt value1, CVMJavaInt value2);/* Purpose: Computes value1 % value2. *//* Type: STATE_NOT_FLUSHED THROWS_SINGLE *//* Throws: ArithmeticException("/ by zero"). */CVMJavaInt CVMCCMruntimeIRem(CVMJavaInt value1, CVMJavaInt value2);/* Purpose: Computes value1 * value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeLMul(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 / value2. *//* Type: STATE_NOT_FLUSHED THROWS_SINGLE *//* Throws: ArithmeticException("/ by zero"). */CVMJavaLong CVMCCMruntimeLDiv(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 % value2. *//* Type: STATE_NOT_FLUSHED THROWS_SINGLE *//* Throws: ArithmeticException("/ by zero"). */CVMJavaLong CVMCCMruntimeLRem(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes -value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeLNeg(CVMJavaLong value);/* Purpose: Computes value1 << value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeLShl(CVMJavaLong value1, CVMJavaInt value2);/* Purpose: Computes value1 >> value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeLShr(CVMJavaLong value1, CVMJavaInt value2);/* Purpose: Computes value1 >>> value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeLUshr(CVMJavaLong value1, CVMJavaInt value2);/* Purpose: Computes value1 & value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeLAnd(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 | value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeLOr(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 ^ value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeLXor(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 + value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeFAdd(CVMUint32 value1, CVMUint32 value2);/* Purpose: Computes value1 - value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeFSub(CVMUint32 value1, CVMUint32 value2);/* Purpose: Computes value1 * value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeFMul(CVMUint32 value1, CVMUint32 value2);/* Purpose: Computes value1 / value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeFDiv(CVMUint32 value1, CVMUint32 value2);/* Purpose: Computes value1 % value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeFRem(CVMUint32 value1, CVMUint32 value2);/* Purpose: Computes -value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeFNeg(CVMUint32 value);/* Purpose: Computes value1 + value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeDAdd(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 - value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeDSub(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 * value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeDMul(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 / value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeDDiv(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes value1 % value2. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeDRem(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Computes -value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeDNeg(CVMJavaLong value);/* Purpose: Converts an int value to a long value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeI2L(CVMJavaInt value);/* Purpose: Converts an int value to a float value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeI2F(CVMJavaInt value);/* Purpose: Converts an int value to a double value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeI2D(CVMJavaInt value);/* Purpose: Converts a long value to an int value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaInt CVMCCMruntimeL2I(CVMJavaLong value);/* Purpose: Converts a long value to a float value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeL2F(CVMJavaLong value);/* Purpose: Converts a long value to a double value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeL2D(CVMJavaLong value);/* Purpose: Converts a float value to an int value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaInt CVMCCMruntimeF2I(CVMUint32 value);/* Purpose: Converts a float value to a long value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeF2L(CVMUint32 value);/* Purpose: Converts a float value to a double value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeF2D(CVMUint32 value);/* Purpose: Converts a double value to an int value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaInt CVMCCMruntimeD2I(CVMJavaLong value);/* Purpose: Converts a double value to a long value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaLong CVMCCMruntimeD2L(CVMJavaLong value);/* Purpose: Converts a double value to a float value. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMUint32 CVMCCMruntimeD2F(CVMJavaLong value);/* Purpose: Compares two long values. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaInt CVMCCMruntimeLCmp(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Compares value1 with value2. *//* Returns: -1 if value1 < value2, 0 if value1 == value2, 1 if value1 > value2, and nanResult if (value1 == NaN) or (value2 == Nan) *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaInt CVMCCMruntimeFCmp(CVMUint32 value1, CVMUint32 value2, CVMJavaInt nanResult);/* Purpose: Compares value1 with value2 (NaN yields a "less than" result). *//* Returns: -1 if value1 < value2, 0 if value1 == value2, 1 if value1 > value2, and -1 if (value1 == NaN) or (value2 == Nan) i.e. NaN yields a "less than" result. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaInt CVMCCMruntimeDCmpl(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Compares value1 with value2 (NaN yields a "greater than" result).*//* Returns: -1 if value1 < value2, 0 if value1 == value2, 1 if value1 > value2, and 1 if (value1 == NaN) or (value2 == Nan) i.e. NaN yields a "greater than" result. *//* Type: STATE_NOT_FLUSHED THROWS_NONE */CVMJavaInt CVMCCMruntimeDCmpg(CVMJavaLong value1, CVMJavaLong value2);/* Purpose: Throws the specified exception. *//* Type: STATE_FLUSHED THROWS_MULTIPLE */void CVMCCMruntimeThrowClass(CVMCCExecEnv *ccee, CVMExecEnv *ee, CVMClassBlock *exceptionCb, const char *exceptionString);/* Purpose: Throws the specified exception. *//* Type: STATE_FLUSHED THROWS_MULTIPLE */void CVMCCMruntimeThrowObject(CVMCCExecEnv *ccee, CVMExecEnv *ee, CVMObject *obj);/* Purpose: Checks to see if the specified object is can be legally casted as an instance of the specified class. *//* Type: STATE_FLUSHED THROWS_MULTIPLE *//* Throws: ClassCastException, StackOverflowError. *//* NOTE: The obj is checked for NULL in the helper function. The JITed code need not check for NULL first. */void CVMCCMruntimeCheckCast(CVMCCExecEnv *ccee, CVMClassBlock *objCb, CVMClassBlock *castCb, CVMClassBlock **cachedCbPtr);/* Purpose: Checks to see if the an element of type 'rhsCb' can be stored into an array whose element type is 'elemCb'. *//* Type: STATE_FLUSHED THROWS_MULTIPLE *//* Throws: ArrayStoreException, StackOverflowError. *//* NOTE: The obj is checked for NULL inline */void CVMCCMruntimeCheckArrayAssignable(CVMCCExecEnv *ccee, CVMExecEnv *ee, CVMClassBlock *elemCb, CVMClassBlock *rhsCb);/* Purpose: Checks to see if the specified object is an instance of the specified class or its subclasses. *//* Type: STATE_FLUSHED THROWS_SINGLE *//* Throws: StackOverflowError. *//* NOTE: The obj is checked for NULL in the helper function. The JITed code need not check for NULL first. */CVMJavaInt CVMCCMruntimeInstanceOf(CVMCCExecEnv *ccee, CVMClassBlock *objCb, CVMClassBlock *instanceofCb, CVMClassBlock **cachedCbPtr);/* Purpose: Looks up the target MethodBlock which implements the specified interface method. *//* Type: STATE_FLUSHED THROWS_SINGLE *//* Throws: IncompatibleClassChangeError. *//* NOTE: The caller should check if the object is NULL first. */const CVMMethodBlock *CVMCCMruntimeLookupInterfaceMB(CVMCCExecEnv *ccee, CVMClassBlock *ocb, const CVMMethodBlock *imb, CVMInt32 *guessPtr);/* Purpose: Instantiates an object of the specified class. *//* Type: STATE_FLUSHED_TOTALLY THROWS_SINGLE *//* Throws: OutOfMemoryError. */CVMObject *CVMCCMruntimeNew(CVMCCExecEnv *ccee, CVMClassBlock *newCb);/* Purpose: Instantiates a primitive array of the specified type and size. *//* Type: STATE_FLUSHED_TOTALLY THROWS_MULTIPLE *//* Throws: OutOfMemoryError, NegativeArraySizeException. */CVMObject *CVMCCMruntimeNewArray(CVMCCExecEnv *ccee, CVMJavaInt length, CVMClassBlock *arrCB);/* Purpose: Instantiates an object array of the specified type and size. *//* Type: STATE_FLUSHED_TOTALLY THROWS_MULTIPLE *//* Throws: OutOfMemoryError, NegativeArraySizeException, StackOverflowError. */CVMObject *CVMCCMruntimeANewArray(CVMCCExecEnv *ccee, CVMJavaInt length,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?