Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 13286 invoked from network); 6 Mar 2008 07:01:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Mar 2008 07:01:03 -0000 Received: (qmail 94963 invoked by uid 500); 6 Mar 2008 07:00:59 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 94944 invoked by uid 500); 6 Mar 2008 07:00:59 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 94935 invoked by uid 99); 6 Mar 2008 07:00:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Mar 2008 23:00:59 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2008 07:00:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CDA0F1A9832; Wed, 5 Mar 2008 23:00:40 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r634179 - in /harmony/enhanced/drlvm/trunk/vm: include/jit_import.h include/jit_intf.h include/jit_runtime_support.h include/open/rt_helpers.h include/open/rt_types.h vmcore/include/jit_export.h vmcore/include/jit_export_rt.h Date: Thu, 06 Mar 2008 07:00:39 -0000 To: commits@harmony.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080306070040.CDA0F1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: varlax Date: Wed Mar 5 23:00:16 2008 New Revision: 634179 URL: http://svn.apache.org/viewvc?rev=634179&view=rev Log: Extracted helper enums and JIT-VM interface types to separate headers, to relax binding between module-specific headers. Added: harmony/enhanced/drlvm/trunk/vm/include/open/rt_helpers.h - copied, changed from r633370, harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h harmony/enhanced/drlvm/trunk/vm/include/open/rt_types.h (with props) Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_import.h harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export_rt.h Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_import.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/jit_import.h?rev=634179&r1=634178&r2=634179&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/include/jit_import.h (original) +++ harmony/enhanced/drlvm/trunk/vm/include/jit_import.h Wed Mar 5 23:00:16 2008 @@ -298,25 +298,6 @@ #define CODE_BLOCK_HEAT_MAX 20 /** - * @sa method_allocate_code_block - */ - -typedef enum Code_Allocation_ActionEnum { - CAA_Simulate, - CAA_Allocate -}Code_Allocation_Action; - -// -// Code block heat - used when a method is split into hot and cold parts -// -typedef enum { - CodeBlockHeatMin, - CodeBlockHeatDefault, - CodeBlockHeatMax -} CodeBlockHeat; - - -/** * This function allows allocation of multiple chunks of code with different * heat values. The JIT is responsible for specifying ids that are unique * within the same method. Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h?rev=634179&r1=634178&r2=634179&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h (original) +++ harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h Wed Mar 5 23:00:16 2008 @@ -40,20 +40,6 @@ #include "jit_export.h" #include "jit_import.h" -// -// The implementation of those types is private to the VM. -// The JIT uses them as handles. -// - - -typedef -enum Method_Side_Effects { - MSE_Unknown, - MSE_True, - MSE_False, - MSE_True_Null_Param -} Method_Side_Effects; //Method_Side_Effects - //////////////// begin C interface // @@ -289,18 +275,6 @@ // Deprecated. Please use vector_first_element_offset instead. //VMEXPORT int get_array_offset(Java_Type element_type); - -/** - * One entry of correspondence table between native addresses and bytecode - * locations. - */ -struct AddrLocation { - /** Native code address. */ - void* start_addr; - - /** Bytecode location. */ - uint16 location; -}; /** * Adds information about inlined method. Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h?rev=634179&r1=634178&r2=634179&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h (original) +++ harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h Wed Mar 5 23:00:16 2008 @@ -15,725 +15,22 @@ * limitations under the License. */ +/** +* @file +* @brief Declaration of access interfaces to runtime helpers provided by VM. +*/ + #ifndef _JIT_RUNTIME_SUPPORT_H_ #define _JIT_RUNTIME_SUPPORT_H_ #include "open/types.h" +#include "open/rt_helpers.h" #include "jni_types.h" -/** - * This is a complete set of functions used by the code generated by the JIT. - * The address of a function is obtained from the VM by invoking the - * function vm_get_rt_support_addr (see below). - * - * We should also note which exceptions can be thrown by each - * of those function. - * - * If changes are made to enum VM_RT_SUPPORT below, the list of - * descriptions in tr_helper_info.cpp must also be changed. - */ - #ifdef __cplusplus extern "C" { #endif // __cplusplus -typedef -enum VM_RT_SUPPORT { - -/** Void id marker */ - VM_RT_UNKNOWN=0, - -/** - * Object creation routines. - */ - - VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE=100, -/** - * @param The parameters are the following: - * \arg Size of the instance to be created - * \arg Allocation_Handle for the class whose instance we want to create - * - * @return Reference to the new object. - * - * Like VM_RT_NEW_VECTOR_USING_VTABLE, allocates a new object of - * a class, but also takes a size argument. The size can be obtained using - * class_get_boxed_data_size(Class_Handle). - * This function should be used for classes which inherit the finalize method - * of java.lang.Object. - */ - - VM_RT_NEW_VECTOR_USING_VTABLE=101, -/** - * @param The parameters are the following: - * \arg Vector length - * \arg Allocation_Handle for the vector class - * - * @return Reference to the new object. - * - * Like VM_RT_NEW_VECTOR creates a vector - * (zero-based, one dimensional array) of the given type, - * but takes a Allocation_Handle instead of a - * Class_Handle. - */ - VM_RT_MULTIANEWARRAY_RESOLVED=102, - /** - * There is a variable # of arguments: - * \arg Class handle - * \arg Number of dimensions - * \arg Count_n - * \arg ... - * \arg Count_1 - * - * @return Reference to the new object. - * - * This is __cdecl function and the caller must pop the arguments. - * Create a multidimensional Java array. - */ - - VM_RT_LDC_STRING=103, -/** - * @param The parameters are the following: - * \arg Class handle of the class owning the const pool - * \arg Const pool index pointing to a CONSTANT_Class. - * - * @return \arg Reference to the String object. - * \arg Reference to the const string represented by an entry in the - * const pool. - */ - -///// -// Exception throwing routines -///// - - VM_RT_THROW=200, -/** - * @param Object reference - * - * @return None. - * - * The only argument is a reference to the exception to be thrown. - * Throw the exception without modifying the stack trace associated - * with the exception object. This function is appropriate for the - * JVML athrow instruction. - * This function never returns. - */ - - VM_RT_THROW_SET_STACK_TRACE=210, - -/** - * @param Object reference. - * - * @return None. - * - * The only argument is a reference to the exception to be thrown. - * Throw the exception and set the stack trace associated - * with the exception object. This function is appropriate for the - * CIL throw instruction. - * - *This function never returns. - */ - - VM_RT_THROW_LAZY=201, -/** - * @param The parameters are the following: - * \arg Method handle - * \arg ... - * \arg arg 2 - * \arg arg 1 - * \arg Class handle - * - * @return None. - * - * The arguments to the constructor are pushed the same way they would have - * been pushed to invoke the constructor, except that the (non-existing) - * this pointer is replaced with the class handle of the exception. - * The method handle representing the constructor is pushed last. - * - * This function never returns. - */ - - VM_RT_IDX_OUT_OF_BOUNDS=202, - -/** - * @param none - * - * @return None. - * - * Throw the java/lang/ArrayIndexOutOfBoundsException. - * - * This function never returns. - */ - VM_RT_NULL_PTR_EXCEPTION=203, - -/** - * @param none - * - * @return None. - * - * Throw the java/lang/NullPointerException - * - * This function never returns. - */ - VM_RT_DIVIDE_BY_ZERO_EXCEPTION=204, - -/** - * @param none - * - * @return None. - * - * Throw the java/lang/ArithmeticException. - * - * This function never returns. - */ - - VM_RT_ARRAY_STORE_EXCEPTION=205, - -/** - * @param none - * - * @return None. - * - * Throw the java/lang/ArrayStoreException. - * - * This function never returns. - */ - - VM_RT_THROW_LINKING_EXCEPTION=206, -/** - * @param The parameters are the following: - * \arg Const pool index - * \arg Class handle of the class owning the const pool - * \arg Loader exception returned by the VM - * - * @return None. - * - * Throws a linking exception reported by the VM at compile-time. - */ - - //// - // Synchronization routines - //// - - VM_RT_MONITOR_ENTER=300, -/** - * @param Object - * - * @return None. - * - * Acquire the monitor associated with the object. - * Throw java/lang/NullPointerException, if the argument is null. - */ - VM_RT_MONITOR_ENTER_NON_NULL=304, - /** - * @param Object - * - * @return None. - * - * Acquire the monitor associated with the object. - * This function is identical to VM_RT_MONITOR_ENTER except that it - * assumes that the argument is non-null. Passing a null argument - * will result in undefined behavior. - */ - VM_RT_MONITOR_EXIT=301, -/** - * @param Object - * - * @return None. - * - * Release the monitor associated with the object. - * Throw java/lang/NullPointerException, if the argument is null. - * Throw java/lang/IllegalMonitorStateException, if the current - * thread is not the owner of the lock. - */ - VM_RT_MONITOR_EXIT_NON_NULL=305, - -/** - * @param Object - * - * @return None. - * - * Release the monitor associated with the object. - * This function is identical to VM_RT_MONITOR_EXIT except that it - * assumes that the argument is non-null. Passing a null argument - * will result in undefined behavior. - * Throw java/lang/IllegalMonitorStateException, if the current thread - * is not the owner of the lock. - */ - VM_RT_MONITOR_ENTER_STATIC=302, -/** - * @param Class handle - * - * @return None. - * - * Acquire the monitor associated with the class passed as the argument. - */ - VM_RT_MONITOR_EXIT_STATIC=303, -/** - * @param Class handle - * - * @return None. - * - * Release the monitor associated with the class passed as the argument. - * Throw java/lang/IllegalMonitorStateException, if the current thread - * is not the owner of the lock. - */ - -//// -// Type access routines -//// - - VM_RT_CHECKCAST=400, -/** - * @param The parameters are the following: - * \arg Object - * \arg Class - * - * @return Object. - * - * If object can't be cast to class, throw ClassCastException - */ - - VM_RT_INSTANCEOF=401, -/** - * @param The parameters are the following: - * \arg Object - * \arg Class - * - * @return 1 if object is not null and can be cast to class; - * 0 otherwise - */ - VM_RT_AASTORE=402, -/** - * @param The parameters are the following: - * \arg Array - * \arg Index - * \arg Element - * - * @return None. - * - * Store a reference element into into an array. - */ - VM_RT_AASTORE_TEST=403, -/** - * @param The parameters are the following: - * \arg Element - * \arg Array - * - * @return 1 if the element can be stored in the array; 0 otherwise. - * - * Check if a reference element into into an array. If the array - * argument is null, return 0. This function does not throw exceptions. - */ - VM_RT_GET_INTERFACE_VTABLE_VER0=404, -/** - * @param The parameters are the following: - * \arg Object reference - * \arg Class handle for the interface - * - * @return Interface vtable with method entries for the implementation - * of that interface by the actual class of the object. - */ - - ///// - //Class initialization - ///// - - - VM_RT_INITIALIZE_CLASS=500, -/** - * @param Class handle - * - * @return None. - * - * If the class hasn't been initialized yet, initialize it. - * - * A call to this function must be generated before every putstatic - * and getstatic unless the JIT can prove that the class would have - * been already initialized at that point. - */ - - //// - // Write barrier routines - //// - - VM_RT_GC_HEAP_WRITE_REF=600, -/** - * @param The parameters are the following: - * \arg Address of the base of the object (or array) being written to - * \arg Address of a memory location being written to - * \arg Value being written - * - * @return None. - * - * Write barrier for GC. Updates the slot with the value provided. - * The type being written is indicated in the name. - */ - VM_RT_GC_SAFE_POINT=601, -/** - * @param none - * - * @return None. - * - * Use this helper to notify GC about safe point in managed code. - */ - VM_RT_GC_GET_TLS_BASE=602, -/** - * @param none - * - * @return Pointer to int-sized suspension request flag. - * - * When the flag is non zero, managed code should call VM_RT_GC_SAFE_POINT - * helper. - * - * @note The flag must be used for read only! - */ - - - ///// - // JVMTI specific routines - ///// - - VM_RT_JVMTI_METHOD_ENTER_CALLBACK = 700, -/** - * @param handle of the method which gets control - * - * @return None. - * - * This call-back should be used to notify about method enter event. - * Do a call-back when such capability is requested only. - */ - VM_RT_JVMTI_METHOD_EXIT_CALLBACK = 701, -/** - * @param The parameters are the following: - * \arg handle of the method which is about to lose control - * \arg method's return value - * - * @return None. - * - * This call-back should be used to notify about method exit event. - * Do a call-back when such capability is requested only. - */ - - VM_RT_JVMTI_FIELD_ACCESS_CALLBACK = 702, - -/** - * @param The parameters are the following: - * arg\ handle of the field under access - * arg\ handle of the method, which accesses field - * arg\ location of code which accesses field - * arg\ pointer to the reference of the object, which field is beeng - * accessed or NULL for static field - * - * @return None. - * - * Notifies about field access. - */ - VM_RT_JVMTI_FIELD_MODIFICATION_CALLBACK = 703, -/** - * @param The parameters are the following: - * arg\ handle of the field under modification - * arg\ handle of the method, which modifies field - * arg\ location of code which modifies field - * arg\ pointer to the reference of the object, which field is beeng - * modified or NULL for static field - * arg\ pointer to the new value for the field - * - * @return none - * - * Notifies about field modification. - */ - - ///// - /// Runtime resolution routines - ///// - - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * - * @return new object - * - * Creates and returns new object for the given (class, cp_index) - * Loads and initialize class if needed - */ - VM_RT_NEWOBJ_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * arg\ Array size - * - * @return new array - * - * Creates and returns new array of the given size - * with type referenced by (class, cp_index) - * Loads and initialize array class if needed - */ - VM_RT_NEWARRAY_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * - * @return field offset - * - * Returns an offset of the field referenced - * by the given (class, cp_index) pair - * Field's class must be loaded and initialized - * before this helper call. - */ - VM_RT_GET_NONSTATIC_FIELD_OFFSET_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * - * @return field address - * - * Returns an address of the field referenced - * by the given (class, cp_index) pair - * Loads and initializes field's class if needed - */ - VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * arg\ Object to check cast - * - * @return third parameter - * - * Check if the given object can be casted to - * the type referenced by (class, cp_index) pair - * Throws class cast exception if object can't be casted - * Returns the object instance (3rd parameter) if cast is allowed - * Loads and intialize cast type if needed. - */ - VM_RT_CHECKCAST_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * arg\ Object to check cast - * - * @return TRUE or FALSE - * - * Check if the given object is instance of - * the type referenced by (class, cp_index) pair - * Return TRUE if object is instance of the given type - * or FALSE otherwise - * Loads and intialize 'instanceof' type if needed. - */ - VM_RT_INSTANCEOF_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * - * @return indirect address of the static method - * - * Returns the indirect address of the static method referenced - * by (class, cp_index) pair - * Loads and intialize method's class type if needed. - */ - VM_RT_GET_INVOKESTATIC_ADDR_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * arg\ Object - * - * @return indirect address of the interface method - * - * Returns the indirect address of the interface method referenced - * by (class, cp_index) pair for the given object - */ - VM_RT_GET_INVOKEINTERFACE_ADDR_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * arg\ Object - * - * @return indirect address of the virtual method - * - * Returns the indirect address of the virtual method referenced - * by (class, cp_index) pair for the given object - */ - VM_RT_GET_INVOKEVIRTUAL_ADDR_WITHRESOLVE, - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * - * @return indirect address of the special method - * - * Returns the indirect address of the special method referenced - * by (class, cp_index) pair - */ - VM_RT_GET_INVOKE_SPECIAL_ADDR_WITHRESOLVE, - - /** - * @param The parameters are the following: - * arg\ Class_Handle - enclosing class handle - * arg\ Constant pool index - * - * @return Class_Handle - * - * Returns the class handle referenced - * by (class, cp_index) pair - * Loads and initialize class if needed - */ - VM_RT_INITIALIZE_CLASS_WITHRESOLVE, - - - ///// - // Non-VM specific helpers for the JIT - ///// - - VM_RT_F2I=900, - VM_RT_F2L=901, - VM_RT_D2I=902, - VM_RT_D2L=903, - // Conversions - - - VM_RT_LSHL=910, - VM_RT_LSHR=911, - VM_RT_LUSHR=912, - /** - * @param The parameters are the following: - * (new version) - * arg\ Long value to be shifted - * arg\ Int value with count - * (old version) - * arg\ (edx:eax) A long value to be shifted - * arg\ (ecx) Count - * @return (edx:eax) The shifted value - */ - - - VM_RT_LMUL=920, -#ifdef VM_LONG_OPT - VM_RT_LMUL_CONST_MULTIPLIER=921, -#endif - VM_RT_LREM=922, - VM_RT_LDIV=923, - VM_RT_ULDIV=924, - VM_RT_CONST_LDIV=925, - VM_RT_CONST_LREM=926, - // Long arithmetic - - VM_RT_IMUL=930, - VM_RT_IREM=931, - VM_RT_IDIV=932, - // Int arithmetic - - VM_RT_FREM=940, - VM_RT_FDIV=941, - VM_RT_DREM=942, - VM_RT_DDIV=943, - // Float/double arithmetic - - VM_RT_CHAR_ARRAYCOPY_NO_EXC=950, -/** - * @param The parameters are the following: - * arg\ Object reference for the source array. Must be non-null and refer to an array - * of 16 bit chars - * arg\ int32 containing the starting index of the source array to copy - * arg\ Object reference for the destination array. Must be non-null and refer to an array - * of 16 bit chars. - * arg\ int32 containing the starting index of the destination array to copy into. - * arg\ int32 containing the number of 16 bit chars to copy. - * - * @return None. - * - * This runtime helper function provides a specialized implementation for System.arraycopy - * for the common case where the elements of the arrays are - * 16 bit characters and the array references are both non-null. The JIT must guarantee - * that no exceptions will need to be thrown. That is, both array references are non-null, - * the types match (and are both arrays of 16 bit characters), - * and the starting indexes and length are such that the copying will only access - * data in the bounds of the arrays. - */ - - //// - // Deprecated routines - //// - - VM_RT_NEW_RESOLVED=1000, -/** - * @param Class handle for the class whose object we want to create - * - * @return Reference to the new object. - * - * Allocates a new object of the class. This function should be used - * for classes which inherit the finalize method of java.lang.Object. - * See also VM_RT_NEW_RESOLVED_USING_VTABLE. - */ - VM_RT_NEW_VECTOR=1001, -/** - * @param The parameters are the following: - * arg\ Vector length - * arg\ Class handle of the vector class - * - * @return Reference to the new object - * - * Create a vector (zero-based, one dimensional array) - * of the given type. See also VM_RT_NEW_VECTOR_USING_VTABLE. - */ - VM_RT_WRITE_BARRIER_FASTCALL=1002 -/** - * @param The parameters are the following: - * arg\ Address of a memory location being written to - * arg\ Object reference being written. - * - * @return None. - * - * Write barrier for GC. - */ - -} VM_RT_SUPPORT; - -/** -* VM RT helpers have different calling conventions. -*/ -enum HELPER_CALLING_CONVENTION { - CALLING_CONVENTION_DRL = 0, - CALLING_CONVENTION_STDCALL, - CALLING_CONVENTION_CDECL, -}; - -/** - * VM RT helpers can be interrupted differently. - */ -typedef -enum HELPER_INTERRUPTIBILITY_KIND { -/** - * Disallowed to interrupt a thread inside the helper. - */ - INTERRUPTIBLE_NEVER, -/** - * Some helpers can be run in fast path mode, - * when they are not interruptible, or in slow path, when they are. - */ - INTERRUPTIBLE_SOMETIMES, -/** - * Helper call can always be interrupted. - */ - INTERRUPTIBLE_ALWAYS - -} HELPER_INTERRUPTIBILITY_KIND; NativeCodePtr rth_get_lil_helper(VM_RT_SUPPORT f); Copied: harmony/enhanced/drlvm/trunk/vm/include/open/rt_helpers.h (from r633370, harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h) URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/rt_helpers.h?p2=harmony/enhanced/drlvm/trunk/vm/include/open/rt_helpers.h&p1=harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h&r1=633370&r2=634179&rev=634179&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h (original) +++ harmony/enhanced/drlvm/trunk/vm/include/open/rt_helpers.h Wed Mar 5 23:00:16 2008 @@ -15,11 +15,8 @@ * limitations under the License. */ -#ifndef _JIT_RUNTIME_SUPPORT_H_ -#define _JIT_RUNTIME_SUPPORT_H_ - -#include "open/types.h" -#include "jni_types.h" +#ifndef _RUNTIME_HELPERS_H_ +#define _RUNTIME_HELPERS_H_ /** * This is a complete set of functions used by the code generated by the JIT. @@ -33,10 +30,6 @@ * descriptions in tr_helper_info.cpp must also be changed. */ -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - typedef enum VM_RT_SUPPORT { @@ -735,62 +728,5 @@ } HELPER_INTERRUPTIBILITY_KIND; -NativeCodePtr rth_get_lil_helper(VM_RT_SUPPORT f); - -VMEXPORT void *vm_get_rt_support_addr(VM_RT_SUPPORT f); - - -/** - * Temporary interface addition - * same as vm_get_rt_support_addr, but tries to optimize the stubs it creates, - * by specializing them. - */ -VMEXPORT void *vm_get_rt_support_addr_optimized(VM_RT_SUPPORT f, Class_Handle c); - -/** - * Instead of returning a stub address, this support function returns - * parsed LIL code. - */ - typedef struct LilCodeStub LilCodeStub; -VMEXPORT LilCodeStub *vm_get_rt_support_stub(VM_RT_SUPPORT f, Class_Handle c); - - -/** - * Checks if helper is a suspension point - */ -VMEXPORT HELPER_INTERRUPTIBILITY_KIND vm_helper_get_interruptibility_kind(VM_RT_SUPPORT f); - -VMEXPORT HELPER_CALLING_CONVENTION vm_helper_get_calling_convention(VM_RT_SUPPORT f); -VMEXPORT const char* vm_helper_get_name(VM_RT_SUPPORT id); - -/** - * Returns number of helper arguments. - * Intended primarily for debugging. - */ -VMEXPORT int vm_helper_get_numargs(VM_RT_SUPPORT id); - -/** -* Returns Id of runtime helper by its string representation. -* Name comparison is case-insensitive. -* If the helperName is unknown, then VM_RT_UNKNOWN is returned. -*/ -VMEXPORT VM_RT_SUPPORT vm_helper_get_by_name(const char* name); - -#ifndef Global_Env -struct Global_Env; -#endif - -jint helper_magic_init(Global_Env * vm_env); - -VMEXPORT jint vm_helper_register_magic_helper(VM_RT_SUPPORT id, - const char* class_name, - const char* method_name); - -VMEXPORT Method_Handle vm_helper_get_magic_helper(VM_RT_SUPPORT id); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // !_JIT_RUNTIME_SUPPORT_H_ +#endif // !_RUNTIME_HELPERS_H_ Added: harmony/enhanced/drlvm/trunk/vm/include/open/rt_types.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/rt_types.h?rev=634179&view=auto ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/include/open/rt_types.h (added) +++ harmony/enhanced/drlvm/trunk/vm/include/open/rt_types.h Wed Mar 5 23:00:16 2008 @@ -0,0 +1,266 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _RUNTIME_TYPES_H_ +#define _RUNTIME_TYPES_H_ + +#include "open/platform_types.h" + +/** +* One entry of correspondence table between native addresses and bytecode +* locations. +*/ +typedef struct AddrLocation { + /** Native code address. */ + void* start_addr; + + /** Bytecode location. */ + uint16 location; +} AddrLocation; + + +/** +* Elements of this struct correspond to certain requirements +* of how a managed method is executed (what it additionally does +* during execution). Most of them correspond to requirements to +* call a certain VM helpers at certain places in the code. For JIT, +* in particular, this means that it will have to generate additional +* code which will perform these calls. +*

