You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2005/10/08 06:29:29 UTC
svn commit: r307257 [16/24] - in
/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm: ./ bootJVM/
bootJVM/jni/ bootJVM/jni/src/ bootJVM/jni/src/gnu/
bootJVM/jni/src/gnu/classpath/ bootJVM/jni/src/gnu/classpath/0.16/
bootJVM/jni/src/gnu/classpath...
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmcfg.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmcfg.c?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmcfg.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmcfg.c Fri Oct 7 21:27:56 2005
@@ -0,0 +1,114 @@
+/*!
+ * @file jvmcfg.c
+ *
+ * @brief Real machine constant types convenient for C/C++ source code.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jvmcfg.c $ \$Id: jvmcfg.c 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed 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.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ * Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+#include "arch.h"
+ARCH_COPYRIGHT_APACHE(jvmcfg, c, "$URL: https://svn.apache.org/path/name/jvmcfg.c $ $Id: jvmcfg.c 0 09/28/2005 dlydick $");
+
+
+#define I_AM_JVMCFG_C /* Permit xxx_NULL_xxx definition constants */
+#include "jvmcfg.h"
+#include "classfile.h"
+
+
+/*! @brief Real machine NULL thread index */
+const jvm_thread_index jvm_thread_index_null = JVMCFG_NULL_THREAD;
+
+/*! @brief Real machine NULL constant pool index */
+const jvm_constant_pool_index jvm_constant_pool_index_null =
+ CONSTANT_CP_DEFAULT_INDEX;
+
+/*! @brief Real machine NULL interface table index */
+const jvm_interface_index jvm_interface_index_bad =JVMCFG_BAD_INTERFACE;
+
+/*! @brief Real machine NULL class index */
+const jvm_class_index jvm_class_index_null = JVMCFG_NULL_CLASS;
+
+/*!
+ * @brief Real machine BAD method index (or interface method index)
+ * in class
+ */
+const jvm_method_index jvm_method_index_bad = JVMCFG_BAD_METHOD;
+
+/*! @brief Real machine BAD field index in class */
+const jvm_field_index jvm_field_index_bad = JVMCFG_BAD_FIELD;
+
+/*! @brief Real machine BAD field lookup index in class */
+const jvm_field_lookup_index jvm_field_lookup_index_bad =
+ JVMCFG_BAD_FIELD_LOOKUP;
+
+/*!
+ * @brief Real machine BAD attribute index in class
+ */
+const jvm_attribute_index jvm_attribute_index_bad =JVMCFG_BAD_ATTRIBUTE;
+
+/*!
+ * @brief Real machine NATIVE (method) attribute index
+ */
+const jvm_attribute_index jvm_attribute_index_native =
+ JVMCFG_NATIVE_METHOD_ATTRIBUTE;
+
+/*!
+ * @brief Real machine NULL ordinal for local native method
+ */
+const jvm_native_method_ordinal jvm_native_method_ordinal_null =
+ JVMCFG_JLOBJECT_NMO_NULL;
+
+/*!
+ * @brief Real machine registration ordinal for local native method
+ */
+const jvm_native_method_ordinal jvm_native_method_ordinal_register =
+ JVMCFG_JLOBJECT_NMO_REGISTER;
+
+/*!
+ * @brief Real machine un-registration ordinal for local native method
+ */
+const jvm_native_method_ordinal jvm_native_method_ordinal_unregister =
+ JVMCFG_JLOBJECT_NMO_UNREGISTER;
+
+/*! @brief Real machine BAD program counter value in class */
+jvm_pc_offset jvm_pc_offset_bad = CODE_CONSTRAINT_CODE_LENGTH_MAX;
+
+/*! @brief Real machine BAD unicode string index in class */
+const jvm_unicode_string_index jvm_unicode_string_index_bad =
+ JVMCFG_BAD_UNICODE_STRING;
+
+/*! @brief Real machine NULL object hash */
+const jvm_object_hash jvm_object_hash_null = JVMCFG_NULL_OBJECT;
+
+
+/* EOF */
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmcfg.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmcfg.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmcfg.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmcfg.h Fri Oct 7 21:27:56 2005
@@ -0,0 +1,1246 @@
+#ifndef _jvmcfg_h_included_
+#define _jvmcfg_h_included_
+
+/*!
+ * @file jvmcfg.h
+ *
+ * @brief Sizes of JVM items, max number of classes, objects, threads,
+ * etc., and other general program configuration.
+ *
+ * Notice that the maximum number of items is also dependent
+ * on the data type that contains counts of that item. For
+ * example, since the thread index is an
+ * <b><code>(unsigned short)</code></b>,
+ * there can be no more than 2^16 threads in the system.
+ *
+ *
+ * @par NOTES FOR JAVA NATIVE INTERFACE
+ *
+ * In order to keep this implementation @e absolutely independent
+ * of @e any implementation of \<jni.h\> and subsidiary header files,
+ * the following typedefs have been redefined in the JNI portion
+ * of these header files:
+ *
+ * jvm_object_hash ...found in @link jvm/include/jlObject.h
+ jlObject.h@endlink
+ *
+ * jvm_thread_index ...found in @link jvm/include/jlThread.h
+ jlThread.h@endlink
+ *
+ * jvm_class_index ...found in @link jvm/include/jlClass.h
+ jlClass.h@endlink
+ *
+ * These types are used for function prototypes for JNI code.
+ *
+ *
+ * @todo Add proper searching for 'rt.jar' file and '-bootclasspath'.
+ * For the moment, they are defined in
+ * @link config.h config.h@endlink as the
+ * @link #CONFIG_HACKED_RTJARFILE CONFIG_HACKED_RTJARFILE@endlink
+ * and @link #CONFIG_HACKED_BOOTCLASSPATH
+ CONFIG_HACKED_BOOTCLASSPATH@endlink
+ * pre-processor symbols and are implemented in
+ * @link jvm/src/classpath.c classpath.c@endlink
+ * in this way.
+ *
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jvmcfg.h $ \$Id: jvmcfg.h 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed 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.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ * Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @todo Need to evaluate if and when and how to phase out use of the
+ * configuration variables @link #CONFIG_HACKED_RTJARFILE
+ CONFIG_HACKED_RTJARFILE@endlink and
+ @link #CONFIG_HACKED_BOOTCLASSPATH
+ CONFIG_HACKED_BOOTCLASSPATH@endlink
+ *
+ * @internal Decide whether or not to use the
+ * @link #CONFIG_HACKED_RTJARFILE CONFIG_HACKED_xxx@endlink definitions
+ * from @link config.h config.h@endlink. Consider two fragments of
+ * source code showing with/without comment possibility (immediately
+ * follows this note in the source code).
+ *
+ * @section Reference
+ *
+ */
+
+ARCH_COPYRIGHT_APACHE(jvmcfg, h, "$URL: https://svn.apache.org/path/name/jvmcfg.h $ $Id: jvmcfg.h 0 09/28/2005 dlydick $");
+
+
+#include "jrtypes.h"
+
+
+/*
+#undef CONFIG_HACKED_BOOTCLASSPATH
+*/
+
+/*
+#undef CONFIG_HACKED_RTJARFILE
+*/
+
+
+/*!
+ * @name OS File system conventions.
+ *
+ * @brief Conventions for OS file systems (see also
+ * @link jvm/src/classfile.h classfile.h@endlink
+ * for @link #CLASSFILE_EXTENSION_DEFAULT
+ CLASSFILE_EXTENSION_xxx@endlink definitions).
+ *
+ * @verbatim
+
+ Unix style: /path/name1/name2/filename.extension
+
+ Windows style: c:\path\name1\name2\filename.extension
+
+ * @endverbatim
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#ifdef CONFIG_WINDOWS
+#define JVMCFG_PATHNAME_DELIMITER_CHAR '\\'
+#define JVMCFG_PATHNAME_DELIMITER_STRING "\\"
+
+#define JVMCFG_EXTENSION_DELIMITER_CHAR '.'
+#define JVMCFG_EXTENSION_DELIMITER_STRING "."
+
+#else
+#define JVMCFG_PATHNAME_DELIMITER_CHAR '/'
+#define JVMCFG_PATHNAME_DELIMITER_STRING "/"
+
+#define JVMCFG_EXTENSION_DELIMITER_CHAR '.'
+#define JVMCFG_EXTENSION_DELIMITER_STRING "."
+
+#endif
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @brief Descriptor for strings.
+ *
+ * Use this descriptor for manually loading startup class
+ * @c @b java.lang.String objects.
+ *
+ * Resolves to "Ljava/lang/String;"
+ *
+ */
+#define JVMCFG_MANUAL_STRING_DESCRIPTOR \
+ BASETYPE_STRING_L JVMCLASS_JAVA_LANG_STRING BASETYPE_STRING_L_TERM
+
+
+/*!
+ * @name Individual command line tokens
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Command line declaring that startup class is in a @b JAR file
+ * and the name of that file.
+ *
+ */
+#define JVMCFG_JARFILE_STARTCLASS_PARM "-jar"
+
+
+/*!
+ * @brief Command line option to show command line help.
+ *
+ */
+#define JVMCFG_COMMAND_LINE_HELP_PARM "-help"
+
+
+/*!
+ * @brief Command line option to show software license.
+ *
+ */
+#define JVMCFG_COMMAND_LINE_LICENSE_PARM "-license"
+
+
+/*!
+ * @brief Command line option to show program version number.
+ *
+ */
+#define JVMCFG_COMMAND_LINE_VERSION_PARM "-version"
+
+
+/*!
+ * @brief Command line option to show program copyright message.
+ *
+ */
+#define JVMCFG_COMMAND_LINE_COPYRIGHT_PARM "-copyright"
+
+
+/*!
+ * @brief Command line option to show program options.
+ *
+ */
+#define JVMCFG_COMMAND_LINE_SHOW_PARM "-show"
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Environment variable names
+ *
+ * @brief Environment variables used by Java.
+ *
+ * Each one of these may be overridden from the command line.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMCFG_ENVIRONMENT_VARIABLE_JAVA_HOME "JAVA_HOME"
+#define JVMCFG_ENVIRONMENT_VARIABLE_CLASSPATH "CLASSPATH"
+#define JVMCFG_ENVIRONMENT_VARIABLE_BOOTCLASSPATH "BOOTCLASSPATH"
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Default environment variable definitions
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @internal Hard-coded @b CLASSPATH for test purposes.
+ * Set to any desired value and uncomment for use.
+ */
+/* #define JVMCFG_HARDCODED_TEST_CLASSPATH \
+ "/tmp:/usr/tmp:/usr/local/tmp"
+*/
+
+
+/*!
+ * @brief Default @b JAVA_HOME .
+ *
+ * Set the default value of the @b JAVA_HOME environment
+ * variable to an @link #rnull rnull@endlink pointer.
+ */
+#define JVMCFG_JAVA_HOME_DEFAULT rnull
+
+
+/*!
+ * @brief Default @b CLASSPATH to current directory only.
+ *
+ */
+#define JVMCFG_CLASSPATH_DEFAULT ((const rchar *) ".")
+
+/*!
+ * @brief Default @b BOOTCLASSPATH to our temp area.
+ *
+ * This area starts out empty, meaning that nothing will be found
+ * there to boot from, but a default of some sort is needed. May
+ * be overridden by
+ * @link #JVMCFG_BOOTCLASSPATH_FULL_PARM -Xbootclasspath@endlink.
+ *
+ */
+#define JVMCFG_BOOTCLASSPATH_DEFAULT tmparea_get()
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name -Xjava_home token and its aliases
+ *
+ * @brief Command line options defining @b JAVA_HOME instead.
+ * of the environment variable
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMCFG_JAVA_HOME_ABBREV_PARM "-Xjh"
+#define JVMCFG_JAVA_HOME_MID_PARM "-Xjavahome"
+#define JVMCFG_JAVA_HOME_FULL_PARM "-Xjava_home"
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name -classpath token and its alises
+ *
+ * @brief Command line options defining @b CLASSPATH instead of
+ * using the environment variable.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMCFG_CLASSPATH_ABBREV_PARM "-cp"
+#define JVMCFG_CLASSPATH_FULL_PARM "-classpath"
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name -Xbootclasspath token and its aliases
+ *
+ * @brief Command line options defining @b BOOTCLASSPATH instead of
+ * using the environment variable.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMCFG_BOOTCLASSPATH_ABBREV_PARM "-Xbcp"
+#define JVMCFG_BOOTCLASSPATH_FULL_PARM "-Xbootclasspath"
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name -Xdebug_level token and its aliases
+ *
+ * @brief Command line options defining debug message level.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMCFG_DEBUGMSGLEVEL_ABBREV_PARM "-Xdebug"
+#define JVMCFG_DEBUGMSGLEVEL_MID_PARM "-Xdebuglevel"
+#define JVMCFG_DEBUGMSGLEVEL_FULL_PARM "-Xdebug_level"
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Native method support
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Native method registration method name.
+ *
+ */
+#define JVMCFG_REGISTER_NATIVES_METHOD "registerNatives"
+
+/*!
+ * @brief Native method registration method descriptor.
+ *
+ * Resolves to "()V"
+ *
+ */
+#define JVMCFG_REGISTER_NATIVES_PARMS \
+ METHOD_STRING_OPEN_PARM \
+ METHOD_STRING_CLOSE_PARM \
+ METHOD_STRING_VOID
+
+
+/*!
+ * @brief Native method unregistration method name.
+ *
+ */
+#define JVMCFG_UNREGISTER_NATIVES_METHOD "unregisterNatives"
+
+/*!
+ * @brief Native method unregistration method descriptor.
+ *
+ * Resolves to "()V"
+ *
+ */
+#define JVMCFG_UNREGISTER_NATIVES_PARMS \
+ METHOD_STRING_OPEN_PARM \
+ METHOD_STRING_CLOSE_PARM \
+ METHOD_STRING_VOID
+
+/*!
+ * @brief Ignore native method calls.
+ *
+ * If ignored, then return the same default value as is
+ * default for field initializations (namely, zero,
+ * @link #jfalse jfalse@endlink, @link #jnull jnull@endlink, etc.)
+ * If not ignored, then attempt to run them. In both
+ * cases, produce a return value as appropriate.
+ *
+ */
+#define JVMCFG_IGNORE_NATIVE_METHOD_CALLS rtrue
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name main() method support
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Startup class' @c @b main() method name.
+ *
+ */
+#define JVMCFG_MAIN_METHOD "main"
+
+/*!
+ * @brief Startup class' @c @b main() method parameter list.
+ *
+ * Resolves to "([Ljava/lang/String;)V"
+ *
+ */
+#define JVMCFG_MAIN_PARMS METHOD_STRING_OPEN_PARM \
+ BASETYPE_STRING_ARRAY \
+ BASETYPE_STRING_L \
+ JVMCLASS_JAVA_LANG_STRING \
+ BASETYPE_STRING_L_TERM \
+ METHOD_STRING_CLOSE_PARM \
+ METHOD_STRING_VOID
+
+/*!
+ * @brief Startup class' @c @b main() method local variable index
+ * for @c @b args[]
+ *
+ */
+#define JVMCFG_MAIN_PARM_ARGV_INDEX 0
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Exception handling support.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Constructor to use for basic exception handling.
+ *
+ */
+#define JVMCFG_EXCEPTION_DEFAULT_CONSTRUCTOR_DESCRIPTOR \
+ METHOD_STRING_OPEN_PARM \
+ METHOD_STRING_CLOSE_PARM \
+ METHOD_STRING_VOID
+
+
+/*!
+ * @brief Uncaught exception method name.
+ *
+ */
+#define JVMCFG_UNCAUGHT_EXCEPTION_METHOD "uncaughtException"
+
+/*!
+ * @brief Uncaught exception method parameter list.
+ *
+ * Resolves to "([Ljava/lang/Thread;[Ljava/lang/Throwable;)V"
+ *
+ */
+#define JVMCFG_UNCAUGHT_EXCEPTION_PARMS METHOD_STRING_OPEN_PARM \
+ BASETYPE_STRING_ARRAY \
+ BASETYPE_STRING_L \
+ JVMCLASS_JAVA_LANG_THREAD \
+ BASETYPE_STRING_L_TERM \
+ BASETYPE_STRING_ARRAY \
+ BASETYPE_STRING_L \
+ JVMCLASS_JAVA_LANG_THROWABLE \
+ BASETYPE_STRING_L_TERM \
+ METHOD_STRING_CLOSE_PARM \
+ METHOD_STRING_VOID
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Object finalization support.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * Object finalize method name.
+ */
+#define JVMCFG_FINALIZE_OBJECT_METHOD "finalize"
+
+/*!
+ * Object finalize method descriptor.
+ *
+ * Resolves to "()V"
+ *
+ */
+#define JVMCFG_FINALIZE_OBJECT_PARMS \
+ METHOD_STRING_OPEN_PARM \
+ METHOD_STRING_CLOSE_PARM \
+ METHOD_STRING_VOID
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Array dimension support.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Spec-defined number of array dimensions
+ */
+#define JVMCFG_MAX_ARRAY_DIMS CONSTANT_MAX_ARRAY_DIMS
+
+/*!
+ * @brief Array dimension type.
+ */
+typedef jubyte jvm_array_dim;
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Interval timer support.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief JVM interval timer enable.
+ *
+ * When @link #rtrue rtrue@endlink, the timer runs normally.
+ * Set it @link #rfalse rfalse@endlink typically only for debugging
+ * the JVM outer loop logic or for debugging the interval timer logic
+ * itself.
+ *
+ * @warning See warning about use of
+ * @link #timeslice_tick() timeslice_tick()@endlink
+ * and high-speed interval timing.
+ *
+ * @todo Make sure to enable the time slicer for normal JVM operation.
+ * It may be handy to disable it for debugging, but no threading
+ * will occur in the JVM outer loop until it is enabled!
+ *
+ */
+#define JVMCFG_TIMESLICE_PERIOD_ENABLE rfalse
+
+/*!
+ * @brief JVM interval timer period (seconds)
+ *
+ * This value is typically zero (0) for normal operation.
+ * Set it to any convenient number of seconds for debugging
+ * the JVM outer loop.
+ *
+ * Setting both timer values to zero will disable the interval
+ * timer completely.
+ *
+ * @warning See warning about use of
+ * @link #timeslice_tick() timeslice_tick()@endlink
+ * and high-speed interval timing.
+ *
+ */
+#define JVMCFG_TIMESLICE_PERIOD_SECONDS 0
+
+/*!
+ * @brief JVM interval timer period (microseconds)
+ *
+ * For correct operation of the JVM interval timer at 1 kHz,
+ * set this value to one thousand (1000). This will guarantee
+ * that timer periods such as
+ * @link java.lang.Thread.sleep() sleep()@endlink and
+ * @link java.lang.Object.wait() wait()@endlink will work
+ * according to their definitions. This value may be set
+ * to some other value for debug purposes.
+ *
+ * Setting both timer values to zero will disable the interval
+ * timer completely.
+ *
+ * @warning See warning about use of
+ * @link #timeslice_tick() timeslice_tick()@endlink
+ * and high-speed interval timing.
+ *
+ */
+#define JVMCFG_TIMESLICE_PERIOD_MICROSECONDS 1000 /* 1000 := 1 ms*/
+
+
+/*!
+ * @brief Minimum number of seconds before
+ * @link #timeslice_tick() timeslice_tick()@endlink starts
+ * printing a short message at every timer tick.
+ *
+ * Print "timeslice_tick: tick" at every interval timer event.
+ * If set to a non-zero value, typically for debug purposes,
+ * @link #timeslice_tick() timeslice_tick()@endlink will start
+ * reporting timer events through a standard error message
+ * via @link #sysDbgMsg() sysDbgMsg()@endlink after the defined
+ * number of seconds. It is effectively a delay value to enable
+ * this message, but only after a certain run time has passed.
+ * When using this facility, <em>absolutely sure</em> that the
+ * value of @link #JVMCFG_TIMESLICE_PERIOD_SECONDS
+ JVMCFG_TIMESLICE_PERIOD_SECONDS@endlink is large enough
+ * that these reports do not overwhelm the standard error resource
+ * and prohibit productive work.
+ *
+ * A value of zero (0) disables this facility.
+ *
+ */
+#define JVMCFG_TIMESLICE_DEBUG_REPORT_MIN_SECONDS 0
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Thread table support.
+ *
+ * @brief JVM Thread model definitions.
+ *
+ * @note Thread groups are supported by the class library.
+ *
+ * @note The @link #JVMCFG_NULL_THREAD JVMCFG_NULL_THREAD@endlink
+ * is @e never used at run time.
+ *
+ * @note The @link #JVMCFG_SYSTEM_THREAD JVMCFG_SYSTEM_THREAD@endlink
+ * will @e never be used within the context of the JVM execution
+ * engine. Its purpose is ONLY for internal administration.
+ * THEREFORE: there will @e never be a
+ * @c @b java.lang.Thread object created for it!
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMCFG_MAX_THREADS 1000 /* Total possible threads */
+#ifdef I_AM_JVMCFG_C
+#define JVMCFG_NULL_THREAD 0 /* Never allocated */
+#endif
+#define JVMCFG_SYSTEM_THREAD 1 /* System thread */
+#define JVMCFG_GC_THREAD 2 /* Garbage collector thread */
+#define JVMCFG_FIRST_THREAD 3 /* First allocatable thread */
+
+ /*
+ * Thread indices all use this type
+ *
+ * (See parallel definition for use
+ * in public interface in
+ * @link jvm/include/jlThread.h
+ jlThread.h@endlink)
+ */
+typedef rushort jvm_thread_index;
+
+ /* Real machine NULL index for threads */
+extern const jvm_thread_index jvm_thread_index_null;
+
+#define JVMCFG_THREAD_NAME_SYSTEM "system" /* system thread */
+#define JVMCFG_THREAD_NAME_GC "gc" /* Garbage collector thread*/
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Class file support
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Constant pool indices all use this type
+ */
+typedef u2 jvm_constant_pool_index;
+
+/*!
+ * @brief Real machine NULL constant_pool index
+ */
+extern const jvm_constant_pool_index jvm_constant_pool_index_null;
+
+
+/*!
+ * @internal Due to the way the JVM spec defines the
+ * @link ClassFile#interfaces interfaces@endlink
+ * member as an array of @link #u2 u2@endlink,
+ * it is technically a bad thing to redefine
+ * such data type. However, in order to be consistent with all
+ * of the other array index definitions, this will be done anyway:
+ *
+ */
+
+/*!
+ * @brief Interface table indices all use this type
+ *
+ */
+typedef u2 jvm_interface_index;
+
+/*!
+ * @brief Real machine BAD interface table index
+ *
+ */
+extern const jvm_interface_index jvm_interface_index_bad;
+
+/*!
+ * @brief Bad interface slot, usually "not found"
+ *
+ */
+#define JVMCFG_BAD_INTERFACE 65535
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Class table support
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Max number of class allocations
+ *
+ */
+#define JVMCFG_MAX_CLASSES 200
+
+#ifdef I_AM_JVMCFG_C
+
+/*!
+ * @brief Null class slot coincides with hash 0
+ *
+ */
+#define JVMCFG_NULL_CLASS 0
+#endif
+
+/*!
+ * @brief First object slot to allocate
+ *
+ */
+#define JVMCFG_FIRST_CLASS 1
+
+/*!
+ * @brief Class indices all use this type
+ *
+ */
+typedef rushort jvm_class_index;
+
+/*!
+ * @brief Real machine NULL index for classes
+ */
+extern const jvm_class_index jvm_class_index_null;
+
+/*!
+ * @brief Method table indices all use this type
+ *
+ */
+typedef u2 jvm_method_index;
+
+/*!
+ * @brief Real machine BAD index for methods
+ *
+ */
+extern const jvm_method_index jvm_method_index_bad;
+
+/*!
+ * @brief Bad method slot, usually "not found"
+ *
+ */
+#define JVMCFG_BAD_METHOD 65535
+
+
+/*!
+ * @brief Field table indices all use this type
+ *
+ */
+typedef u2 jvm_field_index;
+
+/*!
+ * @brief Real machine NULL index for fields
+ *
+ */
+extern const jvm_field_index jvm_field_index_bad;
+
+/*!
+ * @brief Bad field slot, usually "not found"
+ *
+ */
+#define JVMCFG_BAD_FIELD 65535
+
+/*!
+ * @brief Field table lookups all use this type
+ *
+ */
+typedef u2 jvm_field_lookup_index;
+
+/*!
+ * @brief Real machine NULL index for field lookups
+ *
+ */
+extern const jvm_field_lookup_index jvm_field_lookup_index_bad;
+
+/*!
+ * @brief Bad lookup slot, usually "not found"
+ *
+ */
+#define JVMCFG_BAD_FIELD_LOOKUP 65535
+
+/*!
+ * @brief Attribute table indices all use this type
+ *
+ */
+typedef u2 jvm_attribute_index;
+
+/*!
+ * @brief Real machine NULL index for attributes
+ *
+ */
+extern const jvm_attribute_index jvm_attribute_index_bad;
+
+/*!
+ * @brief Real machine marker for native method
+ *
+ */
+extern const jvm_attribute_index jvm_attribute_index_native;
+
+/*!
+ * @brief Ordinal number for local native method
+ *
+ */
+typedef unsigned int jvm_native_method_ordinal;
+
+/*!
+ * @brief Real machine NULL ordinal number for local native methods
+ *
+ */
+extern const jvm_native_method_ordinal jvm_native_method_ordinal_null;
+
+/*!
+ * @brief Null local method slot, usually "not found".
+ *
+ * See also parallel definition
+ * @link jvm/include/jlObject.h JLOBJECT_NMO_NULL@endlink
+ *
+ */
+#define JVMCFG_JLOBJECT_NMO_NULL 0
+
+/*!
+ * @brief Real machine reserved ordinal number for registering
+ * local native methods
+ *
+ */
+extern
+ const jvm_native_method_ordinal jvm_native_method_ordinal_register;
+
+/*!
+ * @brief Reserved local method slot for the
+ * registration of @e local native methods.
+ *
+ * See also parallel definition
+ * @link jvm/include/jlObject.h JLOBJECT_NMO_REGISTER@endlink
+ *
+ */
+#define JVMCFG_JLOBJECT_NMO_REGISTER 1
+
+/*!
+ * @brief Real machine reserved ordinal number
+ * for <em>un</em>-registering local native methods
+ *
+ */
+extern
+ const jvm_native_method_ordinal jvm_native_method_ordinal_unregister;
+
+/*!
+ * @brief Reserved local method slot for the
+ * un-registration of @e local native methods.
+ *
+ * See also parallel definition
+ * @link jvm/include/jlObject.h JLOBJECT_NMO_UNREGISTER@endlink
+ *
+ */
+#define JVMCFG_JLOBJECT_NMO_UNREGISTER 2
+
+/*!
+ * @brief Bad attribute slot,usually "not found"
+ *
+ */
+#define JVMCFG_BAD_ATTRIBUTE 65535
+
+/*!
+ * @brief Native method slot,no code attribute
+ *
+ */
+#define JVMCFG_NATIVE_METHOD_ATTRIBUTE 65534
+
+/*!
+ * @brief UTF8 string table indices all use this type
+ *
+ */
+typedef u2 jvm_utf_string_index;
+
+/*!
+ * @brief Unicode string table indices all use this type
+ *
+ */
+typedef u2 jvm_unicode_string_index;
+
+/*!
+ * @brief Real machine BAD index for Unicode
+ *
+ */
+extern const jvm_unicode_string_index jvm_unicode_string_index_bad;
+
+/*!
+ * @brief Bad unicode string slot, usually "not found"
+ *
+ */
+#define JVMCFG_BAD_UNICODE_STRING 65535
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Object table support
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Max number of object allocations
+ *
+ */
+#define JVMCFG_MAX_OBJECTS 1000
+
+#ifdef I_AM_JVMCFG_C
+/*!
+ * @brief Null object slot coincides w/hash 0
+ *
+ */
+#define JVMCFG_NULL_OBJECT 0
+#endif
+
+/*!
+ * @brief First object slot to allocate
+ *
+ */
+#define JVMCFG_FIRST_OBJECT 1
+
+/*!
+ * @brief Object reference, corresponding to the
+ * JNI type @c @b jobject
+ *
+ * See parallel definition for use in public interface in
+ * @link jvm/include/jlObject.h jlObject.h@endlink
+ *
+ */
+typedef ruint jvm_object_hash;
+
+/*!
+ * @brief Real machine NULL hash
+ *
+ */
+extern const jvm_object_hash jvm_object_hash_null;
+
+/*!
+ * @brief Holds spec @link #ACC_PUBLIC ACC_xxx@endlink bit masks
+ *
+ */
+typedef u2 jvm_access_flags;
+
+/*!
+ * @brief Holds object data type, such as @c @b I == Integer
+ *
+ */
+typedef u1 jvm_basetype;
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Stack size definitions
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Arbitrary max stack size, in bytes
+ *
+ * This value @e must be in increments of 4 bytes!
+ *
+ * @warning This value @e must be in increments of 4 bytes! (Get it?)
+ *
+ */
+#define JVMCFG_STACK_SIZE (8 * 1024 * sizeof(jint))
+
+/*!
+ * @brief Maximum stack pointer value
+ *
+ */
+#define JVMCFG_MAX_SP (JVMCFG_STACK_SIZE - sizeof(jint))
+
+/*!
+ * @brief Empty stack pointer value
+ *
+ */
+#define JVMCFG_NULL_SP 0
+
+/*!
+ * @brief Stack pointer type
+ *
+ */
+typedef jushort jvm_sp;
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Program counter definitions
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Program counter offset into code area of a method
+ *
+ * This data type is used in jvm_pc.
+ *
+ */
+typedef juint jvm_pc_offset;
+
+/*!
+ * @brief Invalid program counter offset
+ *
+ */
+extern jvm_pc_offset jvm_pc_offset_bad;
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Debug levels for sysDbgMsg().
+ *
+ * @brief Set increasingly verbose debug message levels for sysDbgMsg().
+ *
+ * Notice that the lowest debug message level setting
+ * @link #DML0 DML0@endlink indicates that a message using
+ * it is probablt a good candidate to be changed to the
+ * unconditional sysErrMsg() function instead.
+ *
+ * @see jvmutil_set_dml()
+ *
+ * @see jvmutil_get_dml()
+ *
+ * @see sysDbgMsg()
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+typedef enum
+{
+ DML0 = 0, /**< Only @e VITAL debug messages */
+ DML1 = 1, /**< Minimum amount of debug messages */
+ DML2 = 2,
+ DML3 = 3,
+ DML4 = 4,
+ DML5 = 5, /**< Average amount of debug messages */
+ DML6 = 6,
+ DML7 = 7,
+ DML8 = 8,
+ DML9 = 9,
+ DML10 = 10 /**< Absolutely ALL debug messages */
+
+} jvm_debug_level_enum;
+
+#define DMLOFF DML0 /**< Convenient alias for
+ @link #DML0 DML0@endlink */
+#define DMLMIN DML1 /**< Convenient alias for
+ @link #DML0 DML1@endlink */
+#define DMLNORM DML5 /**< Convenient alias for
+ @link #DML0 DML5@endlink */
+#define DMLMAX DML10 /**< Convenient alias for
+ @link #DML0 DML10@endlink */
+
+
+#define DMLDEFAULT DMLNORM /**< Initial debug level, may be
+ * changed by command line parameter.
+ */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Arbitrary max buffer sizes
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMCFG_STDIO_BFR 1024 /**< Convenient size for any stdio msg */
+#define JVMCFG_PATH_MAX 1024 /**< Convenient size for any disk path */
+#define JVMCFG_SCRIPT_MAX 1024 /**< Convenient size for a
+ @c @b system(3) call */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Standard I/O definitions
+ *
+ * The definitions of printf, fprint, and sprintf will co-opt @e all
+ * usual standard I/O operations and encourage the use of the local
+ * version of these functions. See
+ *@link jvm/src/stdio.c stdio.c@endlink
+ * for details on why this is so.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Enable stderr debug messages using sysDbgMsg() format messages
+ *
+ * When disabled, @e no debug message will display.
+ * The debug levels, including the default level
+ * @link #DMLDEFAULT DMLDEFAULT@endlink, are defined in
+ * @link jvm/src/util.h util.h@endlink.
+ *
+ */
+#define JVMCFG_DEBUG_MESSAGE_ENABLE rtrue
+
+/* Only defined in @link jvm/src/stdio.c stdio.c@endlink */
+#ifndef SUPPRESS_STDIO_REDIRECTION
+
+#define printf _printfLocal
+#define fprintf _fprintfLocal
+#define sprintf _sprintfLocal
+
+#endif
+
+/*!
+ * @brief When desired, persuade Eclipse to flush its stdio buffers
+ * better by invoking @c @b sleep(3) for <= 1 second (with arg of '1').
+ *
+ */
+#if 0
+#define JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER sleep(1)
+#else
+#define JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER
+#endif
+
+/*!
+ * @brief Same thing as @link #JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER
+ JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER@endlink, but at end of
+ * JVM run before exit, try to persuade Eclipse to flush @e all
+ * standard I/O buffers before quitting JVM.
+ *
+ */
+#define JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER_EXIT sleep(1)
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Initialization roll call globals
+ *
+ * Each of these symbols tracks a phase of jvm_init() in case there
+ * is an error at some point and jvm_shutdown() needs to be called.
+ * When that happens, only those initializion phases that were
+ * complete are reversed and cleaned up.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+extern rboolean jvm_timeslice_initialized;
+extern rboolean jvm_thread_initialized;
+extern rboolean jvm_class_initialized;
+extern rboolean jvm_object_initialized;
+extern rboolean jvm_argv_initialized;
+extern rboolean jvm_classpath_initialized;
+extern rboolean jvm_tmparea_initialized;
+extern rboolean jvm_heap_initialized;
+extern rboolean jvm_model_initialized;
+
+/*@} */ /* End of grouped definitions */
+
+/*!
+ * @name Temporary disk area script support
+ *
+ * @brief Shell scripts to support selected temporary area operations.
+ *
+ * Notice that @c @b mkdir(2) is used for creating this directory, but
+ * that a shell script fragment @link
+ #JVMCFG_TMPAREA_REMOVE_SCRIPT JVMCFG_TMPAREA_REMOVE_SCRIPT@endlink
+ * is used for removing it.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Temporary area default when no @b TMPDIR environment variable
+ */
+#define JVMCFG_TMPAREA_DEFAULT "/tmp"
+
+/*!
+ * @brief Remove temporary directory
+ */
+#define JVMCFG_TMPAREA_REMOVE_SCRIPT "rm -rf %s"
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name JAR file structural items
+ *
+ *
+ * @todo Write and implement DOS/Windows version of these scripts.
+ * Perhaps a two- or three-line .BAT file is the thing to do?
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#ifdef CONFIG_WINDOWS
+
+/* Need Windows equivalents here... */
+
+#else
+
+#define JVMCFG_JARFILE_DATA_EXTRACT_SCRIPT \
+ "chdir %s; %s/bin/jar -xf %s%c%s %s; chmod -R +w ."
+
+#define JVMCFG_JARFILE_MANIFEST_EXTRACT_SCRIPT \
+ "chdir %s; %s/bin/jar -xf %s; chmod -R +w ."
+
+#endif
+
+#define JVMCFG_JARFILE_MANIFEST_FILENAME "META-INF/MANIFEST.MF"
+
+#define JVMCFG_JARFILE_MANIFEST_MAIN_CLASS "Main-Class:"
+
+#define JVMCFG_JARFILE_MANIFEST_LINE_MAX 72
+
+/*@} */ /* End of grouped definitions */
+
+#endif /* _jvmcfg_h_included_ */
+
+
+/* EOF */
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmclass.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmclass.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmclass.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmclass.h Fri Oct 7 21:27:56 2005
@@ -0,0 +1,165 @@
+#ifndef _classlist_h_included_
+#define _classlist_h_included_
+
+/*!
+ * @file jvmclass.h
+ *
+ * @brief Definition of <b><code>java.lang</code></b> classes used by
+ * the Java Virtual Machine for its normal operation.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jvmclass.h $ \$Id: jvmclass.h 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed 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.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ * Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+ARCH_COPYRIGHT_APACHE(jvmclass, h, "$URL: https://svn.apache.org/path/name/jvmclass.h $ $Id: jvmclass.h 0 09/28/2005 dlydick $");
+
+
+/*! Package name for internal Java language classes */
+#define JVMCLASS_JAVA_LANG "java/lang"
+
+
+/*!
+ * @name Java class names.
+ *
+ * @brief Java classes used internally by the JVM.
+
+ * Each of these classes is required internall in some way by the
+ * Java Virtual Machine.
+ *
+ * Make sure whether or not these should be included
+ * in @link ./config.sh config.sh@endlink in the @b bootclasspath lists
+ * of classes in the JAVA_LANG_CLASS_LIST shell variable
+ * (as JAVA_LANG_CLASS_LIST="Object Void String...").
+ *
+ * Although
+ * <b><code>java.nio.channels.ClosedByInterruptException</code></b>
+ * is not part of <b><code>java.lang</code></b>, it use also used
+ * internally by the JVM and so is listed here.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMCLASS_JAVA_LANG_OBJECT CONSTANT_UTF8_JAVA_LANG_OBJECT
+#define JVMCLASS_JAVA_LANG_STRING "java/lang/String"
+#define JVMCLASS_JAVA_LANG_CLASS "java/lang/Class"
+#define JVMCLASS_JAVA_LANG_THREADGROUP "java/lang/ThreadGroup"
+#define JVMCLASS_JAVA_LANG_RUNTIME "java/lang/Runtime"
+#define JVMCLASS_JAVA_LANG_SYSTEM "java/lang/System"
+#define JVMCLASS_JAVA_LANG_THREAD "java/lang/Thread"
+
+#define JVMCLASS_JAVA_LANG_THROWABLE "java/lang/Throwable"
+
+#define JVMCLASS_JAVA_LANG_STACKTRACEELEMENT \
+ "java/lang/StackTraceElement"
+
+#define JVMCLASS_JAVA_LANG_ERROR "java/lang/Error"
+#define JVMCLASS_JAVA_LANG_UNSUPPORTEDCLASSVERSIONERROR \
+ "java/lang/UnsupportedClassVersionError"
+
+/* java.lang.LinkageError and it subclasses */
+#define JVMCLASS_JAVA_LANG_LINKAGEERROR "java/lang/LinkageError"
+#define JVMCLASS_JAVA_LANG_CLASSCIRCULARITYERROR \
+ "java/lang/ClassCircularityError"
+#define JVMCLASS_JAVA_LANG_CLASSFORMATERROR \
+ "java/lang/ClassFormatError"
+#define JVMCLASS_JAVA_LANG_EXCEPTIONININITIALIZERERROR \
+ "java/lang/ExceptionInInitializerError"
+#define JVMCLASS_JAVA_LANG_NOCLASSDEFFOUNDERROR \
+ "java/lang/NoClassDefFoundError"
+#define JVMCLASS_JAVA_LANG_UNSATISFIEDLINKERROR \
+ "java/lang/UnsatisfiedLinkError"
+#define JVMCLASS_JAVA_LANG_VERIFYERROR \
+ "java/lang/VerifyError"
+
+/* java.lang.IncompatibleClasSchangeError and its subclasses */
+#define JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR \
+ "java/lang/IncompatibleClassChangeError"
+#define JVMCLASS_JAVA_LANG_NOSUCHFIELDERROR \
+ "NosuchFieldError"
+#define JVMCLASS_JAVA_LANG_NOSUCHMETHODERROR \
+ "NoSuchMethodError"
+#define JVMCLASS_JAVA_LANG_INSTANTIATIONERROR \
+ "InstantiationError"
+#define JVMCLASS_JAVA_LANG_ILLEGALACCESSERROR \
+ "IllegalAccessError"
+
+/* java.lang.VirtualMachineError and its subclasses */
+#define JVMCLASS_JAVA_LANG_VIRTUALMACHINEERROR \
+ "java/lang/VirtualMachineError"
+#define JVMCLASS_JAVA_LANG_INTERNALERROR \
+ "java/lang/InternalError"
+#define JVMCLASS_JAVA_LANG_STACKOVERFLOWERROR \
+ "java/lang/StackOverflowError"
+#define JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR \
+ "java/lang/OutOfMemoryError"
+#define JVMCLASS_JAVA_LANG_UNKNOWNERROR \
+ "java/lang/UnknownError"
+
+#define JVMCLASS_JAVA_LANG_EXCEPTION "java/lang/Exception"
+#define JVMCLASS_JAVA_LANG_ARRAYINDEXOUTOFBOUNDSEXCEPTION \
+ "java/lang/ArrayIndexOutOfBoundsException"
+#define JVMCLASS_JAVA_LANG_NEGATIVEARRAYSIZEEXCEPTION \
+ "java/lang/NegativeArraySizeException"
+#define JVMCLASS_JAVA_LANG_ARRAYSTOREEXCEPTION \
+ "java/lang/ArrayStoreException"
+#define JVMCLASS_JAVA_LANG_CLASSNOTFOUNDEXCEPTION \
+ "java/lang/ClassNotFoundException"
+#define JVMCLASS_JAVA_LANG_CLONENOTSUPPORTEDEXCEPTION \
+ "java/lang/CloneNotSupportedException"
+#define JVMCLASS_JAVA_LANG_RUNTIMEEXCEPTION \
+ "java/lang/RuntimeException"
+#define JVMCLASS_JAVA_LANG_ARITHMETICEXCEPTION \
+ "java/lang/ArithmeticException"
+#define JVMCLASS_JAVA_LANG_ILLEGALARGUMENTEXCEPTION \
+ "java/lang/IllegalArgumentException"
+#define JVMCLASS_JAVA_LANG_ILLEGALMONITORSTATEEXCEPTION \
+ "java/lang/IllegalMonitorStateException"
+#define JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION \
+ "java/lang/IllegalThreadStateException"
+#define JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION \
+ "java/lang/InterruptedException"
+#define JVMCLASS_JAVA_LANG_INDEXOUTOFBOUNDSEXCEPTION \
+ "java/lang/IndexOutOfBoundsException"
+#define JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION \
+ "java/lang/NullPointerException"
+#define JVMCLASS_JAVA_LANG_SECURITYEXCEPTION \
+ "java/lang/SecurityException"
+
+#define JVMCLASS_JAVA_NIO_CHANNELS_CLOSEDBYINTERRUPTEXCEPTION \
+ "java/nio/channels/ClosedByInterruptException"
+
+/*@} */ /* End of grouped definitions */
+
+
+#endif /* _jvmclass_h_included_ */
+
+/* EOF */
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmreg.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmreg.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmreg.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmreg.h Fri Oct 7 21:27:56 2005
@@ -0,0 +1,1012 @@
+#ifndef _jvmreg_h_included_
+#define _jvmreg_h_included_
+
+/*!
+ * @file jvmreg.h
+ *
+ * @brief Registers of the Java Virtual Machine, including
+ * the program counter, stack pointer, frame pointer, etc.
+ *
+ * Definition of the JVM registers for this real machine
+ * implementation, namely, the stack area and program counter.
+ * There are a significant number of macros available for
+ * navigating push-up stack area, the stack pointer, and
+ * stack frame.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jvmreg.h $ \$Id: jvmreg.h 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed 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.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ * Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+ARCH_COPYRIGHT_APACHE(jvmreg, h, "$URL: https://svn.apache.org/path/name/jvmreg.h $ $Id: jvmreg.h 0 09/28/2005 dlydick $");
+
+/*!
+ * @brief Program counter.
+ *
+ * The program counter is the location in the code array of a
+ * JVM method of current JVM instruction. Definition includes
+ * class, method, attribute of code area, and offset in the
+ * code array.
+ *
+ * @todo Does an @p @b arraydims item need to be added for processing
+ * of array classes, or is the scalar concept sufficient in code?
+ */
+typedef struct
+{
+ jvm_class_index clsidx; /**< class[clsidx] of code location*/
+ jvm_method_index mthidx; /**< method[mthidx] of code location*/
+ jvm_attribute_index codeatridx;/**< attributes[atridx] of code */
+ jvm_attribute_index excpatridx;/**< attributes[atridx] of
+ exceptions */
+ jvm_pc_offset offset; /**< instruction within code area */
+} jvm_pc;
+
+
+/*!
+ * The JVM's virtual operation codes are defined as single bytes.
+ * This type definition is used to address them.
+ */
+typedef u1 jvm_virtual_opcode;
+
+
+/*!
+ * @name Two types of exception tables.
+ *
+ * The JVM exception index table (defined by @b Exceptions attribute)
+ * and JVM exception table (defined inside @b Code attribute) are both
+ * simple offsets into their respective tables. Both are bound up
+ * directly with the program counter, so are defined here.
+ */
+/*@{ */
+
+typedef u2 jvm_exception_table_index;
+typedef u2 jvm_exception_index_table_index;
+
+/*@} */
+
+
+
+/*!
+ * @brief Access structures of stack at certain index
+ */
+#define STACK(thridx, stkidx) THREAD(thridx).stack[stkidx]
+
+
+/*!
+ * @name Stack frame geometry.
+ *
+ * Frame height = PC + GC + FP + max_locals (from code atr) + SA (aka
+ * max_stack, SA being scratch area, the operand stack).
+ * Minimum will be a zero-sized max_locals plus current SA.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+ /*! Each of 5 items takes 1 stack word*/
+#define JVMREG_STACK_PC_HEIGHT 5
+
+
+ /*! Frame pointer takes one word */
+#define JVMREG_STACK_FP_HEIGHT 1
+
+#ifdef CONFIG_WORDSIZE64
+ /*! GC real machine 64-bit ptr
+ takes 2 words */
+#define JVMREG_STACK_GC_HEIGHT 2
+#else
+ /*! GC real machine 32-bit ptr
+ takes 1 word */
+#define JVMREG_STACK_GC_HEIGHT 1
+#endif
+
+ /*! Num local storage words
+ takes 1 word */
+#define JVMREG_STACK_LS_HEIGHT 1
+
+/*!
+ * @warning WATCH OUT! When invoking POP_GC() you are working with a
+ * partially torn down frame, so can't use this macro:
+ */
+#define JVMREG_STACK_MIN_FRAME_HEIGHT (JVMREG_STACK_GC_HEIGHT + \
+ JVMREG_STACK_FP_HEIGHT + \
+ JVMREG_STACK_LS_HEIGHT)
+
+/*! Offsets from current FP of local storage size word */
+#define JVMREG_STACK_LS_OFFSET JVMREG_STACK_LS_HEIGHT
+
+/*! Offsets from current FP of garbage collection pointer */
+#define JVMREG_STACK_GC_OFFSET JVMREG_STACK_LS_OFFSET \
+ + JVMREG_STACK_GC_HEIGHT
+
+/*! Offsets from current FP of old frame pointer */
+#define JVMREG_STACK_FP_OFFSET JVMREG_STACK_GC_OFFSET \
+ + JVMREG_STACK_FP_HEIGHT
+
+/*! Offsets from current FP of stack pointer */
+#define JVMREG_STACK_PC_OFFSET JVMREG_STACK_FP_OFFSET \
+ + JVMREG_STACK_PC_HEIGHT
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Reading and writing to the stack pointer.
+ *
+ * @brief Load/store values from/to the stack pointer itself,
+ * not stack memory it points to.
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ * @param value (jvm_sp) value to store into stack pointer.
+ *
+ *
+ * @returns The @b GET_SP() macros return a (jvm_sp) value of
+ * a stack pointer, the others return
+ * @link #rvoid rvoid@endlink.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define GET_SP(thridx) (THREAD(thridx).sp)
+
+
+#define PUT_SP_IMMEDIATE(thridx, value) THREAD(thridx).sp = value
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Reading and writing into the stack area.
+ *
+ *
+ * @param thridx Thread index of thread whose stack it to
+ * be manipulated.
+ *
+ * @param value (jint) value to store into stack location.
+ *
+ *
+ * @returns The @b GET_SP() macros return a (jint) value from
+ * the stack, the others
+ * return @link #rvoid rvoid@endlink.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Read a word at given depth in stack.
+ */
+#define GET_SP_WORD(thridx, idx, cast) \
+ ((cast) (STACK(thridx, GET_SP(thridx) - idx)))
+
+/*!
+ * @brief Write a word at given depth in stack.
+ */
+#define PUT_SP_WORD(thridx, idx, value) \
+ STACK(thridx, GET_SP(thridx) - idx) = (jint) (value)
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Reading and writing to the stack pointer.
+ *
+ * @brief Load/store values from/to the frame pointer.
+ *
+ *
+ * @param thridx Thread index of thread whose frame pointer
+ * is to be referenced.
+ *
+ * @param value (jvm_sp) value to store into frame pointer.
+ *
+ *
+ * @returns The @b GET_FP() macros return a (jvm_sp) value of
+ * a stack pointer, the others
+ * return @link #rvoid rvoid@endlink.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define GET_FP(thridx) (THREAD(thridx).fp)
+
+#define PUT_FP_IMMEDIATE(thridx, value) THREAD(thridx).fp = (value)
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @brief Retrieve the stack frame garbage collection pointer.
+ *
+ *
+ * @param thridx Thread index of thread whose garbage collection
+ * pointer is to be referenced.
+ *
+ *
+ * @returns (@link #rvoid rvoid@endlink *) is a real machine untyped
+ * pointer that is stored in a JVM stack location.
+ * Adjustments for 32-bit and 64-bit real machine pointers
+ * are already considered by @link #JVMREG_STACK_GC_HEIGHT
+ JVMREG_STACK_GC_HEIGHT@endlink.
+ *
+ */
+#define GET_GC(thridx) \
+ ((rvoid *) &STACK(thridx, GET_FP(thridx) + JVMREG_STACK_GC_OFFSET))
+
+/*!
+ * @name Move the stack pointer up and down.
+ *
+ * @brief Increment/decrement SP (N/A to frame pointer).
+ *
+ * It is safe to reference @b SP in the @p @b value parameter.
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ * @param value (jint) value to change stack pointer by.
+ *
+ *
+ * @returns @link #rvoid rvoid@endlink
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define INC_SP(thridx, value) THREAD(thridx).sp += (value)
+#define DEC_SP(thridx, value) THREAD(thridx).sp -= (value)
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Stack push and pop for any 32-bit data type.
+ *
+ * @brief Push/pop item to/from stack (MUST be integer size!).
+ *
+ * @warning <b>DO NOT</b> push/pop any 64-bit item, namely
+ * any @link #jlong jlong@endlink or
+ * @link #jdouble jdouble@endlink value.
+ * The stack pointer is only adjusted by
+ * a single 32-bit word. Use two operations
+ * to push/pop each half of such types. There
+ * are a number of examples in code, both in
+ * @link jvm/src/opcode.c opcode.c@endlink and
+ * @link jvm/src/native.c native.c@endlink.
+ *
+ * @warning It is @e not safe to reference @b SP in the @p @b item
+ * parameter of @b POP().
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ * @param item (@b cast) variable to push/pop to/from the stack.
+ *
+ * @param cast Type cast of variable being poped from the stack.
+ *
+ *
+ * @returns @link #PUSH() PUSH()@endlink returns
+ * @link #rvoid rvoid@endlink, @link #POP() POP()@endlink
+ * returns the requested (jint) value.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define PUSH(thridx, item) INC_SP(thridx, 1); \
+ PUT_SP_WORD(thridx, 0, (item))
+
+#define POP(thridx, item, cast) item = GET_SP_WORD(thridx, 0, cast); \
+ DEC_SP(thridx, 1)
+
+/*@} */ /* End of grouped definitions */
+
+/*!
+ * @name Stack push and pop of frame pointer.
+ *
+ * @brief Push/pop FP to/from stack.
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ *
+ * @returns @link #PUSH_FP() PUSH_FP()@endlink returns
+ * @link #rvoid rvoid@endlink, @link #POP_FP() POP_FP()@endlink
+ * returns the requested (jvm_sp) value.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define PUSH_FP(thridx) PUSH(thridx, THREAD(thridx).fp)
+
+#define POP_FP(thridx) POP(thridx, THREAD(thridx).fp, jvm_sp)
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Stack push and pop of garbage collection pointer.
+ *
+ * @brief Push/pop GC pointer to/from stack.
+ *
+ * Due to the potential for multiple GC implementations in this JVM,
+ * the GC pointer here is @e not related to any one of them. Instead,
+ * it is cast here as a simple @link #rvoid rvoid@endlink pointer so as
+ * to support all of them.
+ *
+ * @todo Verify that the 64-bit real pointer
+ * calculations work properly for @b PUSH_GC() and @b POP_GC()
+ * (namely, where use fo JVMREG_STACK_GC_HEIGHT is involved)
+ *
+ * @warning WATCH OUT! When invoking @b POP_GC() you are working with a
+ * partially torn down frame, so can't use standard macros
+ * to calculate stack offsets!
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ *
+ * @returns @link #rvoid rvoid@endlink
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define PUSH_GC(thridx, num_locals) \
+ INC_SP(thridx, JVMREG_STACK_GC_HEIGHT); \
+ ((rvoid *) \
+ *(&STACK(thridx, THREAD(thridx).sp - JVMREG_STACK_GC_HEIGHT+1))) =\
+ GC_STACK_NEW(thridx, num_locals)
+
+#define POP_GC(thridx) \
+ GC_STACK_DELETE(thridx, \
+ ((rvoid **) \
+ &STACK(thridx, THREAD(thridx).sp - \
+ JVMREG_STACK_GC_HEIGHT + 1)), \
+ (&STACK(thridx, THREAD(thridx).sp - \
+ JVMREG_STACK_GC_HEIGHT + 1 - \
+ JVMREG_STACK_LS_HEIGHT - 1))); \
+ DEC_SP(thridx, JVMREG_STACK_GC_HEIGHT)
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Push and pop of local variables.
+ *
+ * @brief Add/remove empty space for local storage to/from stack.
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ * @param value (jint) value to change stack pointer by.
+ *
+ *
+ * @returns @link #rvoid rvoid@endlink
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define PUSH_LOCAL(thridx, items) INC_SP(thridx, items) /*! alias */
+#define POP_LOCAL(thridx, items) DEC_SP(thridx, items) /*! alias */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Locate position in stack frame of its components.
+ *
+ * @brief Locate the local storage size, garbage collection pointer,
+ * old frame pointer, and start of local storage area.
+ *
+ * The current frame pointer always points to the first word of
+ * the local storage area of the stack frame.
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ *
+ * @returns (jvm_sp) stack offset value of requested item.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMREG_FRAME_CURRENT_LOCAL_STORAGE_SIZE(thridx) \
+ (GET_FP(thridx) + JVMREG_STACK_LS_OFFSET)
+
+#define JVMREG_FRAME_GC(thridx) \
+ (GET_FP(thridx) + JVMREG_STACK_GC_OFFSET)
+
+#define JVMREG_FRAME_PREVIOUS_FP(thridx) \
+ (GET_FP(thridx) + JVMREG_STACK_FP_OFFSET)
+
+#define JVMREG_FRAME_CURRENT_SCRATCH_AREA(thridx) GET_FP(thridx)
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Macros for manipulating program counter.
+ *
+ * @brief load the program counter and store its contents from/to
+ * an arbitrary location, from/to the stack, and load with an
+ * immediate value.
+ *
+ *
+ * @param _thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ * @param _source (jvm_pc) value to be loaded
+ * into program counter.
+ *
+ * @param _clsidx (jvm_class_index) value to be loaded
+ * into program counter class index
+ *
+ * @param _mthidx (jvm_method_index) value to be loaded
+ * into program counter class index
+ *
+ * @param _codeatridx (jvm_attribute_index) value to be loaded
+ * into program counter class index
+ *
+ * @param _excpatridx (jvm_attribute_index) value to be loaded
+ * into program counter class index
+ *
+ * @param _excpatridx (jvm_attribute_index) value to be loaded
+ * into program counter class index
+ *
+ * @param _offset (jvm_pc_offset) value to be loaded
+ * into program counter class index
+ *
+ * @param _field Field from program counter to extract.
+ *
+ *
+ * @returns (jvm_sp) stack offset value of requested item.
+ *
+ */
+/*@{ */ /* Begin grouped definitions */
+
+#define PUT_PC(_thridx, _source) \
+ THREAD(_thridx).pc.clsidx = (_source).clsidx; \
+ THREAD(_thridx).pc.mthidx = (_source).mthidx; \
+ THREAD(_thridx).pc.codeatridx = (_source).atridx; \
+ THREAD(_thridx).pc.excpatridx = (_source).atridx; \
+ THREAD(_thridx).pc.offset = (_source).offset
+
+#define PUT_PC_IMMEDIATE(_thridx, \
+ _clsidx, \
+ _mthidx, \
+ _codeatridx, \
+ _excpatridx, \
+ _offset) \
+ THREAD(_thridx).pc.clsidx = (_clsidx); \
+ THREAD(_thridx).pc.mthidx = (_mthidx); \
+ THREAD(_thridx).pc.codeatridx = (_codeatridx); \
+ THREAD(_thridx).pc.excpatridx = (_excpatridx); \
+ THREAD(_thridx).pc.offset = (_offset)
+
+#define GET_PC(_thridx, _target) \
+ _target.clsidx = THREAD(_thridx).pc.clsidx \
+ _target.mthidx = THREAD(_thridx).pc.mthidx \
+ _target.codeatridx = THREAD(_thridx).pc.codeatridx \
+ _target.excpatridx = THREAD(_thridx).pc.excpatridx \
+ _target.offset = THREAD(_thridx).pc.offset
+
+#define GET_PC_FIELD_IMMEDIATE(_thridx, _field) \
+ THREAD(_thridx).pc._field
+
+#define GET_PC_FIELD(_thridx, _target, _field) \
+ _target = GET_PC_FIELD_IMMEDIATE(_thridx, _field)
+
+#define PUSH_PC(_thridx) \
+ PUSH(_thridx, THREAD(_thridx).pc.offset); \
+ PUSH(_thridx, THREAD(_thridx).pc.excpatridx); \
+ PUSH(_thridx, THREAD(_thridx).pc.codeatridx); \
+ PUSH(_thridx, THREAD(_thridx).pc.mthidx); \
+ PUSH(_thridx, THREAD(_thridx).pc.clsidx); /* Extra ; */
+
+#define POP_PC(_thridx) \
+ POP(_thridx, THREAD(_thridx).pc.clsidx, jvm_class_index); \
+ POP(_thridx, THREAD(_thridx).pc.mthidx, u2); \
+ POP(_thridx, THREAD(_thridx).pc.codeatridx, u2); \
+ POP(_thridx, THREAD(_thridx).pc.excpatridx, u2); \
+ POP(_thridx, THREAD(_thridx).pc.offset, jvm_pc_offset); /*Extra ; */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Location of the old program counter in the current stack frame.
+ *
+ * @warning Notice NEGATIVE INDEX used to address the stack frame.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JVMREG_STACK_PC_CLSIDX_OFFSET JVMREG_STACK_PC_OFFSET - 0
+#define JVMREG_STACK_PC_MTHIDX_OFFSET JVMREG_STACK_PC_OFFSET - 1
+#define JVMREG_STACK_PC_CODEATRIDX_OFFSET JVMREG_STACK_PC_OFFSET - 2
+#define JVMREG_STACK_PC_EXCPATRIDX_OFFSET JVMREG_STACK_PC_OFFSET - 3
+#define JVMREG_STACK_PC_OFFSET_OFFSET JVMREG_STACK_PC_OFFSET - 4
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Navigate the code area of of the current method.
+ *
+ * @brief Calculate pointers to several important real machine
+ * addresses in the class file of the current method of a
+ * specific thread:
+ *
+ * <ul>
+ * <li>
+ * <b>(1)</b> current program counter in THIS_PC() macro.
+ * </li>
+ * <li>
+ * <b>(2)</b> current class file in THIS_PCFS() macro.
+ * </li>
+ * <li>
+ * <b>(3)</b> PC exception index table base (list of legal exceptions)
+ * in DEREFERENCE_PC_EXCEPTIONS_ATTRIBUTE() macro.
+ * </li>
+ * <li>
+ * <b>(4)</b> PC exception base (list of actual exceptions thrown)
+ * in DEREFERENCE_PC_EXCEPTION_TABLE() macro.
+ * </li>
+ * <li>
+ * <b>(5)</b> PC base (start of method) in DEREFERENCE_PC_CODE_BASE()
+ * macro.
+ * </li>
+ * <li>
+ * <b>(6)</b> current opcode in DEREFERENCE_PC_CODE_CURRENT_OPCODE()
+ * macro.
+ * </li>
+ * </ul>
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @def THIS_PC()
+ *
+ * @brief Locate program counter for a given thread.
+ *
+ *
+ * @param thridx Thread table index of program counter to locate.
+ *
+ *
+ * @returns address of program counter in this thread table.
+ *
+ */
+#define THIS_PC(thridx) (&THREAD(thridx).pc)
+
+
+/*!
+ * @def THIS_PCFS()
+ *
+ * @brief Locate ClassFile for current program counter
+ * on a given thread.
+ *
+ *
+ * @param thridx Thread table index of class to locate for
+ * current program counter.
+ *
+ *
+ * @returns address of ClassFile structure containing code at
+ * current program counter on this thread.
+ *
+ */
+#define THIS_PCFS(thridx) \
+ (CLASS_OBJECT_LINKAGE(THIS_PC(thridx)->clsidx)->pcfs)
+
+
+/*!
+ * @def DEREFERENCE_PC_GENERIC_ATTRIBUTE()
+ *
+ * @brief Untyped attribute in method table for current program
+ * counter on a given thread.
+ *
+ *
+ * @param thridx Thread table index of attribute to locate for
+ * current program counter.
+ *
+ * @param pc_member jvm_pc member index in current program counter to
+ * pick out and examine.
+ *
+ *
+ * @returns Plain attribute address (no special attribute type)
+ * of an attribute in method area of the current program counter
+ * on this thread, or @link #rnull rnull@endlink if a @b BAD attribute .
+ *
+ * @todo Watch out for when @p @b codeatridx is a BAD index, namely
+ * @link #jvm_attribute_index_bad jvm_attribute_index_bad@endlink
+ *
+ */
+#define DEREFERENCE_PC_GENERIC_ATTRIBUTE(thridx, pc_member) \
+ ((jvm_attribute_index_bad != THIS_PC(thridx)->pc_member) \
+ ? (&THIS_PCFS(thridx)->methods[THIS_PC(thridx)->mthidx] \
+ ->attributes[THIS_PC(thridx)->pc_member] \
+ ->ai) \
+ : rnull)
+
+
+/*!
+ * @def DEREFERENCE_PC_EXCEPTIONS_ATTRIBUTE()
+ *
+ * @brief Exceptions_attribute in method table for current program
+ * counter on a given thread.
+ *
+ *
+ * @param thridx Thread table index of @b Exceptions attribute to
+ * locate for current program counter.
+ *
+ *
+ * @returns Address of @b Exceptions attribute in method area of
+ * the current program counter on this thread.
+ *
+ */
+#define DEREFERENCE_PC_EXCEPTIONS_ATTRIBUTE(thridx) \
+ ((Exceptions_attribute *) \
+ DEREFERENCE_PC_GENERIC_ATTRIBUTE(thridx, excpatridx))
+
+
+/*!
+ * @def DEREFERENCE_PC_CODE_ATTRIBUTE()
+ *
+ * @brief Code_attribute in method table for current program counter
+ * on a given thread.
+ *
+ *
+ * @param thridx Thread table index of @b Code attribute to locate for
+ * current program counter.
+ *
+ *
+ * @returns Address of @b Code attribute in method area of
+ * the current program counter on this thread, or
+ * @link #rnull rnull@endlink if not present in class file.
+ *
+ */
+#define DEREFERENCE_PC_CODE_ATTRIBUTE(thridx) \
+ ((Code_attribute *) \
+ DEREFERENCE_PC_GENERIC_ATTRIBUTE(thridx, codeatridx))
+
+
+/*!
+ * @def DEREFERENCE_PC_EXCEPTION_TABLE()
+ *
+ * @brief Real address of exception table of this method in
+ * current program counter on a given thread.
+ *
+ *
+ * @param thridx Thread table index of program counter to locate.
+ *
+ *
+ * @returns address of program counter in this thread table, or
+ * @link #rnull rnull@endlink if not present in class file.
+ *
+ */
+#define DEREFERENCE_PC_EXCEPTION_TABLE(thridx) \
+ (DEREFERENCE_PC_CODE_ATTRIBUTE(thridx)->exception_table)
+
+
+/*!
+ * @def DEREFERENCE_PC_CODE_BASE
+ *
+ * @brief Real address of first opcode of this method in current
+ * program counter on a given thread.
+ *
+ *
+ * @param thridx Thread table index of opcode to locate for
+ * current program counter.
+ *
+ *
+ * @returns Real machine address of @e first opcode in current
+ * program counter on this thread.
+ *
+ */
+#define DEREFERENCE_PC_CODE_BASE(thridx) \
+ (DEREFERENCE_PC_CODE_ATTRIBUTE(thridx)->code)
+
+
+/*!
+ * @def DEREFERENCE_PC_CODE_CURRENT_OPCODE()
+ *
+ * @brief Real address of first opcode of this method in current
+ * program counter on a given thread.
+ *
+ *
+ * @param thridx Thread table index of opcode to locate for
+ * current program counter.
+ *
+ *
+ * @returns Real machine address of @e current opcode in current
+ * program counter on this thread.
+ *
+ */
+#define DEREFERENCE_PC_CODE_CURRENT_OPCODE(thridx) \
+ (&DEREFERENCE_PC_CODE_BASE(thridx)[THIS_PC(thridx)->offset])
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Geometry of a complete stack frame.
+ *
+ * @brief A complete stack frame is pushed every time a JVM virtual
+ * method is called, where old program counter and old stack state
+ * must be saved and a new one created on top of it. The macro
+ * @b PUSH_FRAME() is designed for this use. For example,
+ * here is an existing stack frame:
+ *
+ * @verbatim
+ SP --> [scratch] (operand stack, >= 0 words) ... higher address
+ ... ...
+ [scratch] ...
+ [top of previous frame] ...
+ FP -> [locals of previous frame] ... lower address
+
+ @endverbatim
+ *
+ * During @b PUSH_FRAME(n), there are a@b n words of local storage
+ * allocated for JVM method scratch area, where @b n >= 0, up to
+ * the maximum stack size less the top few words:
+ *
+ * @verbatim
+
+ new SP --> [PC of next JVM instruction] ... high address
+ [old FP] ...
+ [GC pointer for this NEW frame] ...
+ [value 'n', size of LS (local storage) area beneath]
+ new FP --> [local 0] ...
+ [local 1] ...
+ [local 2] ...
+ ... ...
+ [local n-1] ...
+
+ --- end of NEW frame ---
+
+ old SP -> [scratch] (same data shown above) ...
+ ... ...
+ [scratch] ...
+ [top of previous frame] ...
+ old FP -> [locals of previous frame] ... low address
+
+ --- end of OLD frame ---
+
+ @endverbatim
+ *
+ *
+ * POP_FRAME() does the reverse or @b PUSH_FRAME and removes
+ * the top stack frame. The final @b POP_FRAME() will have a
+ * stored (old) frame pointer containing
+ * @link #JVMCFG_NULL_SP JVMCFG_NULL_SP@endlink, so when this
+ * frame is popped, @link #opcode_run() opcode_run()@endlink
+ * will detect that this thread has finished running.
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ * @param locals Number of local variables to be reserved
+ * in the new stack frame.
+ *
+ *
+ * @returns @link #rvoid rvoid@endlink.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define PUSH_FRAME(thridx, locals) \
+ PUSH_LOCAL(thridx, (locals)); \
+ PUSH(thridx, (locals)); \
+ PUSH_GC(thridx, (locals)); \
+ PUSH_FP(thridx); \
+ PUT_FP_IMMEDIATE(thridx, \
+ GET_SP(thridx) - JVMREG_STACK_MIN_FRAME_HEIGHT); \
+ PUSH_PC(thridx); /* Extra ; */
+
+#define POP_FRAME(thridx) \
+ POP_PC(thridx); \
+ POP_FP(thridx); \
+ POP_GC(thridx); \
+ POP_LOCAL(thridx, (1 + GET_SP_WORD(thridx, 0, jint))); /* Extra ; */
+
+/*@} */ /* End of grouped definitions */
+
+/*!
+ * @name Access the stack frame.
+ *
+ * @brief Read and write (jint) values from and to the current
+ * stack frame.
+ *
+ * Accesses are @e always as (jint), casting is performed
+ * outside of these macros.
+ *
+ * @todo This implementation is being changed to point local variable
+ * zero to the _last_ word of the local variable area instead of the
+ * _first_ word. This will create a run-time tradeoff between reversing
+ * the stack frame for method calls and a slightly longer expression
+ * needed to access local variables. The former (current way) makes
+ * for a somewhat more complex method invocation procedure, while the
+ * latter (to be done) provides an easy method invocation with a bit
+ * more work to access locals. The following warning notice will go
+ * away when this is done:
+ *
+ * NOTICE THE INDEX IS ***NEGATIVE*** in this implementation!
+ * This allows FP to use constant values to each and every element of
+ * the frame, including a constant value to point to the @e first of
+ * the local variables. By inverting the frame to have the locals on
+ * top, this same thing could be done and the FP could point either
+ * to its corresponding inverse location or to the first word of the
+ * frame above the old stack contents.
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ * @param frmidx Stack frame index (local variable index) of stack
+ * frame to be referenced.
+ *
+ * @param cast Arbitrary data type that is of size (jint) or
+ * smaller. This includes (jbyte), (jboolean),
+ * (jchar), (jshort), (jshort), and (jobject).
+ *
+ */
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Read a local variable from the stack frame
+ *
+ * @note For (jlong) and (jdouble) local variables, there are
+ * @e two accesses required per JVM spec to retrieve the two
+ * (jint) words of such a data type. Use bytegames_combine_long()
+ * and bytegames_combine_double(), respectively, to combine the
+ * two words into a single variable. The parameters may be
+ * read directly from the stack frame with this macro.
+ *
+ *
+ * @returns (jint) value of a local variable in the stack frame.
+ *
+ */
+#define GET_LOCAL_VAR(thridx, frmidx) \
+ ((jint) (STACK(thridx, GET_FP(thridx) - frmidx)))
+
+/*!
+ * @brief Cast a @link #GET_LOCAL_VAR() GET_LOCAL_VAR()@endlink
+ * as any arbitrary data type.
+ *
+ * @note This macro is not appropriate for (jlong) and (jdouble)
+ * data types since they require two (jint) local variable
+ * stack frame accesses.
+ *
+ * @returns @b (cast) value of (jint) local variable.
+ *
+ */
+#define GET_TYPED_LOCAL_VAR(thridx, frmidx, cast) \
+ ((cast) GET_LOCAL_VAR(thridx, frmidx)))
+
+
+/*!
+ * @brief Real machine address of a local variable in the stack frame
+ *
+ *
+ * @returns Real machine (jint *) address of a (jint) local variable
+ * in the stack frame.
+ *
+ */
+#define JINT_ADDRESS_LOCAL_VAR(thridx, frmidx) \
+ ((jint *) &STACK(thridx, GET_FP(thridx) - frmidx))
+
+
+/*!
+ * @brief Write a local variable from the stack frame
+ *
+ * @note For (jlong) and (jdouble) local variables, there are
+ * @e two accesses required per JVM spec to store the two
+ * (jint) words of such a data type. Use bytegames_split_long()
+ * and bytegames_split_double(), respectively, to split
+ * a single variable into its two words. The parameters may be
+ * written directly into the stack frame with this macro.
+ *
+ *
+ * @returns (jint) value of a local variable in the stack frame.
+ *
+ */
+#define PUT_LOCAL_VAR(thridx, frmidx, value) \
+ *JINT_ADDRESS_LOCAL_VAR(thridx, frmidx) = (jint) (value)
+
+
+/*@} */ /* End of grouped definitions */
+
+/*!
+ * @name Navigate stack frame in depth.
+ *
+ * @brief Use these macros to iteratively point up and down the
+ * stack from from current fram to bottom of the stack.
+ *
+ *
+ * @param thridx Thread index of thread whose stack pointer
+ * is to be referenced.
+ *
+ * @param some_fp Stack pointer index of stack frame to be referenced.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @returns Requested frame pointer
+ *
+ */
+#define NEXT_STACK_FRAME_GENERIC(thridx, some_fp) \
+ STACK(thridx, some_fp + JVMREG_STACK_FP_OFFSET)
+
+/*!
+ * @returns @link #rtrue rtrue@endlink if @p some_fp now points
+ * to the bottom of the stack frame.
+ *
+ */
+#define CHECK_FINAL_STACK_FRAME_GENERIC(thridx, some_fp) \
+ ((JVMCFG_NULL_SP == NEXT_STACK_FRAME_GENERIC(thridx, some_fp)) \
+ ? rtrue \
+ : rfalse)
+
+#define FIRST_STACK_FRAME(thridx) GET_FP(thridx)
+
+#define NEXT_STACK_FRAME(thridx) \
+ NEXT_STACK_FRAME_GENERIC(thridx, GET_FP(thridx))
+
+#define CHECK_FINAL_STACK_FRAME(thridx) \
+ CHECK_FINAL_STACK_FRAME_GENERIC(thridx, GET_FP(thridx))
+
+#define CHECK_FINAL_STACK_FRAME_ULTIMATE(thridx) \
+ (JVMCFG_NULL_SP == GET_FP(thridx))
+
+/*@} */ /* End of grouped definitions */
+
+
+#endif /* _jvmreg_h_included_ */
+
+
+/* EOF */
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmutil.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmutil.c?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmutil.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvmutil.c Fri Oct 7 21:27:56 2005
@@ -0,0 +1,378 @@
+/*!
+ * @file jvmutil.c
+ *
+ * @brief Utilities for operating the JVM on this
+ * real machine implementation.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jvmutil.c $ \$Id: jvmutil.c 0 09/28/2005 dlydick $
+ *
+ * Copyright 2005 The Apache Software Foundation
+ * or its licensors, as applicable.
+ *
+ * Licensed 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.
+ *
+ * @version \$LastChangedRevision: 0 $
+ *
+ * @date \$LastChangedDate: 09/28/2005 $
+ *
+ * @author \$LastChangedBy: dlydick $
+ * Original code contributed by Daniel Lydick on 09/28/2005.
+ *
+ * @section Reference
+ *
+ */
+
+#include "arch.h"
+ARCH_COPYRIGHT_APACHE(jvmutil, c, "$URL: https://svn.apache.org/path/name/jvmutil.c $ $Id: jvmutil.c 0 09/28/2005 dlydick $");
+
+
+#include "jvmcfg.h"
+#include "cfmacros.h"
+#include "classfile.h"
+#include "attribute.h"
+#include "jvm.h"
+#include "linkage.h"
+#include "util.h"
+
+
+/*!
+ * @name Debug message verbosity utilities for sysDbgMsg().
+ *
+ * @brief Set and get an integer value that determines the number of
+ * debug messages that get displayed by sysDbgMsg().
+ *
+ * When sysDbgMsg() is inserted into the code of a function,
+ * a verbosity level is its first parameter. The higher the
+ * number, the more verbose the debug output becomes, up to
+ * level @link #DML10 DMLMAX@endlink. The lower
+ * the number, the less it is displayed at run time, down to
+ * @link #DML1 DMLMIN@endlink. At level @link #DML0 DMLOFF@endlink,
+ * only @e vital diagnostic messages are displayed. The rest are
+ * suppressed.
+ *
+ * This value is heuristically applied by the developer as to the
+ * importance of that information in various development and
+ * testing situations.
+ *
+ * The importance of the situation defaults to
+ * @link #DMLDEFAULT DMLDEFAULT@endlink at compile time and may
+ * be changed at run time with the
+ * @link #JVMCFG_DEBUGMSGLEVEL_FULL_PARM -Xdebug_level@endlink
+ * command line parameter.
+ *
+ * @see jvm_debug_level_enum
+ *
+ * @see sysDbgMsg()
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Set current debug message level
+ *
+ *
+ * @param level New level to set.
+ *
+ * @returns @link #rvoid rvoid@endlink
+ *
+ */
+
+rvoid jvmutil_set_dml(jvm_debug_level_enum level)
+{
+ pjvm->debug_message_level = level;
+
+} /* END of jvmutil_set_dml() */
+
+
+/*!
+ * @brief Get current debug message level
+ *
+ *
+ * @b Parameters: @link #rvoid rvoid@endlink
+ *
+ *
+ * @returns current debug message verbosity
+ *
+ */
+jvm_debug_level_enum jvmutil_get_dml()
+{
+ return(pjvm->debug_message_level);
+
+} /* END of jvmutil_get_dml() */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Stack dump utilities.
+ *
+ * @brief Print contents of a thread's stack to standard error.
+ *
+ * Several forms are available that provide various amounts of stack
+ * frame detail. The most verbose also shows local variables
+ * in the stack frame.
+ *
+ * @attention These routines are @e not intended as a replacement
+ * for the normal routine
+ * <b><code>java.lang.Throwable.printStackTrace()</code></b> !!!
+ *
+ * @param thridx Thread table index of thread to show
+ *
+ * @param pheader Null-terminated header string. If no header is
+ * desired, pass a @link #rnull rnull@endlink
+ * pointer here.
+ *
+ * @param showdetails If @link #rtrue rtrue@endlink, show frame
+ * details, else less verbose.
+ *
+ * @param showlocals If @link #rtrue rtrue@endlink, show local
+ * variables also, but only if @b showdetails is
+ * also @link #rtrue rtrue@endlink.
+ *
+ *
+ * @returns @link #rvoid rvoid@endlink
+ *
+ *
+ * @todo This function needs unit testing.
+ *
+ * @todo Add line numbers to output. Sample output might look like
+ * this (when line numbers are added):
+ *
+ * @verbatim
+ * Exception in thread "main" java.lang.NullPointerException
+ at Testit.sub1(Testit.java:9)
+ at Testit.main(Testit.java:23)
+ @endverbatim
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Common function to perform final output from all
+ * stack print utilities.
+ *
+ */
+static rvoid jvmutil_print_stack_common(jvm_thread_index thridx,
+ rchar *pheader,
+ rboolean showdetails,
+ rboolean showlocals)
+{
+ /* Print header if one is passed in, else skip */
+ if (rnull != pheader)
+ {
+ fprintfLocalStderr("%s\n", pheader);
+ }
+
+ /*
+ * Read down through all frames until bottom of stack.
+ * The very last stack frame holds a null FP.
+ */
+
+ jvm_sp fp = FIRST_STACK_FRAME(thridx);
+
+ while (!CHECK_FINAL_STACK_FRAME_GENERIC(thridx, fp))
+ {
+ jvm_class_index clsidx =
+ STACK(thridx,
+ GET_FP(thridx) + JVMREG_STACK_PC_CLSIDX_OFFSET);
+
+ ClassFile *pcfs = CLASS_OBJECT_LINKAGE(clsidx)->pcfs;
+
+ jvm_method_index mthidx =
+ STACK(thridx,
+ GET_FP(thridx) + JVMREG_STACK_PC_MTHIDX_OFFSET);
+
+ rint star_len_cls = CP1_NAME_STRLEN(CONSTANT_Class_info,
+ pcfs,
+ pcfs->this_class,
+ name_index);
+
+ rint star_len_mth = CP1_NAME_STRLEN(CONSTANT_Class_info,
+ pcfs,
+ mthidx,
+ name_index);
+
+ jvm_attribute_index atridx =
+ attribute_find_in_class_by_enum(clsidx,
+ LOCAL_SOURCEFILE_ATTRIBUTE);
+
+ jvm_constant_pool_index cpidx;
+ rint star_len_src;
+ rchar *srcname;
+
+ if (jvm_attribute_index_bad == atridx)
+ {
+ cpidx = CONSTANT_CP_DEFAULT_INDEX;
+
+ star_len_src = 7; /* Length of "unknown" */
+
+ srcname = "unknown";
+ }
+ else
+ {
+ cpidx = ((SourceFile_attribute *)
+ &pcfs->attributes[atridx]->ai)->sourcefile_index;
+
+ star_len_src = CP_THIS_STRLEN(pcfs, cpidx);
+
+ srcname = PTR_CP_THIS_STRNAME(pcfs, cpidx);
+ }
+
+ /* Least verbosity, called from jvmutil_print_stack() */
+ fprintfLocalStderr(" at %*.*s%c%*.*s(%*.*s:%d)\n",
+
+ star_len_cls, star_len_cls,
+ PTR_CP1_NAME_STRNAME(CONSTANT_Class_info,
+ pcfs,
+ pcfs->this_class,
+ name_index),
+
+ CLASSNAME_EXTERNAL_DELIMITER_CHAR,
+
+ star_len_mth, star_len_mth,
+ PTR_CP1_NAME_STRNAME(CONSTANT_Class_info,
+ pcfs,
+ mthidx,
+ name_index),
+
+ star_len_src, star_len_src,
+ srcname,
+ 0 /*! @todo Get line numbers */);
+
+ /*
+ * Fill in frame details and local variables
+ */
+ if (rtrue == showdetails)
+ {
+ /*! @todo Show details of stack frame */
+
+ if (rtrue == showlocals)
+ {
+ /*! @todo Show local variables in stack frame */
+ }
+ }
+
+ /* Look at next stack frame */
+ fp = NEXT_STACK_FRAME_GENERIC(thridx, fp);
+ }
+
+} /* END of jvmutil_print_stack_common() */
+
+
+/*!
+ * @brief Print basic stack frame summary only.
+ *
+ */
+rvoid jvmutil_print_stack(jvm_thread_index thridx, rchar *pheader)
+{
+ jvmutil_print_stack_common(thridx, pheader, rfalse, rfalse);
+
+} /* END of jvmutil_print_stack() */
+
+
+/*!
+ * @brief Print stack frame with some details.
+ *
+ */
+rvoid jvmutil_print_stack_details(jvm_thread_index thridx,
+ rchar *pheader)
+{
+ jvmutil_print_stack_common(thridx, pheader, rtrue, rfalse);
+
+} /* END of jvmutil_print_stack_details() */
+
+
+/*!
+ * @brief Print stack frame with details and local variables.
+ *
+ */
+rvoid jvmutil_print_stack_locals(jvm_thread_index thridx,
+ rchar *pheader)
+{
+ jvmutil_print_stack_common(thridx, pheader, rtrue, rtrue);
+
+} /* END of jvmutil_print_stack_locals() */
+
+
+/*!
+ * @brief Common print basic stack frame summary showing error type.
+ *
+ */
+static rvoid jvmutil_print_errtype_stack(jvm_thread_index thridx,
+ rchar *errtype)
+{
+ rchar *pheader = HEAP_GET_DATA(JVMCFG_STDIO_BFR, rfalse);
+
+ jvm_class_index clsidx =
+ STACK(thridx, GET_FP(thridx) + JVMREG_STACK_PC_CLSIDX_OFFSET);
+
+ ClassFile *pcfs = CLASS_OBJECT_LINKAGE(clsidx)->pcfs;
+
+ rint star_len = CP1_NAME_STRLEN(CONSTANT_Class_info,
+ pcfs,
+ pcfs->this_class,
+ name_index);
+
+ sprintfLocal(pheader,
+ "%s in thread \"s\" *.*%s",
+ errtype,
+ THREAD(thridx).name,
+ star_len, star_len,
+ PTR_CP1_NAME_STRNAME(CONSTANT_Class_info,
+ pcfs,
+ pcfs->this_class,
+ name_index));
+
+ jvmutil_print_stack(thridx, pheader);
+
+ HEAP_FREE_DATA(pheader);
+
+ return;
+
+} /* END of jvmutil_print_errtype_stack() */
+
+
+/*!
+ * @brief Print basic stack frame summary reporting an error versus
+ * an exception.
+ *
+ */
+rvoid jvmutil_print_error_stack(jvm_thread_index thridx)
+{
+ jvmutil_print_errtype_stack(thridx, "Error");
+
+} /* END of jvmutil_print_error_stack() */
+
+
+/*!
+ * @brief Print basic stack frame summary reporting an exception versus
+ * an error.
+ *
+ */
+rvoid jvmutil_print_exception_stack(jvm_thread_index thridx)
+{
+ jvmutil_print_errtype_stack(thridx, "Exception");
+
+} /* END of jvmutil_print_exception_stack() */
+
+/*@} */ /* End of grouped definitions */
+
+
+/* EOF */