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 [14/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/jlString.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jlString.c?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jlString.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jlString.c Fri Oct 7 21:27:56 2005
@@ -0,0 +1,110 @@
+/*!
+ * @file jlString.c
+ *
+ * @brief Native implementation of @c @b java.lang.String
+ *
+ * @todo Perform intelligent check on input parameter
+ * @b objhash range for all functions.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jlString.c $ \$Id: jlString.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(jlString, c, "$URL: https://svn.apache.org/path/name/jlString.c $ $Id: jlString.c 0 09/28/2005 dlydick $");
+
+
+#include "jvmcfg.h"
+#include "classfile.h"
+#include "jvm.h"
+
+
+/*!
+ * @name Native implementation of class static functions.
+ *
+ * The class index of the current class is always passed
+ * as the first parameter.
+ *
+ * @note These @c @b java.lang.String methods are unusual in that
+ * they does not require a @c @b jobject (in parlance of this
+ * implementation, a @link #jvm_object_hash jvm_object_hash@endlink)
+ * to run because they are declared as @c @b static methods. As
+ * implemented here, the usual @b objhashthis parameter is therefore
+ * replaced by * @b clsidxthis. The thread context is located in
+ * @link #CURRENT_THREAD CURRENT_THREAD@endlink.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Native implementation of object instance functions.
+ *
+ * The object hash of @c @b this object is always passed
+ * as the first parameter.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.String.intern()
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns Object hash for this @c @b java.lang.String (same
+ * as input object hash, in this particular implementation)
+ *
+ */
+
+jvm_object_hash jlString_intern(jvm_object_hash objhashthis)
+{
+ if (jvm_object_hash_null == objhashthis)
+ {
+ return(jvm_object_hash_null);
+ }
+
+ /*! @todo Is this correct? */
+ return(objhashthis);
+
+} /* END of jlString_intern() */
+
+/*@} */ /* End of grouped definitions */
+
+
+/* EOF */
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jlThread.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jlThread.c?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jlThread.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jlThread.c Fri Oct 7 21:27:56 2005
@@ -0,0 +1,1287 @@
+/*!
+ * @file jlThread.c
+ *
+ * @brief Native implementation of @c @b java.lang.Thread
+ *
+ * @todo Perform intelligent check on input parameter
+ * @b objhash range for all functions.
+ *
+ * @todo In real life, the @b objhashthis values and @b clsidxthis
+ * values will be valid or these functions could not be
+ * invoked since these data types are @e mandatory for
+ * referencing them. This probably means that the parameter
+ * valididty checking could probably be relaxed.
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jlThread.c $ \$Id: jlThread.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(jlThread, c, "$URL: https://svn.apache.org/path/name/jlThread.c $ $Id: jlThread.c 0 09/28/2005 dlydick $");
+
+
+#include "jvmcfg.h"
+#include "classfile.h"
+#include "jvm.h"
+#include "jvmclass.h"
+#include "linkage.h"
+
+
+/*!
+ * @name Native implementation of java.lang.Thread.sleep() functions.
+ *
+ * @brief Sleep based on millisecond timer ticks.
+ *
+ * Results are undefined if thread has the @b JOIN4EVER, @b JOINTIMED,
+ * @b WAIT4EVER, @b WAITTIMED, or @b INTERRUPTIBLEIO status or if thread
+ * has been @b NOTIFIED or @b INTERRUPTED.
+ *
+ * This will only succeed if thread is in @b RUNNING state.
+ *
+ * The <b><code>sleep(ms, ns)</code></b> version ignores the
+ * nanoseconds parameter and works just like
+ * <b><code>sleep(ms)</code></b>.
+ *
+ * The class index of the current class is always passed
+ * as the first parameter.
+ *
+ *
+ * @param clsidxthis Class table index of the class of
+ * @c @b this object, namely,
+ * @c @b java.lang.Thread .
+ *
+ * @param sleeptime_milliseconds Number of timer ticks (milliseconds)
+ * to sleep.
+ *
+ * @param sleeptime_nanoseconds Number of nanoseconds to sleep
+ * in addition to the milliseconds.
+ *
+ *
+ * @returns @link #jvoid jvoid@endlink
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION
+ if another thread had interrupted this thread@endlink.
+ *
+ *
+ * @note These @c @b java.lang.Thread methods are unusual in that
+ * they does not require a @c @b jobject (in parlance of this
+ * implementation, a @link #jvm_object_hash jvm_object_hash@endlink)
+ * to run because they are declared as @c @b static methods. As
+ * implemented here, the usual @b objhashthis parameter is therefore
+ * replaced by * @b clsidxthis. The thread context is located in
+ * @link #CURRENT_THREAD CURRENT_THREAD@endlink.
+ *
+ *
+ * @todo Make sure thread interruption logic below here is working.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Native implementation of millisecond
+ * sleep method @c @b java.lang.Thread.sleep(jlong)
+ *
+ */
+
+jvoid jlThread_sleep(jvm_class_index clsidxthis,
+ jlong sleeptime_milliseconds)
+{
+ /* Current thread always assumed valid */
+ jvm_thread_index thridx = CURRENT_THREAD;
+
+ THREAD(thridx).status |= THREAD_STATUS_SLEEP;
+ THREAD(thridx).sleeptime = sleeptime_milliseconds;
+ (rvoid) threadstate_request_runnable(thridx);
+
+ return;
+
+} /* END of jlThread_sleep() */
+
+
+/*!
+ *
+ * @brief Native implementation of millisecond and nanosecond
+ * sleep method <b><code>java.lang.Thread.sleep(jlong, jint)</code></b>
+ *
+ * Ignore the @b sleeptime_nanoseconds parameter in this implementation.
+ *
+ */
+jvoid jlThread_sleep_nanos(jvm_class_index clsidxthis,
+ jlong sleeptime_milliseconds,
+ jint sleeptime_nanoseconds)
+{
+ /* Do nothing with @b sleeptime_nanoseconds */
+
+ jlThread_sleep(clsidxthis, sleeptime_milliseconds);
+
+} /* END of jlThread_sleep_nanos() */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Native implementation of java.lang.Thread.join() functions.
+ *
+ * @brief Join one thread onto another, timed and untimed.
+ *
+ * Results are undefined if thread has the @b JOIN4EVER, @b JOINTIMED,
+ * @b WAIT4EVER, @b WAITTIMED, or @b INTERRUPTIBLEIO status or if thread
+ * has been @b NOTIFIED or @b INTERRUPTED.
+ *
+ * This will only succeed if thread is in @b RUNNING state.
+ *
+ * The <b><code>join(ms, ns)</code></b> version ignores the
+ * nanoseconds parameter and works just like @c @b join(ms).
+ *
+ * The object hash of @c @b this object is always passed
+ * as the first parameter.
+ *
+ *
+ * @param objhashthis Object table hash of
+ * @c @b this object.
+ *
+ * @param sleeptime Number of timer ticks (milliseconds)
+ * to sleep.
+ *
+ * @param sleeptime_nanoseconds Number of nanoseconds to wait on join
+ * in addition to the milliseconds.
+ *
+ * @returns @link #jvoid jvoid@endlink
+ *
+ * @throws JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION
+ if another thread had interrupted this thread@endlink.
+ *
+ *
+ * @todo Make sure thread interruption logic below here is working.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Native implementation of @c @b java.lang.Thread.join()
+ *
+ */
+
+jvoid jlThread_join4ever(jvm_object_hash objhashthis)
+{
+ /* Current thread always assumed valid */
+ jvm_thread_index thridxthis = CURRENT_THREAD;
+
+ jvm_thread_index thridxjoin =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ THREAD(thridxthis).status |= THREAD_STATUS_JOIN4EVER;
+ THREAD(thridxthis).jointarget = thridxjoin;
+ (rvoid) threadstate_request_runnable(thridxthis);
+
+ return;
+
+} /* END of jlThread_join4ever() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.join(jlong)
+ *
+ */
+jvoid jlThread_jointimed(jvm_object_hash objhashthis,
+ jlong sleeptime)
+{
+ /* Current thread always assumed valid */
+ jvm_thread_index thridxthis = CURRENT_THREAD;
+
+ jvm_thread_index thridxjoin =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ THREAD(thridxthis).status |= THREAD_STATUS_JOINTIMED;
+ THREAD(thridxthis).jointarget = thridxjoin;
+ THREAD(thridxthis).sleeptime = sleeptime;
+ (rvoid) threadstate_request_runnable(thridxthis);
+
+ return;
+
+} /* END of jlThread_jointimed() */
+
+
+/*!
+ * @brief Native implementation
+ * of <b><code>java.lang.Thread.join(jlong, jint)</code></b>
+ *
+ * Ignore the @b sleeptime_nanoseconds parameter in this implementation.
+ *
+ */
+jvoid jlThread_jointimed_nanos(jvm_object_hash objhashthis,
+ jlong sleeptime,
+ jint sleeptime_nanoseconds)
+{
+ /* Do nothing with @b sleeptime_nanoseconds */
+
+ jlThread_jointimed(objhashthis, sleeptime);
+
+ return;
+
+} /* END of jlThread_jointimed_nanos() */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Native implementation of class static functions.
+ *
+ * The class index of the current class is always passed
+ * as the first parameter.
+ *
+ * @note These @c @b java.lang.Thread methods are unusual in that
+ * they does not require a @c @b jobject (in parlance of this
+ * implementation, a @link #jvm_object_hash jvm_object_hash@endlink)
+ * to run because they are declared as @c @b static methods. As
+ * implemented here, the usual @b objhashthis parameter is therefore
+ * replaced by * @b clsidxthis. The thread context is located in
+ * @link #CURRENT_THREAD CURRENT_THREAD@endlink.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.currentThread()
+ *
+ *
+ * @param clsidxthis Class table index of the class of
+ * @c @b this object, namely,
+ * @c @b java.lang.Thread .
+ *
+ *
+ * @returns @c @b java.lang.Thread
+ * of @link rjvm#current_thread pjvm->current_thread@endlink,
+ * also known as @link #CURRENT_THREAD CURRENT_THREAD@endlink
+ *
+ */
+
+jvm_object_hash jlThread_currentThread(jvm_class_index clsidxthis)
+{
+ /* Current thread always assumed valid */
+ return(THREAD(CURRENT_THREAD).thread_objhash);
+
+} /* END of jlThread_currentThread() */
+
+
+/*!
+ * @brief Native implementation of @c @b java.lang.Thread.yield()
+ *
+ *
+ * @param clsidxthis Class table index of the class of
+ * @c @b this object, namely,
+ * @c @b java.lang.Thread .
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread could be modified,
+ * else @link #jfalse jfalse@endlink.
+ *
+ */
+jboolean jlThread_yield(jvm_class_index clsidxthis)
+{
+ /* Current thread always assumed valid */
+ jvm_thread_index thridx = CURRENT_THREAD;
+
+ jboolean rc = threadstate_request_runnable(thridx);
+
+ if (jfalse == rc)
+ {
+ threadstate_request_badlogic(thridx);
+ }
+
+ return(rc);
+
+} /* END of jlThread_yield() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.interrupted()
+ *
+ * Status is @b CLEARED by this method after testing it.
+ *
+ * @note <b>This is a static method and has no need of a
+ * @c @b this object hash. Therefore, the first
+ * parameter is @e not an object hash, but the first
+ * application parameter itself.</b>
+ *
+ *
+ * @param clsidxthis Class table index of the class of
+ * @c @b this object, namely,
+ * @c @b java.lang.Thread .
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread has been interrupted,
+ * else @link #jfalse jfalse@endlink.
+ *
+ */
+
+jboolean jlThread_interrupted(jvm_class_index clsidxthis)
+{
+ /* Current thread always assumed valid */
+ jvm_thread_index thridx = CURRENT_THREAD;
+
+ /* Retrieve status */
+ jboolean rc = (THREAD_STATUS_INTERRUPTED &
+ THREAD(thridx).status) ? jtrue : jfalse;
+
+ /* Clear status */
+ THREAD(thridx).status &= ~THREAD_STATUS_INTERRUPTED;
+
+ /* Report result */
+ return(rc);
+
+} /* END of jlThread_interrupted() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.holdsLock()
+ *
+ *
+ * @param clsidxthis Class table index of the class of
+ * @c @b this object, namely,
+ * @c @b java.lang.Thread .
+ *
+ * @param objhashLOCK Object hash of object to query.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if this thread holds the
+ * object's monitor lock, else @link #jfalse jfalse@endlink.
+ *
+ * @throws JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION
+ if the object hash is a null object@endlink.
+ *
+ */
+
+jboolean jlThread_holdsLock(jvm_class_index clsidxthis,
+ jvm_object_hash objhashLOCK)
+{
+ if (jvm_object_hash_null == objhashLOCK)
+ {
+ /*
+ * The @objhashLOCK is a
+ * @link #jvm_object_hash_null jvm_object_hash_null@endlink
+ * object
+ */
+
+ /* Current thread always assumed valid */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION);
+/*NOTREACHED*/
+ }
+
+ /* Current thread always assumed valid */
+ if (rtrue == threadutil_holds_lock(CURRENT_THREAD, objhashLOCK))
+ {
+ return(jtrue);
+ }
+
+ return(jfalse);
+
+} /* END of jlThread_holdsLock() */
+
+
+/*@} */ /* End of grouped definitions */
+
+/*!
+ * @name Native implementation of object instance functions.
+ *
+ * The object hash of @c @b this object is always passed
+ * as the first parameter.
+ *
+ */
+
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.interrupt()
+ *
+ * The
+ * @link #THREAD_STATUS_INTERRUPTED THREAD_STATUS_INTERRUPTED@endlink
+ * bit is unconditionally set here. The logic for clearing the bit
+ * and throwing exceptions is performed when this bit is read by other
+ * functions.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread could be modified, else
+ * throw @b SecurityException.
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ if thread cannot be interrupted@endlink.
+ *
+ */
+
+jboolean jlThread_interrupt(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ THREAD(thridx).status |= THREAD_STATUS_INTERRUPTED;
+ return(jtrue);
+ }
+
+ /* Could not interrupt this thread */
+ /* Current thread always assumed valid */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_SECURITYEXCEPTION);
+/*NOTREACHED*/
+ return(jfalse); /* Satisfy compiler */
+
+} /* END of jlThread_interrupt() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.isInterrupted()
+ *
+ * Status is UNCHANGED by this method after testing it.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread has been interrupted,
+ * else @link #jfalse jfalse@endlink.
+ *
+ */
+
+jboolean jlThread_isInterrupted(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+
+ /* Retrieve status */
+ jboolean rc = (THREAD_STATUS_INTERRUPTED &
+ THREAD(thridx).status) ? jtrue : jfalse;
+
+ /* Report result */
+ return(rc);
+ }
+
+ return(jfalse);
+
+} /* END of jlThread_isInterrupted() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.isAlive()
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread is in use and
+ * not @b NEW and neither @b COMPLETE (transient) nor @b DEAD,
+ * else @link #jfalse jfalse@endlink.
+ *
+ * @todo CAVEAT: Should this thread eventually get reallocated as
+ * @link #rjvm.thread_new_last pjvm->thread_new_last@endlink
+ * wraps around after @link #JVMCFG_MAX_THREADS
+ JVMCFG_MAX_THREADS@endlink more new threads, this function
+ * will return a stale result at the real machine level. This
+ * is unlikely, however, because the allocation of
+ * @c @b java.lang.Thread objects will likely cover
+ * this concern at a higher level in the design.
+ */
+
+jboolean jlThread_isAlive(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ switch (THREAD(thridx).this_state)
+ {
+ case THREAD_STATE_NEW:
+ case THREAD_STATE_COMPLETE:
+ case THREAD_STATE_DEAD:
+ return(jfalse);
+ default:
+ return(jtrue);
+ }
+
+ }
+
+ return(jfalse);
+
+} /* END of jlThread_isAlive() */
+
+
+/*!
+ * @brief Native implementation of @c @b java.lang.Thread.start()
+ *
+ * This will only succeed if thread is in @b NEW state.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread could be started,
+ * else @link #jfalse jfalse@endlink.
+ *
+ * @throws JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION
+ if another thread had interrupted this thread@endlink.
+ *
+ */
+
+jboolean jlThread_start(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ return(threadstate_request_start(thridx));
+ }
+
+ return(jfalse);
+
+} /* END of jlThread_start() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.countStackFrames() .
+ *
+ *
+ * @deprecated <b>CAVEAT EMPTOR:</b> This method has been deprecated
+ * in the JDK library API
+ * documentation.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns number of frames
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION
+ if another thread had interrupted this thread@endlink.
+ *
+ */
+
+jint jlThread_countStackFrames(jvm_object_hash objhashthis)
+{
+ jint rc = 0;
+
+ if ((rfalse == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) ||
+ (rfalse == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ return(rc);
+ }
+
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ if (!(THREAD_STATUS_INTERRUPTED & THREAD(thridx).status))
+ {
+ /* This thread is not suspended at this time */
+ thread_throw_exception(thridx,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION);
+/*NOTREACHED*/
+ }
+
+ jvm_sp fptest = FIRST_STACK_FRAME(thridx);
+
+ /* Examine stack frame until end of stack,where last FP points*/
+ while (!(CHECK_FINAL_STACK_FRAME_GENERIC(thridx, fptest)))
+ {
+ fptest = NEXT_STACK_FRAME_GENERIC(thridx, fptest);
+
+ rc++;
+ }
+
+ return(rc);
+
+} /* END of jlThread_countStackFrames() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.setPriority()
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ * @param priority new priority value
+ *
+ *
+ * @returns If this thread is in use, result is
+ * @link #jtrue jtrue@endlink,
+ * else @link #jfalse jfalse@endlink.
+ *
+ * @throws JVMCLASS_JAVA_LANG_ILLEGALARGUMENTEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_ILLEGALARGUMENTEXCEPTION
+ if the requested thread priorty is out of range@endlink.
+ *
+ * @throws JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ if this thread cannot have its priority modified@endlink.
+ *
+ * @todo Add logic to detect @b SecurityException.
+ *
+ */
+
+jboolean jlThread_setPriority(jvm_object_hash objhashthis,
+ jint priority)
+{
+ if ((THREAD_PRIORITY_MIN > priority) ||
+ (THREAD_PRIORITY_MAX < priority))
+ {
+ /* The priority is out of range */
+
+ /* Current thread always assumed valid */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_ILLEGALARGUMENTEXCEPTION);
+/*NOTREACHED*/
+ }
+
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ THREAD(thridx).priority = priority;
+ return(jtrue);
+ }
+
+ /* Need to detect @b SecurityException */
+#if 1
+ return(jfalse);
+#else
+ /* This thread cannot have its priority modified */
+ /* Current thread always assumed valid */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_SECURITYEXCEPTION);
+/*NOTREACHED*/
+ return(jfalse); /* Satisfy compiler */
+#endif
+
+} /* END of jlThread_setPriority() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.getPriority()
+ *
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns Execution priority of this thread. If not in use, result is
+ * @link #THREAD_PRIORITY_BAD THREAD_PRIORITY_BAD@endlink.
+ *
+ */
+
+jint jlThread_getPriority(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ return(THREAD(thridx).priority);
+ }
+
+ /* Invalid value for invalid thread */
+ return(THREAD_PRIORITY_BAD);
+
+} /* END of jlThread_getPriority() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.destroy()
+ *
+ * Simply kill the thread without @e any cleanup.
+ * <b>THIS IS A VERY BAD THING!</b> (Perhaps this
+ * is why most JDK's do not implement this method
+ * any more!)
+ *
+ * There is typically no implementation done of
+ * @c @b java.lang.Thread.destroy(Runnable) ,
+ * but will initially be done here.
+ *
+ * @todo Should this be implemented? Some JDK's probably don't
+ * implement it any more.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread was moved to
+ * @b COMPLETE state, else @link #jfalse jfalse@endlink.
+ *
+ */
+
+jboolean jlThread_destroy(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ /* GAG! This will @e really break the state machine! */
+ /* THREAD(thridxcurr).status &= ~THREAD_STATUS_INUSE; */
+
+ /* So try to kill it quietly: */
+ threadstate_request_badlogic(thridx);
+ threadstate_activate_badlogic(thridx);
+ threadstate_activate_badlogic(thridx);
+ return(threadstate_request_complete(thridx));
+ }
+
+ return(jfalse);
+
+} /* END of jlThread_destroy() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.checkAccess()
+ *
+ * This method will @e always give permission in this JVM.
+ *
+ * @todo A smart java.lang.SecurityManager will take
+ * care of this matter.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink unconditionally.
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ if current thread is not permitted to modify this thread@endlink.
+ *
+ * @todo Add logic to detect @b SecurityException beyond passing in
+ * an invalid @b objhashthis.
+ *
+ */
+jboolean jlThread_checkAccess(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+/* unused
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+*/
+ return(jtrue);
+ }
+
+ /* Could not modify this thread */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_SECURITYEXCEPTION);
+/*NOTREACHED*/
+ return(jfalse); /* Satisfy compiler */
+
+} /* END of jlThread_checkAccess() */
+
+
+/*!
+ * @brief Native implementation
+ * of <code>java.lang.Thread.setDaemon()<code>
+ *
+ * @todo See notes elsewhere about implementation of the ISDAEMON bit.
+ * This concept must be implemented in the JVM structures so as
+ * to know when to quit (no non-daemon threads running, that is,
+ * no user threads running). Currently, it is a status bit in
+ * the @link rthread#status rthread.status@endlink structure
+ * named
+ * @link #THREAD_STATUS_ISDAEMON THREAD_STATUS_ISDAEMON@endlink
+ * but is typically @e also found as a private class member
+ * of @c @b java.lang.Thread . If this were @e always
+ * true, then the former could be eliminated. Since this code
+ * actually @e implements this class' native methods, either one
+ * could be eliminated @e if none of the other (non-native) class
+ * methods referenced the private variable without going through
+ * @link #jlThread_isDaemon jlThread_isDaemon@endlink. However,
+ * this question is why this action item is present.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ * @param isdaemon @link #rtrue rtrue@endlink or
+ * @link #rfalse rfalse@endlink,
+ * depending on requested condition
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if could make the change,
+ * else throw @b SecurityException.
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION
+ if thread is not in the @b NEW state when attempting
+ to set this condition@endlink.
+ *
+ * @throws JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ if current thread cannot change this thread@endlink.
+ *
+ *
+ * @todo Review jvm_init() code for setting up threads before there
+ * is a @c @b setjmp(3) handler for @c @b setDaemon() exceptions.
+ *
+ * @todo Add logic to detect @b SecurityException beyond passing in
+ * an invalid @b objhashthis.
+ *
+ */
+
+jvoid jlThread_setDaemon(jvm_object_hash objhashthis,
+ jboolean isdaemon)
+{
+ if ((rfalse == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) ||
+ (rfalse == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ /* The requested thread is not valid */
+ /* Current thread always assumed valid */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_SECURITYEXCEPTION);
+/*NOTREACHED*/
+ }
+
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ if (THREAD_STATE_NEW == THREAD(thridx).this_state)
+ {
+ if (jtrue == isdaemon)
+ {
+ THREAD(thridx).status |= THREAD_STATUS_ISDAEMON;
+ }
+ else
+ {
+ THREAD(thridx).status &= ~THREAD_STATUS_ISDAEMON;
+ }
+
+ return;
+ }
+
+ /* This thread is in some state besides @b NEW */
+ thread_throw_exception(thridx,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION);
+/*NOTREACHED*/
+ return; /* Satisfy compiler */
+
+} /* END of jlThread_setDaemon() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.isDaemon()
+ *
+ * @todo See notes elsewhere about implementation of the ISDAEMON bit.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink or @link #jfalse jfalse@endlink,
+ * depending on value of @b ISDAEMON bit.
+ *
+ */
+
+jboolean jlThread_isDaemon(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ return((THREAD_STATUS_ISDAEMON & THREAD(thridx).status)
+ ? jtrue
+ : jfalse);
+ }
+
+ return(jfalse);
+
+} /* END of jlThread_isDaemon() */
+
+
+#if 0
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.setName()
+ *
+ * @todo Needs work to convert java.lang.String into
+ * (rthread).name (written @e long before @b String code).
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ * name Null-terminated string containing new thread name
+ *
+ *
+ * @returns @link #jvoid jvoid@endlink
+ *
+ */
+jvoid jlThread_setName(jvm_object_hash objhashthis,
+ rchar *newname)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+
+ SomeRenditionOf(THREAD(thridx).name) = SomeRenditionOf(newname);
+ }
+
+ return;
+
+} /* END of jlThread_setName() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.getName()
+ *
+ * @todo Needs work to convert java.lang.String into
+ * (rthread).name (written @e long before @b String code).
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns Object hash to @c @b String containing thread name
+ *
+ */
+jvm_object_hash jlThread_getName(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+
+ return(SomeRenditionOf(THREAD(thridx).name));
+ }
+
+ ... now what?
+
+} /* END of jlThread_setName() */
+#endif
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.stop(jvoid)
+ *
+ * There is typically no native implementation of
+ * @c @b java.lang.Thread.stop(Runnable) .
+ *
+ *
+ * @deprecated <b>CAVEAT EMPTOR:</b> This method has been deprecated
+ * in the JDK library API
+ * documentation.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread could be modified,
+ * else throw @b SecurityException
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ if current thread cannot change this thread@endlink.
+ *
+ * @todo Add logic to detect @b SecurityException beyond passing in
+ * an invalid @b objhashthis.
+ *
+ */
+
+jvoid jlThread_stop(jvm_object_hash objhashthis)
+{
+ if ((rfalse == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) ||
+ (rfalse == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ /* This thread cannot change the requested thread */
+ /* Current thread always assumed valid */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_SECURITYEXCEPTION);
+/*NOTREACHED*/
+ }
+
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ jvm_object_hash objhash;
+
+ /* Remove all monitor locks */
+ for (objhash = JVMCFG_FIRST_OBJECT;
+ objhash < JVMCFG_MAX_OBJECTS;
+ objhash++)
+ {
+ /* Check object in use and locked, and do BIDIRECTIONAL test
+ * of this thread knowing about this object lock / vice versa */
+ if ((OBJECT_STATUS_INUSE & OBJECT(objhash).status) &&
+ (OBJECT_STATUS_MLOCK & OBJECT(objhash).status) &&
+ (thridx == OBJECT(objhash).mlock_thridx) &&
+ (objhash == THREAD(thridx).locktarget))
+ {
+ OBJECT(objhash).status &= ~OBJECT_STATUS_MLOCK;
+ OBJECT(objhash).mlock_count = 0;
+ OBJECT(objhash).mlock_thridx = jvm_thread_index_null;
+ }
+ }
+
+ /* GAG! This will @e really break the state machine! */
+ /* THREAD(thridx).status &= ~THREAD_STATUS_INUSE; */
+
+ /* So try to kill it quietly: */
+ threadstate_request_badlogic(thridx);
+ threadstate_activate_badlogic(thridx);
+ (rvoid) threadstate_request_complete(thridx);
+
+ return;
+
+} /* END of jlThread_stop() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.suspend()
+ *
+ * Results are undefined if thread has the @b SLEEP, @b WAIT4EVER,
+ * @b WAITTIMED, or @b INTERRUPTIBLEIO status or if thread has
+ * been @b NOTIFIED or @b INTERRUPTED.
+ *
+ * This will work if thread is in @e any state at all.
+ *
+ * @deprecated <b>CAVEAT EMPTOR:</b> This method has been deprecated
+ * in the JDK library API
+ * documentation.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread could be modified,
+ * else throw @b SecurityException.
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ if could not suspend thread@endlink.
+ *
+ * @todo Add logic to detect @b SecurityException beyond passing in
+ * an invalid @b objhashthis.
+ *
+ */
+
+jvoid jlThread_suspend(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ THREAD(thridx).status |= THREAD_STATUS_SUSPEND;
+
+ /*
+ * Move through BADLOGIC state and into BLOCKINGEVENT,
+ * which will put it in line to be BLOCKED.
+ */
+ threadstate_request_badlogic(thridx);
+ threadstate_activate_badlogic(thridx);
+ (rvoid) threadstate_request_blockingevent(thridx);
+
+ return;
+ }
+
+ /* Could not suspend this thread */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_SECURITYEXCEPTION);
+/*NOTREACHED*/
+ return; /* Satisfy compiler */
+
+} /* END of jlThread_suspend() */
+
+
+/*!
+ * @brief Native implementation
+ * of @c @b java.lang.Thread.resume()
+ *
+ * Results are undefined if thread has the @b SLEEP, @b WAIT4EVER,
+ * @b WAITTIMED, or @b INTERRUPTIBLEIO status or if thread has
+ * been @b NOTIFIED or @b INTERRUPTED.
+ *
+ * This will work if thread is in @e any state at all.
+ *
+ *
+ * @deprecated <b>CAVEAT EMPTOR:</b> This method has been deprecated
+ * in the JDK library API
+ * documentation.
+ *
+ *
+ * @param objhashthis Object table hash of @c @b this object.
+ *
+ *
+ * @returns @link #jtrue jtrue@endlink if thread could be modified,
+ * else throw @b SecurityException.
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_SECURITYEXCEPTION
+ if could not suspend thread@endlink.
+ *
+ * @todo Add logic to detect @b SecurityException beyond passing in
+ * an invalid @b objhashthis.
+ *
+ */
+
+jvoid jlThread_resume(jvm_object_hash objhashthis)
+{
+ if ((rtrue == VERIFY_OBJECT_THREAD_LINKAGE(objhashthis)) &&
+ (rtrue == VERIFY_THREAD_LINKAGE(
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx)))
+ {
+ jvm_thread_index thridx =
+ OBJECT_THREAD_LINKAGE(objhashthis)->thridx;
+
+ if (THREAD_STATUS_SUSPEND & THREAD(thridx).status)
+ {
+ /*
+ * Move back out into @b UNBLOCKED state. Don't care how
+ * far into process the @c @b Thread.suspend() went,
+ * since this implementation, using jlThread_suspend() only
+ * puts in the first request (for @b BLOCKINGEVENT).
+ * Wherever the state machine is in its paces, the thread
+ * will be moved forward to requesting @b UNBLOCKED.
+ */
+ switch (THREAD(thridx).this_state)
+ {
+ case THREAD_STATE_BADLOGIC:
+ (rvoid) threadstate_request_blockingevent(thridx);
+ (rvoid) threadstate_activate_blockingevent(thridx);
+ (rvoid) threadstate_process_blockingevent(thridx);
+ /* ... continue with next 'case' */
+
+ case THREAD_STATE_BLOCKINGEVENT:
+ (rvoid) threadstate_request_blocked(thridx);
+ (rvoid) threadstate_activate_blocked(thridx);
+ (rvoid) threadstate_process_blocked(thridx);
+ /* ... continue with next 'case' */
+
+ case THREAD_STATE_BLOCKED:
+ (rvoid) threadstate_request_unblocked(thridx);
+
+ return;
+
+ /* Anything else is invalid */
+ default:
+ break; /* Continue w/ thread_throw_exception()... */
+ }
+ }
+ }
+
+ /* Could not resume this thread */
+ thread_throw_exception(CURRENT_THREAD,
+ THREAD_STATUS_THREW_EXCEPTION,
+ JVMCLASS_JAVA_LANG_SECURITYEXCEPTION);
+/*NOTREACHED*/
+ return; /* Satisfy compiler */
+
+} /* END of jlThread_resume() */
+
+
+/*@} */ /* End of grouped definitions */
+
+/* EOF */
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jrtypes.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jrtypes.c?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jrtypes.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jrtypes.c Fri Oct 7 21:27:56 2005
@@ -0,0 +1,70 @@
+/*!
+ * @file jrtypes.c
+ *
+ * @brief Java architecture types convenient for C/C++ source code.
+ *
+ * Full escriptions of all of the following variables
+ * may be found in @link jvm/src/jrtypes.h jrtypes.h@endlink
+
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jrtypes.c $ \$Id: jrtypes.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(jrtypes, c, "$URL: https://svn.apache.org/path/name/jrtypes.c $ $Id: jrtypes.c 0 09/28/2005 dlydick $");
+
+
+/*!
+ * @brief Permit use of @c @b TRUE, @c @b FALSE,
+ * @c @b NEITHER_TRUE_NOR_FALSE
+ * with @link jvm/src/jvmcfg.h jvmcfg.h@endlink
+ */
+#define I_AM_JRTYPES_C
+
+#include "jvmcfg.h"
+
+const jvoid *jnull = ((jvoid *) NULL);
+
+const jboolean jfalse = ((jboolean) JNI_FALSE);
+const jboolean jtrue = ((jboolean) JNI_TRUE);
+
+
+
+
+const void *rnull = NULL;
+
+const rboolean rfalse = FALSE;
+const rboolean rtrue = TRUE;
+const rboolean rneither_true_nor_false = NEITHER_TRUE_NOR_FALSE;
+
+
+/* EOF */
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jrtypes.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jrtypes.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jrtypes.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jrtypes.h Fri Oct 7 21:27:56 2005
@@ -0,0 +1,503 @@
+#ifndef _jrtypes_h_included_
+#define _jrtypes_h_included_
+
+/*!
+ * @file jrtypes.h
+ *
+ * @brief Java architecture types, including those defined
+ * by @c @b \<jni.h\>, plus real machine mappings of Java types.
+ *
+ * Convenient typedefs of both categories are also defined here.
+ *
+ * These definitions distinguish between Java types and real machine
+ * types so as to keep the developer organized as to which is which
+ * in processing scenarios. The Java types begin with @p @b j and the
+ * real machine types begin with @p @b r.
+ *
+ * The main exception to this is the JVM class file definitions from
+ * the JVM spec, section 4, as implemented by
+ * @link jvm/src/classfile.h classfile.h@endlink. These
+ * are followed without exception. In fact, a number of common
+ * type definitions are based on them. The
+ * @link #jvm_class_index jvm_XXX_index@endlink types
+ * are typically either direct class file references (such as
+ * @link #jvm_object_hash jvm_object_hash@endlink or
+ * @link #jvm_field_index jvm_field_index@endlink) or are real machine
+ * definitions that directly support JVM processing structures
+ * (such as @link #jvm_class_index jvm_class_index@endlink or
+ * @link #jvm_field_lookup_index jvm_field_lookup_index@endlink).
+ *
+ * The other common usage of a prefix is for variables. It is not
+ * related to this issue at all. In this situation, the letter @b p
+ * will typically be prefixed to pointers to/of any type in either
+ * processing domain.
+ *
+ * The use of raw, native, 'C' language types such as @c @b int should
+ * be restricted to system calls and library references such as
+ * @c @b open(2) or @c @b strcmp(3), respectively-- also the command
+ * line @c @b main() parameters, which get propagated into
+ * @link #argv_helpmsg() argv_XXX()@endlink functions.
+ * Let the compiler perform any typing and sizing, which is unlikely,
+ * but keep @e all other usages to the Java @c @b jTYPEDEF and real
+ * machine @c @b rTYPEDEF representations. This single exception should
+ * be obvious when it occurs, and developers should be aware that this
+ * convention is used ubiquitously throughout the code.
+ *
+ * Although definitions used by the JNI interface are found here,
+ * JNI is kept as a STRICTLY SEPARATE part of the code, and
+ * @c @b \<jni.h\> is ONLY used there, namely in the @b ../include
+ * area.
+ *
+ * @note The @e only place that JNI definitions are used is in the
+ * @c @b JniSomeJavaClassWithNativeMethods.c source file as
+ * found in its @c @b some.java.class.with.native.methods
+ * directory. For example, the Java class
+ * @c @b java.lang.Object has its Java source file stored
+ * in @link jni/src/harmony/generic/0.0/src/java/lang/Object.java
+ jni/src/vendor/product/version/src/java/lang/Object.java@endlink,
+ * with its native support found in the 'C' source file
+ * @link jni/src/harmony/generic/0.0/src/java_lang_Object.c
+ jni/src/vendor/product/version/src/java_lang_Object.c@endlink.
+ * The JNI header used to access this native
+ * @c @b java.lang.Object code is found in the related
+ * @b include directory as
+ * @link jni/src/harmony/generic/0.0/include/java_lang_Object.h
+ jni/src/vendor/product/version/include/java_lang_Object.h@endlink.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jrtypes.h $ \$Id: jrtypes.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(jrtypes, h, "$URL: https://svn.apache.org/path/name/jrtypes.h $ $Id: jrtypes.h 0 09/28/2005 dlydick $");
+
+
+/*!
+ * @name Java architecture primative types.
+ *
+ * @brief Real machine implementation of Java primative types.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JBITS 8 /**< Number of bits per byte in JVM*/
+
+typedef signed char jbyte; /**< Java @c @b (byte) */
+
+typedef unsigned char jboolean; /**< Java @c @b (boolean) */
+
+typedef signed short jshort; /**< Java @c @b (short) */
+
+typedef unsigned short jchar; /**< Java @c @b (char) */
+
+typedef signed int jint; /**< Java @c @b (int) */
+
+#ifdef CONFIG_WORDWIDTH64
+
+typedef signed long jlong; /**< Java @c @b (long) */
+
+#else
+
+typedef signed long long jlong; /**< Java @c @b (long) */
+
+#endif
+
+typedef float jfloat; /**< Java @c @b (float) */
+
+typedef double jdouble; /**< Java @c @b (double) */
+
+typedef void jvoid; /**< Java @c @b (void)
+ * is @e not found in
+ * @c @b \<jni.h\> !!! It is used
+ * here to be consistent with
+ * separation of Java vs real
+ * machine data types. Also defined
+ * for our JNI purposes in @link
+ jvm/include/jlObject.h
+ jlObject.h@endlink
+ */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Java keywords
+ *
+ * @brief Real machine implementation of selected Java keywords.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+extern const jvoid *jnull; /**< Java constant
+ * @c @b null */
+
+extern const jboolean jfalse; /**< Java constant
+ * @c @b false */
+
+extern const jboolean jtrue; /**< Java constant
+ * @c @b true */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Java Native Interface definitions.
+ *
+ * @brief Selected JNI definitions needed by this implementation for
+ * JNI interface purposes, but @e never used in the core code.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define JNI_FALSE 0 /**< Defined by \<jni.h\>
+ * (@e never used in core code) */
+
+#define JNI_TRUE 1 /**< Defined by \<jni.h\>
+ * (@e never used in core code) */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Unsigned equivalents to Java primative types.
+ *
+ * @brief Convenient workarounds for unsigned typesthat are
+ * really @e not in Java.
+ *
+ * These types are really @e faux, but are needed for internal
+ * implementation convenience or for more refined semantic
+ * interpretation of JVM spec fields.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+typedef unsigned char jubyte; /**< Unsigned equivalent of
+ * Java (byte) */
+
+typedef unsigned short jushort; /**< Unsigned equivalent of
+ * Java (short) */
+
+typedef unsigned int juint; /**< Unsigned equivalent of
+ * Java (int) */
+
+#ifdef CONFIG_WORDWIDTH64
+
+typedef unsigned long julong; /**< Unsigned equivalent of
+ * Java (long) */
+
+#else
+
+typedef unsigned long long julong; /**< Unsigned equivalent of
+ * Java (long) */
+
+#endif
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Classfile primative types.
+ *
+ * @brief Streams of unsigned bytes in the Java class file.
+ *
+ * The definitions of @link #u1 u1@endlink and @link #u2 u2@endlink
+ * and @link #u4 u4@endlink are here so a to decouple these ubiquitous
+ * symbols from class file work.
+ *
+ * Notice that, depending on context, these three definitions
+ * may be either signed or unsigned. For this implementation,
+ * there will be no further distinction made other than the
+ * @c @b unsigned declarations of these symbols. In most cases in
+ * the spec, usage is unsigned, namely counts, lengths, indices,
+ * enumerations, JDK program counter values, etc. The only
+ * significant exception is the CONSTANT_Integer_info.bytes
+ * structure, which is still not adjusted for real machine
+ * byte ordering, also CONSTANT_Float_info.bytes and their
+ * (long) and (double) equivalents, having two u4 items.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+typedef jubyte u1; /**< Single byte */
+
+typedef jushort u2; /**< Two bytes, like an
+ <b><code>unsigned short</code></b> */
+
+typedef juint u4; /**< Four bytes, like an
+ <b><code>unsigned int</code></b> */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Real machine types.
+ *
+ * @brief Real machine abstraction of real machine primative types.
+ * With the exception of library(3) and system(2) calls, which use
+ * the types mandated in their man pages, @e all real machine
+ * primative types use these abstractions. This should significantly
+ * ease portability problems.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+typedef signed char rchar; /**< Normal 8-bit 'C' character */
+
+typedef unsigned char rbyte; /**< 8-bit byte for any purpose */
+
+typedef unsigned char rboolean; /**< Boolean for any purpose */
+
+typedef signed short rshort; /**< Signed 16-bit integer */
+
+typedef unsigned short rushort; /**< Unsigned 16-bit integer */
+
+typedef signed int rint; /**< Signed 32-bit integer */
+
+typedef unsigned int ruint; /**< Unsigned 32-bit integer */
+
+
+#ifdef CONFIG_WORDWIDTH64
+
+typedef signed long rlong; /**< Signed 64-bit integer */
+
+typedef unsigned long rulong; /**< Unsigned 64-bit integer */
+
+#else
+
+typedef signed long long rlong; /**< Signed 64-bit integer */
+
+typedef unsigned long long rulong; /**< Unsigned 64-bit integer */
+
+#endif
+
+typedef float rfloat; /**< Real machine
+ * @c @b (float) */
+
+typedef double rdouble; /**< Real machine
+ * @c @b (double) */
+
+typedef void rvoid; /**< Real machine
+ * @c @b (void),
+ * for pointers,
+ * @c @b (void *),
+ * untyped */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Selected manifest constants.
+ *
+ * @brief Common macros used commonly in 'C' code.
+ * Only permit use of @c @b \#define's in constant
+ * definition source file, in static initialization,
+ * and in selected @c @b switch statements.
+ *
+ * Most of these constants are found in some @b /usr/include directories
+ * on some platforms, but not others, and not regularly defined between
+ * platforms. Also, remove misc. inconsistencies in @c @b \#define
+ * usage amongst compilers.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#ifndef ERROR0
+
+#define ERROR0 0 /**< Typically found in \<errno.h\>
+ * or \<sys/errno.h\>
+ */
+
+#endif
+
+/*!
+ * @internal Destroy any pre-existing version (or even conflicting
+ * versions) of several common symbols, then define them explicitly
+ * for this compile environment.
+ */
+#ifdef NULL
+#undef NULL
+#endif
+
+#ifdef TRUE
+#undef TRUE
+#endif
+
+#ifdef FALSE
+#undef FALSE
+#endif
+
+/*!
+ * @name Symbols to avoid.
+ *
+ * In order to keep away from definitions of @c @B TRUE, @c @b FALSE,
+ * and @c @b NULL that may be defined all over the place, these
+ * symbols have been replaced in the real machine domain with
+ * @link #rtrue rtrue@endlink, @link #rfalse rfalse@endlink, and
+ * @link #rnull rnull@endlink. They have been replaced in the
+ * Java virtual machine domain by
+ * @link #jtrue jtrue@endlink, @link #jfalse jfalse@endlink, and
+ * @link #jnull jnull@endlink.
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+#define TRUE DO_NOT_USE_TRUE /**< Please use either @link #rtrue
+ rtrue@endlink for real machine
+ @c @b TRUE cases or @link #jtrue
+ jtrue@endlink for Java virtual
+ machine @c @b TRUE cases */
+
+#define FALSE DO_NOT_USE_FALSE /**< Please use either @link #rfalse
+ rfalse@endlink for real machine
+ @c @b FALSE cases or @link #jfalse
+ jfalse@endlink for Java virtual
+ machine @c @b FALSE cases */
+
+#define NULL DO_NOT_USE_NULL /**< Please use @link #rnull
+ rnull@endlink for real machine
+ @c @b NULL cases or @link #jnull
+ jnull@endlink for Java virtual
+ machine @c @b NULL cases */
+
+/*@} */ /* End of grouped definitions */
+
+#ifdef I_AM_JRTYPES_C
+#undef NULL
+#define NULL ((rvoid *) 0) /**< Null pointer value */
+
+#undef TRUE
+#define TRUE ((rboolean) 1) /**< Boolean "true" value */
+
+#undef FALSE
+#define FALSE ((rboolean) 0) /**< Boolean "false" value */
+
+#define NEITHER_TRUE_NOR_FALSE ((rboolean) 2) /**< Value for
+ * initializing a boolean to
+ * "not initialized, that is,
+ * neither TRUE nor FALSE".
+ */
+
+#endif
+
+#define CHEAT_AND_USE_FALSE_TO_INITIALIZE ((rboolean) 0) /**<
+ * Permit boolean "false" manifest
+ * constant for initializing static
+ * and global storage.
+ */
+
+#define CHEAT_AND_USE_TRUE_TO_INITIALIZE ((rboolean) 1) /**<
+ * Permit boolean "true" manifest
+ * constant for initializing static
+ * and global storage.
+ */
+
+#define CHEAT_AND_USE_NULL_TO_INITIALIZE ((rvoid *) 0) /**<
+ * Permit null pointer manifest
+ * constant for initializing static
+ * and global storage.
+ */
+
+#define CHEAT_AND_ALLOW_NULL_CLASS_INDEX ((jvm_class_index) 0) /**<
+ * Permit null class index manifest
+ * constant for initializing static
+ * and global storage.
+ */
+
+#define CHEAT_AND_ALLOW_NULL_OBJECT_HASH ((jvm_object_hash) 0) /**<
+ * Permit null object hash manifest
+ * constant for initializing static
+ * and global storage.
+ */
+
+#define CHEAT_AND_ALLOW_NULL_THREAD_INDEX ((jvm_thread_index) 0) /**<
+ * Permit null thread index manifest
+ * constant for initializing static
+ * and global storage.
+ */
+
+/*@} */ /* End of grouped definitions */
+
+
+/*!
+ * @name Real machine constants.
+ *
+ * @brief Real machine implementation of common industry keywords.
+ *
+ * Instead of permitting unrestrained and potentially misuse and
+ * abuse of the common macros @c @b NULL, @c @b TRUE,
+ * and @c @b FALSE, including conflicting definitions in
+ * various header files, these symbols have been declared explicitly
+ * for this program and stored into global constants. This should
+ * also help in development for more accurate typing of expressions,
+ * paramters, and return values. A boolean "not initialized" value
+ * is also defined.
+ *
+ * Use @link #rnull rnull@endlink in all cases except
+ * static initalization. Use @link #rtrue rtrue@endlink and
+ * $@link #rfalse rfalse@endlink in all cases except static
+ * initialization and @c @b while(TRUE) constructions just
+ * before end of function definitions (some compilers complain about
+ * missing return statements, see several examples).
+ * In this manner, it will @e always be very clear as to whether a
+ * @c @b NULL pointer is a Java null pointer or a real
+ * machine null pointer, likewise a Java boolean or a real machine
+ * boolean.
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+extern const void *rnull; /**< Real machine constant
+ * @c @b NULL
+ */
+
+extern const rboolean rfalse; /**< Real machine constant
+ * @c @b FALSE
+ */
+
+extern const rboolean rtrue; /**< Real machine constant
+ * @c @b TRUE
+ */
+
+extern const rboolean rneither_true_nor_false; /**<
+ * Real machine constant @b neither.
+ * Typically used during
+ * initialization to indicate a
+ * boolean is not ready.
+ */
+
+/*@} */ /* End of grouped definitions */
+
+#endif /* _jrtypes_h_included_ */
+
+
+/* EOF */
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvalue.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvalue.h?rev=307257&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvalue.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/jvalue.h Fri Oct 7 21:27:56 2005
@@ -0,0 +1,168 @@
+#ifndef _jvalue_h_included_
+#define _jvalue_h_included_
+
+/*!
+ * @file jvalue.h
+ *
+ * @brief Java aggregate type references for object definitions.
+ *
+ * See also <em>The Java Virtual Machine Specification,
+ * version 2, Section 4</em>, table 4.2.
+ *
+ *
+ * @section Control
+ *
+ * \$URL: https://svn.apache.org/path/name/jvalue.h $ \$Id: jvalue.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(jvalue, h, "$URL: https://svn.apache.org/path/name/jvalue.h $ $Id: jvalue.h 0 09/28/2005 dlydick $");
+
+/*!
+ * @brief Java aggregate type references for object definitions.
+ *
+ * This union contains literally a grand union of all Java data types,
+ * including both primatives and references types for the purpose of
+ * allowing all object instance fields to be stored in @link
+ robject#object_instance_field_data object_instance_field_data@endlink
+ * as an array in an @link robject object table entry@endlink
+ * without special treatment. Static fields may be stored in this the
+ * same way in
+ * @link rclass#class_static_field_data class_static_field_data@endlink
+ * of a
+ * @link rclass class table entry@endlink. (All sub-integer primative
+ * data types are store inside of @link #jint (jint)@endlink and cast
+ * in/out at runtime.)
+ *
+ * The following types are are casts of _jint, thus:
+ * @verbatim
+ jvalue v; ... a composite value
+
+ jint i; ... integer primative
+
+ jbyte b; ... sub-integer primatives
+ jboolean z;
+ jshort s;
+ jchar c;
+
+ jfloat f; ... float is same size as jint
+ jobjhash o; ... object reference same size
+
+ jlong l; ... TWO jint words
+ jdouble d; ... TWO jint words
+
+ (See also spec table 4.6)
+
+ i = v._jint;
+
+ b = v._jbyte;
+ z = v._jboolean;
+ s = v._jshort;
+ c = v._jchar;
+
+ f = v._jfloat;
+ o = v._jobjhash;
+
+ l = v._jlong;
+ d = v._jlong;
+
+ and vice versa:
+
+ v._jint = i;
+
+ v._jbyte = b;
+ v._jbyte = b;
+ v._jboolean = z;
+ v._jshort = s;
+ v._jchar = c;
+
+ v._jfloat = f;
+ v._jobjhash = o;
+
+ v._jlong = l;
+ v._jdouble = d;
+ @endverbatim
+ *
+ * Although most of the items in this union are Java primatives, there
+ * are also contained herein are two members that are @e not primatives,
+ * namely the object reference hash and the array reference hash.
+ * By implementing them here, both primative and reference,
+ * @e all possible Java data types are represented in @e one data
+ * structure, which is @e very handy for concise object representations
+ * without @e any redundant data structures in different places.
+ *
+ * Notice that for @link #CONFIG_WORDWIDTH32 CONFIG_WORDWIDTH32@endlink
+ * implementations, the @link #jlong (jlong)@endlink will be the
+ * longest data type, as an 8-byte integer. Notice @e also that for
+ * @link #CONFIG_WORDWIDTH64 CONFIG_WORDWIDTH64@endlink implementations,
+ * this will not change because there are no types such as pointers
+ * that will change sizes here. Since this typedef will be used
+ * @e extensively in the runtime environment, this inherent constraint
+ * can help plan maximum heap sizing.
+ *
+ */
+typedef union
+{
+ jbyte _jbyte; /**< Sub-integer primative @link
+ #jbyte jbyte@endlink */
+ jboolean _jboolean; /**< Sub-integer primative @link
+ #jboolean jboolean@endlink */
+ jshort _jshort; /**< Sub-integer primative @link
+ #jshort jshort@endlink */
+ jchar _jchar; /**< Sub-integer primative @link
+ #jchar jchar@endlink */
+
+ jint _jint; /**< Primative @link #jint jint@endlink,
+ per tables 4.2/4.6 */
+ jlong _jlong; /**< Primative @link #jint jlong@endlink,
+ per tables 4.2/4.6 */
+ jfloat _jfloat; /**< Primative @link #jint jfloat@endlink,
+ per tables 4.2/4.6 */
+ jdouble _jdouble;/**<
+ Primative @link #jint jdouble@endlink,
+ per tables 4.2/4.6*/
+
+ jvm_object_hash _jstring;/**< Object hash for the quasi-primative
+ @c @b java.lang.String .
+ Except for this one item, table 4.6 is
+ a subsest of table 4.2. */
+
+ /*
+ * Implementation of object references and array references.
+ */
+ jvm_object_hash _jarray; /**< Object hash of next lower array dim*/
+ jvm_object_hash _jobjhash;/**< Object hash of an arbitrary object*/
+
+} jvalue;
+
+#endif /* _jvalue_h_included_ */
+
+
+/* EOF */