+* Each of the requirement is associated with a corresponding ability of +* the EE to satisfy this requirement. So, elements of the struct should also +* be used to denote EE capabilities related to method execution. +*

+* If an element corresponds to a certain VM helper, concrete contract +* of calling this helper (arguments, etc.) can be found at the place of +* definition of this helper (or its ID) within present OPEN specification. +*/ +typedef struct OpenMethodExecutionParams { + /** call corresponding VM helper upon entry to the managed method */ + Boolean exe_notify_method_entry : 1; + + /** call corresponding VM helper upon exit from the managed method */ + Boolean exe_notify_method_exit : 1; + + /** call corresponding VM helper upon reading a value of a field which has set */ + Boolean exe_notify_field_access : 1; + + /** call corresponding VM helper upon setting a value of a field which has set */ + Boolean exe_notify_field_modification : 1; + + /** + * call corresponding VM helper upon exception throw, + * if by default the throw code does not enter any VM helper + * (for example, in case of JIT optimizations) + */ + Boolean exe_notify_exception_throw : 1; + + /** + * call corresponding VM helper upon exception catch, + * if by default the exception propagation code does not enter any VM helper + * (for example, in case of JIT optimizations) + */ + Boolean exe_notify_exception_catch : 1; + + /** + * call corresponding VM helper upon entering a monitor, + * if by default the monitor enter code does not enter any VM helper + * (for example, in case of JIT optimizations) + */ + Boolean exe_notify_monitor_enter : 1; + + /** + * call corresponding VM helper upon exiting a monitor, + * if by default the monitor exit code does not enter any VM helper + * (for example, in case of JIT optimizations) + */ + Boolean exe_notify_monitor_exit : 1; + + /** + * call corresponding VM helper upon entering a contended monitor, + * if by default the contended monitor enter code does not enter any VM helper + * (for example, in case of JIT optimizations) + */ + Boolean exe_notify_contended_monitor_enter : 1; + + /** + * call corresponding VM helper upon exiting a contended monitor, + * if by default the contended monitor exit code does not enter any VM helper + * (for example, in case of JIT optimizations) + */ + Boolean exe_notify_contended_monitor_exit : 1; + + /** perform method in-lining during compilation (JIT-specific) */ + Boolean exe_do_method_inlining : 1; + + /** + * Keep correspondence between bytecode offsets and native instruction IPs (JIT-specific). + * For a JIT this, in particular, means that it should not do any optimizations which + * may hinder this mapping. It should also store the map after method compilation so that + * later VM could use appropriate ExeJPDA interfaces to retrieve the mapping. + */ + Boolean exe_do_code_mapping : 1; + + /** + * Keep correspondence between bytecode local variables and locations of the + * native operands (JIT-specific) in relevant locations within method code. + * For a JIT this, in particular, means that it should not do any optimizations + * which may hinder this mapping. It should also store the map after method compilation + * so that later VM could use appropriate ExeJPDA interfaces to retrieve the mapping. + */ + Boolean exe_do_local_var_mapping : 1; + + /** call corresponding VM helper upon setting a value of any field of reference type */ + Boolean exe_insert_write_barriers : 1; + + /** + * Provide possibility to obtain reference to the current 'this' object by + * means of get_address_of_this method. Used for JVMTI debug support. + */ + Boolean exe_provide_access_to_this : 1; + + /** + * Provide restoring of arguments in the stack after the call + * of the unwind_frame method so that method could be called again + * with the same arguments. Used for JVMTI debug support. + */ + Boolean exe_restore_context_after_unwind : 1; + + /** + * Sent CompileMethodLoad event when a method is compiled and loaded into memory + */ + Boolean exe_notify_compiled_method_load : 1; + +} OpenMethodExecutionParams; + + + /////////////////////////////////////////////////////// + // begin Frame Contexts for JITs + +#ifdef _IPF_ + + // Note that the code in transfer context is very depend upon the ordering of fields in this structure. + // Be very careful in changing this structure. + typedef + struct JitFrameContext { + uint64 *p_ar_pfs; + uint64 *p_eip; + uint64 sp; + uint64 *p_gr[128]; + uint64 *p_fp[128]; + uint64 preds; + uint64 *p_br[8]; + uint64 nats_lo; + uint64 nats_hi; + Boolean is_ip_past; + uint64 ar_fpsr; + uint64 ar_unat; + uint64 ar_lc; + } JitFrameContext; //JitFrameContext + +#elif defined _EM64T_ + + typedef + struct JitFrameContext { + uint64 rsp; + uint64 * p_rbp; + uint64 * p_rip; + + // Callee-saved registers + uint64 * p_rbx; + uint64 * p_r12; + uint64 * p_r13; + uint64 * p_r14; + uint64 * p_r15; + + // The scratch registers are currently only valid during GC enumeration. + uint64 * p_rax; + uint64 * p_rcx; + uint64 * p_rdx; + uint64 * p_rsi; + uint64 * p_rdi; + uint64 * p_r8; + uint64 * p_r9; + uint64 * p_r10; + uint64 * p_r11; + + // To restore processor flags during transfer + uint32 eflags; + + Boolean is_ip_past; + } JitFrameContext; + +#else // "_IA32_" + + typedef + struct JitFrameContext { + uint32 esp; + uint32 *p_ebp; + uint32 *p_eip; + + // Callee-saved registers + uint32 *p_edi; + uint32 *p_esi; + uint32 *p_ebx; + + // The scratch registers are currently only valid during GC enumeration. + uint32 *p_eax; + uint32 *p_ecx; + uint32 *p_edx; + + // To restore processor flags during transfer + uint32 eflags; + + Boolean is_ip_past; + } JitFrameContext; + +#endif // "_IA32_" + + // end Frame Contexts for JITs + /////////////////////////////////////////////////////// + +typedef void * InlineInfoPtr; +typedef void * Compile_Handle; //deprecated?? + +typedef + enum Method_Side_Effects { + MSE_Unknown, + MSE_True, + MSE_False, + MSE_True_Null_Param + } Method_Side_Effects; + +/** +* @sa method_allocate_code_block +*/ + +typedef enum Code_Allocation_ActionEnum { + CAA_Simulate, + CAA_Allocate +}Code_Allocation_Action; + +// +// Code block heat - used when a method is split into hot and cold parts +// +typedef enum { + CodeBlockHeatMin, + CodeBlockHeatDefault, + CodeBlockHeatMax +} CodeBlockHeat; + + +#endif // !_RUNTIME_TYPES_H_ Propchange: harmony/enhanced/drlvm/trunk/vm/include/open/rt_types.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h?rev=634179&r1=634178&r2=634179&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h Wed Mar 5 23:00:16 2008 @@ -31,15 +31,14 @@ #include "open/types.h" #include "open/ee_em_intf.h" +#include "open/rt_types.h" #ifdef __cplusplus extern "C" { #endif // __cplusplus -typedef void *Compile_Handle; -#include "jit_export_rt.h" //////////////////////////////////////////////////////// // Optional functions that don't have to be provided. @@ -52,119 +51,6 @@ // Required functions. //////////////////////////////////////////////////////// -/** -* Elements of this struct correspond to certain requirements -* of how a managed method is executed (what it additionally does -* during execution). Most of them correspond to requirements to -* call a certain VM helpers at certain places in the code. For JIT, -* in particular, this means that it will have to generate additional -* code which will perform these calls. -*

