From harmony-commits-return-137-apmail-incubator-harmony-commits-archive=incubator.apache.org@incubator.apache.org Wed Oct 19 08:36:12 2005 Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 19684 invoked from network); 19 Oct 2005 08:36:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Oct 2005 08:36:12 -0000 Received: (qmail 93131 invoked by uid 500); 19 Oct 2005 08:36:11 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 93102 invoked by uid 500); 19 Oct 2005 08:36:11 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 93090 invoked by uid 99); 19 Oct 2005 08:36:11 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 19 Oct 2005 01:36:11 -0700 Received: (qmail 19500 invoked by uid 65534); 19 Oct 2005 08:35:51 -0000 Message-ID: <20051019083551.19499.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r326471 - /incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/thread.h Date: Wed, 19 Oct 2005 08:35:50 -0000 To: harmony-commits@incubator.apache.org From: dlydick@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: dlydick Date: Wed Oct 19 01:35:41 2005 New Revision: 326471 URL: http://svn.apache.org/viewcvs?rev=326471&view=rev Log: Added thread_delete() function and reference it instead of explicit marking of status block as ~THREAD_STATUS_INUSE. Updated ARCH_xxx() macros for better diagnostic support. Minor documentation adjustments. Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/thread.h Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/thread.h URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/thread.h?rev=326471&r1=326470&r2=326471&view=diff ============================================================================== --- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/thread.h (original) +++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/thread.h Wed Oct 19 01:35:41 2005 @@ -12,7 +12,9 @@ * * @section Control * - * \$URL$ \$Id$ + * \$URL$ + * + * \$Id$ * * Copyright 2005 The Apache Software Foundation * or its licensors, as applicable. @@ -36,16 +38,17 @@ * @date \$LastChangedDate$ * * @author \$LastChangedBy$ + * * Original code contributed by Daniel Lydick on 09/28/2005. * * @section Reference * */ -ARCH_COPYRIGHT_APACHE(thread, h, "$URL$ $Id$"); - +ARCH_HEADER_COPYRIGHT_APACHE(thread, h, +"$URL$", +"$Id$"); -#include /* For jmp_buf structure for setjmp(3)/longjmp(3)*/ #include "jvmreg.h" @@ -54,8 +57,8 @@ * * * @param thridx Thread table index into the global - * @link #rjvm.thread rjvm.thread[]@endlink array (via - * @link #pjvm pjvm->thread[]@endlink). + * @link #rjvm.thread rjvm.thread[]@endlink array (via + * @link #pjvm pjvm->thread[]@endlink). * */ @@ -271,7 +274,8 @@ jvm_thread_index id; /**< Self-same ID of this thread */ rchar *name; /**< Name of thread - * @todo not impl. + * @todo HARMONY-6-jvm-thread.h-1 not + * otherwise implemented. */ #define THREAD_NAME_MAX_LEN 64 /**< Arbitrary max thread name length*/ @@ -379,9 +383,12 @@ * if nothing was thrown. */ - jmp_buf *pnonlocal_ThrowableEvent; /**< Non-local return from + rvoid *pportable_nonlocal_ThrowableEvent; /**< Non-local return from * Exception, Error, and Throwable - * conditions. + * conditions. Cast as untyped to + * avoid having every source file + * needing to know about + * @c @b portable_jmp_buf structures. * * @note Play pointer games to persuade * runtime package to accept a jmp_buf @@ -426,11 +433,12 @@ jvm_object_hash locktarget; /**< Doing @c @b Object.wait() * on this object. * - * @todo This implementation can only - * handle ONE SINGLE monitor lock. - * Does it need to be able to - * handle arbitrary number of them at - * once? + * @todo HARMONY-6-jvm-thread.h-2 This + * implementation can only + * handle ONE SINGLE monitor + * lock. Does it need to be + * able to handle arbitrary + * number of them at once? */ @@ -502,10 +510,57 @@ /*@} */ /* End of grouped definitions */ +/*! + * @brief Set up JVM thread-relative exception handler part 2-- + * implements @c @b setjmp(3)/longjmp(3). + * + * This macro @e must be used in conjunction with the function + * @link #thread_exception_setup() thread_exception_setup()@endlink + * for proper operation. + * + * + * @param thridx Thread table index of thread for which to set up + * this exception handler. + * + * + * @returns From normal setup, integer @link + #THREAD_STATUS_EMPTY THREAD_STATUS_EMPTY@endlink. + * Otherwise, return error code passed in to + * @link #thread_throw_exception() + thread_throw_exception()@endlink as shown below. + * + * + * @internal To get this working for complete portability, the + * @link rthread#pportable_nonlocal_ThrowableEvent + pportable_nonlocal_ThrowableEvent@endlink was changed + * to a pointer and a buffer allocated from heap. This + * was due to the @c @b typedef syntax of + * @c @b jmp_buf is typically an internal CPU register array, + * which pointers like. However, instead of playing games + * with addressing &element[0], a pointer works better + * because not all @c @b jmp_buf implementations will be an + * array of this type. The second change was to then convert + * this to an (@link #rvoid rvoid@endlink *) is so that + * @link #portable_jmp_buf portable_jmp_buf@endlink is + * isolated to the portability library. + * + * + * @attention See comments in @link jvm/src/portable_jmp_buf.c + portable_jmp_buf.c@endlink as to why this @e cannot + * be a function call. + * + */ +#define THREAD_EXCEPTION_SETUP(thridx) \ + PORTABLE_SETJMP((portable_jmp_buf *) \ + THREAD(thridx).pportable_nonlocal_ThrowableEvent) + + /* Prototypes for functions in 'thread.c' */ extern const rchar *thread_state_get_name(rushort state); +extern rvoid thread_exception_setup(jvm_thread_index thridx); + extern jvm_thread_index thread_class_load(rchar *clsname, rchar *mthname, rchar *mthdesc, @@ -516,12 +571,12 @@ extern rvoid thread_init(rvoid); +extern jvm_thread_index thread_delete(jvm_thread_index thridx); + extern rboolean thread_die(jvm_thread_index thridx); extern rvoid thread_shutdown(rvoid); -extern int thread_exception_setup(jvm_thread_index thridx); - extern rvoid thread_throw_exception(jvm_thread_index thridx, rushort thread_status_bits, rchar *exception_name);