-* Each of the requirement is associated with a corresponding ability of -* the EE to satisfy this requirement. So, elements of the struct should also -* be used to denote EE capabilities related to method execution. -*

-* If an element corresponds to a certain VM helper, concrete contract -* of calling this helper (arguments, etc.) can be found at the place of -* definition of this helper (or its ID) within present OPEN specification. -*/ -typedef struct OpenMethodExecutionParams { - /** call corresponding VM helper upon entry to the managed method */ - Boolean exe_notify_method_entry : 1; - - /** call corresponding VM helper upon exit from the managed method */ - Boolean exe_notify_method_exit : 1; - - /** call corresponding VM helper upon reading a value of a field which has set */ - Boolean exe_notify_field_access : 1; - - /** call corresponding VM helper upon setting a value of a field which has set */ - Boolean exe_notify_field_modification : 1; - - /** - * call corresponding VM helper upon exception throw, - * if by default the throw code does not enter any VM helper - * (for example, in case of JIT optimizations) - */ - Boolean exe_notify_exception_throw : 1; - - /** - * call corresponding VM helper upon exception catch, - * if by default the exception propagation code does not enter any VM helper - * (for example, in case of JIT optimizations) - */ - Boolean exe_notify_exception_catch : 1; - - /** - * call corresponding VM helper upon entering a monitor, - * if by default the monitor enter code does not enter any VM helper - * (for example, in case of JIT optimizations) - */ - Boolean exe_notify_monitor_enter : 1; - - /** - * call corresponding VM helper upon exiting a monitor, - * if by default the monitor exit code does not enter any VM helper - * (for example, in case of JIT optimizations) - */ - Boolean exe_notify_monitor_exit : 1; - - /** - * call corresponding VM helper upon entering a contended monitor, - * if by default the contended monitor enter code does not enter any VM helper - * (for example, in case of JIT optimizations) - */ - Boolean exe_notify_contended_monitor_enter : 1; - - /** - * call corresponding VM helper upon exiting a contended monitor, - * if by default the contended monitor exit code does not enter any VM helper - * (for example, in case of JIT optimizations) - */ - Boolean exe_notify_contended_monitor_exit : 1; - - /** perform method in-lining during compilation (JIT-specific) */ - Boolean exe_do_method_inlining : 1; - - /** - * Keep correspondence between bytecode offsets and native instruction IPs (JIT-specific). - * For a JIT this, in particular, means that it should not do any optimizations which - * may hinder this mapping. It should also store the map after method compilation so that - * later VM could use appropriate ExeJPDA interfaces to retrieve the mapping. - */ - Boolean exe_do_code_mapping : 1; - - /** - * Keep correspondence between bytecode local variables and locations of the - * native operands (JIT-specific) in relevant locations within method code. - * For a JIT this, in particular, means that it should not do any optimizations - * which may hinder this mapping. It should also store the map after method compilation - * so that later VM could use appropriate ExeJPDA interfaces to retrieve the mapping. - */ - Boolean exe_do_local_var_mapping : 1; - - /** call corresponding VM helper upon setting a value of any field of reference type */ - Boolean exe_insert_write_barriers : 1; - - /** - * Provide possibility to obtain reference to the current 'this' object by - * means of get_address_of_this method. Used for JVMTI debug support. - */ - Boolean exe_provide_access_to_this : 1; - - /** - * Provide restoring of arguments in the stack after the call - * of the unwind_frame method so that method could be called again - * with the same arguments. Used for JVMTI debug support. - */ - Boolean exe_restore_context_after_unwind : 1; - - /** - * Sent CompileMethodLoad event when a method is compiled and loaded into memory - */ - Boolean exe_notify_compiled_method_load : 1; - -} OpenMethodExecutionParams; /** Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export_rt.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export_rt.h?rev=634179&r1=634178&r2=634179&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export_rt.h (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export_rt.h Wed Mar 5 23:00:16 2008 @@ -14,11 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Alexei Fedotov - * @version $Revision: 1.1.2.1.4.3 $ - */ - // // These are the functions that a JIT built as a DLL must export for @@ -28,103 +23,13 @@ #ifndef _JIT_EXPORT_RT_H #define _JIT_EXPORT_RT_H - #include "open/types.h" -#include "jit_export.h" +#include "open/rt_types.h" +#include "open/em.h" #ifdef __cplusplus extern "C" { #endif // __cplusplus - - - -/////////////////////////////////////////////////////// -// begin Frame Contexts for JITs - -#ifdef _IPF_ - -// Note that the code in transfer context is very depend upon the ordering of fields in this structure. -// Be very careful in changing this structure. -typedef -struct JitFrameContext { - uint64 *p_ar_pfs; - uint64 *p_eip; - uint64 sp; - uint64 *p_gr[128]; - uint64 *p_fp[128]; - uint64 preds; - uint64 *p_br[8]; - uint64 nats_lo; - uint64 nats_hi; - Boolean is_ip_past; - uint64 ar_fpsr; - uint64 ar_unat; - uint64 ar_lc; -} JitFrameContext; //JitFrameContext - -#elif defined _EM64T_ - -typedef -struct JitFrameContext { - uint64 rsp; - uint64 * p_rbp; - uint64 * p_rip; - - // Callee-saved registers - uint64 * p_rbx; - uint64 * p_r12; - uint64 * p_r13; - uint64 * p_r14; - uint64 * p_r15; - - // The scratch registers are currently only valid during GC enumeration. - uint64 * p_rax; - uint64 * p_rcx; - uint64 * p_rdx; - uint64 * p_rsi; - uint64 * p_rdi; - uint64 * p_r8; - uint64 * p_r9; - uint64 * p_r10; - uint64 * p_r11; - - // To restore processor flags during transfer - uint32 eflags; - - Boolean is_ip_past; -} JitFrameContext; - -#else // "_IA32_" - -typedef -struct JitFrameContext { - uint32 esp; - uint32 *p_ebp; - uint32 *p_eip; - - // Callee-saved registers - uint32 *p_edi; - uint32 *p_esi; - uint32 *p_ebx; - - // The scratch registers are currently only valid during GC enumeration. - uint32 *p_eax; - uint32 *p_ecx; - uint32 *p_edx; - - // To restore processor flags during transfer - uint32 eflags; - - Boolean is_ip_past; -} JitFrameContext; - -#endif // "_IA32_" - -typedef void * InlineInfoPtr; - -// end Frame Contexts for JITs -/////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////