Author: creiss
Date: Wed Aug 16 08:53:17 2006
New Revision: 14131

Modified:
   trunk/docs/pdds/clip/pdd10_embedding.pod
   trunk/docs/pdds/pdd23_exceptions.pod

Changes in other areas also in this revision:
Added:
   trunk/config/auto/cpu/
      - copied from r14128, /branches/stm/config/auto/cpu/
   trunk/config/auto/cpu.pm
      - copied unchanged from r14128, /branches/stm/config/auto/cpu.pm
   trunk/config/auto/cpu/i386/
      - copied from r14128, /branches/stm/config/auto/cpu/i386/
   trunk/config/auto/cpu/i386/auto.pm
      - copied unchanged from r14128, /branches/stm/config/auto/cpu/i386/auto.pm
   trunk/config/auto/cpu/i386/test_gcc_cmpxchg.in
      - copied unchanged from r14128, 
/branches/stm/config/auto/cpu/i386/test_gcc_cmpxchg.in
   trunk/config/auto/cpu/ppc/
      - copied from r14128, /branches/stm/config/auto/cpu/ppc/
   trunk/config/auto/cpu/ppc/auto.pm
      - copied unchanged from r14128, /branches/stm/config/auto/cpu/ppc/auto.pm
   trunk/config/auto/cpu/ppc/test_gcc_cmpset.in
      - copied unchanged from r14128, 
/branches/stm/config/auto/cpu/ppc/test_gcc_cmpset.in
   trunk/config/auto/cpu/sun4/
      - copied from r14128, /branches/stm/config/auto/cpu/sun4/
   trunk/config/auto/cpu/sun4/auto.pm
      - copied unchanged from r14128, /branches/stm/config/auto/cpu/sun4/auto.pm
   trunk/config/auto/cpu/sun4/test_atomic.in
      - copied unchanged from r14128, 
/branches/stm/config/auto/cpu/sun4/test_atomic.in
   trunk/docs/stm/
      - copied from r14128, /branches/stm/docs/stm/
   trunk/docs/stm/atomic.pod
      - copied unchanged from r14128, /branches/stm/docs/stm/atomic.pod
   trunk/docs/stm/stm_frontend.pod
      - copied unchanged from r14128, /branches/stm/docs/stm/stm_frontend.pod
   trunk/docs/stm/thread-issues.pod
      - copied unchanged from r14128, /branches/stm/docs/stm/thread-issues.pod
   trunk/include/parrot/atomic/
      - copied from r14128, /branches/stm/include/parrot/atomic/
   trunk/include/parrot/atomic.h
      - copied unchanged from r14128, /branches/stm/include/parrot/atomic.h
   trunk/include/parrot/atomic/fallback.h
      - copied unchanged from r14128, 
/branches/stm/include/parrot/atomic/fallback.h
   trunk/include/parrot/atomic/gcc_pcc.h
      - copied unchanged from r14128, 
/branches/stm/include/parrot/atomic/gcc_pcc.h
   trunk/include/parrot/atomic/gcc_x86.h
      - copied unchanged from r14128, 
/branches/stm/include/parrot/atomic/gcc_x86.h
   trunk/include/parrot/atomic/sparc.h
      - copied unchanged from r14128, 
/branches/stm/include/parrot/atomic/sparc.h
   trunk/include/parrot/stm/
      - copied from r14128, /branches/stm/include/parrot/stm/
   trunk/include/parrot/stm/backend.h
      - copied unchanged from r14128, /branches/stm/include/parrot/stm/backend.h
   trunk/runtime/parrot/library/STM.pir
      - copied unchanged from r14128, 
/branches/stm/runtime/parrot/library/STM.pir
   trunk/src/atomic/
      - copied from r14128, /branches/stm/src/atomic/
   trunk/src/atomic/sparc_v9.s
      - copied unchanged from r14128, /branches/stm/src/atomic/sparc_v9.s
   trunk/src/dynpmc/rotest.pmc
      - copied unchanged from r14128, /branches/stm/src/dynpmc/rotest.pmc
   trunk/src/ops/stm.ops
      - copied unchanged from r14128, /branches/stm/src/ops/stm.ops
   trunk/src/pmc/parrotrunningthread.pmc
      - copied unchanged from r14128, 
/branches/stm/src/pmc/parrotrunningthread.pmc
   trunk/src/pmc/stmlog.pmc
      - copied unchanged from r14128, /branches/stm/src/pmc/stmlog.pmc
   trunk/src/pmc/stmref.pmc
      - copied unchanged from r14128, /branches/stm/src/pmc/stmref.pmc
   trunk/src/pmc/stmvar.pmc
      - copied unchanged from r14128, /branches/stm/src/pmc/stmvar.pmc
   trunk/src/stm/
      - copied from r14128, /branches/stm/src/stm/
   trunk/src/stm/backend.c
      - copied unchanged from r14128, /branches/stm/src/stm/backend.c
   trunk/src/stm/stm_internal.h
      - copied unchanged from r14128, /branches/stm/src/stm/stm_internal.h
   trunk/src/stm/stm_waitlist.h
      - copied unchanged from r14128, /branches/stm/src/stm/stm_waitlist.h
   trunk/src/stm/waitlist.c
      - copied unchanged from r14128, /branches/stm/src/stm/waitlist.c
   trunk/t/pmc/ro.t
      - copied unchanged from r14128, /branches/stm/t/pmc/ro.t
   trunk/t/src/atomic.t
      - copied unchanged from r14128, /branches/stm/t/src/atomic.t
   trunk/t/stm/
      - copied from r14128, /branches/stm/t/stm/
   trunk/t/stm/basic.t
      - copied unchanged from r14128, /branches/stm/t/stm/basic.t
   trunk/t/stm/basic_mt.t
      - copied unchanged from r14128, /branches/stm/t/stm/basic_mt.t
   trunk/t/stm/llqueue.t
      - copied unchanged from r14128, /branches/stm/t/stm/llqueue.t
   trunk/t/stm/queue.t
      - copied, changed from r14128, /branches/stm/t/stm/queue.t
   trunk/t/stm/runtime.t
      - copied unchanged from r14128, /branches/stm/t/stm/runtime.t
Modified:
   trunk/Configure.pl
   trunk/MANIFEST
   trunk/MANIFEST.SKIP
   trunk/config/gen/makefiles/dynpmc.in
   trunk/config/gen/makefiles/root.in
   trunk/config/init/miniparrot.pm
   trunk/examples/pir/thr-primes.pir
   trunk/include/parrot/dod.h
   trunk/include/parrot/dynext.h
   trunk/include/parrot/events.h
   trunk/include/parrot/hash.h
   trunk/include/parrot/headers.h
   trunk/include/parrot/hll.h
   trunk/include/parrot/interpreter.h
   trunk/include/parrot/objects.h
   trunk/include/parrot/packfile.h
   trunk/include/parrot/parrot.h
   trunk/include/parrot/pobj.h
   trunk/include/parrot/resources.h
   trunk/include/parrot/smallobject.h
   trunk/include/parrot/thread.h
   trunk/lib/Parrot/Pmc2c.pm
   trunk/lib/Parrot/Test.pm
   trunk/lib/Parrot/Vtable.pm
   trunk/src/call_list.txt
   trunk/src/dod.c
   trunk/src/dynext.c
   trunk/src/events.c
   trunk/src/global.c
   trunk/src/hash.c
   trunk/src/headers.c
   trunk/src/hll.c
   trunk/src/inter_call.c
   trunk/src/inter_create.c
   trunk/src/inter_misc.c
   trunk/src/interpreter.c
   trunk/src/mmd.c
   trunk/src/objects.c
   trunk/src/ops/ops.num
   trunk/src/packfile.c
   trunk/src/pmc.c
   trunk/src/pmc/array.pmc
   trunk/src/pmc/default.pmc
   trunk/src/pmc/deleg_pmc.pmc
   trunk/src/pmc/delegate.pmc
   trunk/src/pmc/enumerate.pmc
   trunk/src/pmc/iterator.pmc
   trunk/src/pmc/lexinfo.pmc
   trunk/src/pmc/lexpad.pmc
   trunk/src/pmc/namespace.pmc
   trunk/src/pmc/parrotclass.pmc
   trunk/src/pmc/parrotinterpreter.pmc
   trunk/src/pmc/parrotobject.pmc
   trunk/src/pmc/parrotthread.pmc
   trunk/src/pmc/ref.pmc
   trunk/src/pmc/scalar.pmc
   trunk/src/pmc/sharedref.pmc
   trunk/src/pmc/string.pmc
   trunk/src/pmc/undef.pmc
   trunk/src/pmc/unmanagedstruct.pmc
   trunk/src/pmc_freeze.c
   trunk/src/resources.c
   trunk/src/smallobject.c
   trunk/src/string.c
   trunk/src/thread.c
   trunk/src/vtables.c
   trunk/t/harness
   trunk/t/pmc/pmc.t
   trunk/t/pmc/ref.t
   trunk/t/pmc/threads.t
   trunk/tools/build/nativecall.pl
   trunk/tools/build/pmc2c.pl
   trunk/tools/dev/ops_renum.mak
   trunk/vtable.tbl

Log:
Merge STM intro trunk.


Modified: trunk/docs/pdds/clip/pdd10_embedding.pod
==============================================================================
--- trunk/docs/pdds/clip/pdd10_embedding.pod    (original)
+++ trunk/docs/pdds/clip/pdd10_embedding.pod    Wed Aug 16 08:53:17 2006
@@ -1,5 +1,5 @@
 # Copyright (c) 2001-2006, The Perl Foundation.
-# $Id: $
+# $Id$
 
 =head1 NAME
 
@@ -14,7 +14,7 @@
 
 =head1 VERSION
 
-$Revision: $
+$Revision$
 
 =head1 DESCRIPTION
 

Modified: trunk/docs/pdds/pdd23_exceptions.pod
==============================================================================
--- trunk/docs/pdds/pdd23_exceptions.pod        (original)
+++ trunk/docs/pdds/pdd23_exceptions.pod        Wed Aug 16 08:53:17 2006
@@ -60,9 +60,9 @@
 
 =item B<pop_eh>
 
-Pop the most recently pushed exception handler off the exception handler stack.
+Pop the most recently pushed exception handler off the control stack.
 
-{{ TODO: Provide exception handler stack introspection. }}
+{{ TODO: Provide control stack introspection. }}
 
 =item B<throw I<EXCEPTION>>
 
@@ -96,9 +96,13 @@
 Exception handlers can resume execution immediately after the C<throwcc>
 opcode by executing the C<handled> opcode, and then invoking the given
 continuation which they receive as a parameter.  That continuation must be
-invoked with no parameters; in other words, C<throwcc> never returns a
+invoked with no parameters; in other words, C<throwcc> may I<not> return a
 value.
 
+{{ TODO: Resuming immediately after the C<throw> opcode isn't quite
+flexible enough. Perl 6, for example, resumes control flow after the end
+of the block in which the exception was thrown. }}
+
 =item B<die [ I<MESSAGE> ]>
 
 The C<die> opcode throws an exception of type C<exception;death> with a
@@ -106,8 +110,8 @@
 payload is a C<String> PMC containing I<MESSAGE>; if I<MESSAGE> is a PMC, it
 is used directly as the exception payload.
 
-The default when no I<MESSAGE> is given is "Fatal exception at LINE in
-FILE." followed by a backtrace.
+{{ TODO: What is the default when no I<MESSAGE> is given? Something like
+"Fatal exception at LINE in FILE." followed by a backtrace. }}
 
 If this exception is not handled, it results in Parrot returning an error
 indication and the stringification of I<MESSAGE> to its embedding environment.
@@ -139,51 +143,47 @@
 =over
 
 =item 1
-Find the topmost exception handler.
+Find the topmost exception handler
 
 =item 2
-Push an exception record somewhere, presumably on the exception handler
-stack.  The exception record contains a pointer to an exception handler
-block, an exception PMC, and (optionally) a continuation.
+Push an exception record somewhere, presumably on the control stack.
+The exception record contains a pointer to an exception handler block
+and an exception PMC (and possibly a continuation)
 
 =item 3
 Invoke the handler (note: this is still in the thrower's dynamic
-context).
+context)
 
 =back
 
-If the handler returns without calling C<handled>:
+If the handler returns normally:
 
 =over
 
 =item 1
-Find the "exception handling in progress" record.
+Find the "exception handling in progress" record
 
 =item 2
-Find the next exception handler.
+Find the next exception handler
 
 =item 3
-If the handler is found, invoke it.
-
+If the handler is found, invoke it
 
 =item 4
-If no handler is found, and the exception is non-fatal (such as a
-warning), and there is a continuation in the exception record (because
-the throwing opcode was C<throwcc>), invoke the continuation (resume
-execution). Whether to resume or die when an exception isn't handled is
-determined by the severity of the exception.
+Or if there is a continuation in the exception record
+(because the throwing opcode was C<throwcc>),
+invoke the ER's continuation (i.e. resume execution)
 
 =item 5
-Otherwise terminate program a la C<die>. 
+Otherwise terminate program a la C<die>
 
 =back
 
-When running an embedded Parrot interpreter, the interpreter does not
-immediately terminate on an unhandled exception, it merely returns
-control to the embedding program and stores the unhandled exception so
-that it may be queried by the embedding program. The embedding program
-may choose to handle the exception and continue execution by invoking
-the exception's continuation.
+{{ TODO: this isn't right, another option is a) invoke the handler, b)
+the handler calls handled, and c) invoke the continuation to resume
+because the exception was handled. The question of whether to resume or
+die when an exception is never handled is determined by the severity of
+the exception, not by the simple fact of having a continuation. }}
 
 
 When the C<handled> opcode is called:
@@ -191,11 +191,7 @@
 =over
 
 =item 1
-Pop and destroy the exception record.
-
-=item 2
-If there was a continuation in the exception record, invoke the
-continuation.
+Pop and destroy exception record
 
 =back
 
@@ -255,6 +251,10 @@
 C<set_inner_exception()> method to store that previous exception
 as part of the exception object.
 
+{{ TODO: Should we use properties instead? ANR: I'm not sure what you
+mean by "an exception is a consequence of a previous exception".
+Example? }}
+
 =back
 
 =head2 Standard Parrot Exceptions
@@ -285,6 +285,8 @@
 
 =item B<exception;domain>
 
+{{ TODO: How about calling these B<exception;input>? }}
+
 Generic base class for miscellaneous domain (input value) errors.  Payload is
 an array, the first element of which is the operation that failed (e.g. the
 opcode name); subsequent elements depend on the value of the first element.
@@ -364,23 +366,10 @@
 name requested doesn't exist in a lexical, current, global, or built-in
 namespace.
 
-{{ TODO: "errorson" as specified is dynamically rather than lexically
-scoped; is this good? Probably not good. Let's revisit it when we get
-the basic exceptions functionality implemented. }}
-
-It's a little odd that so few opcodes throw exceptions (these are the
-ones that are documented, but a few others throw exceptions internally
-even though they aren't documented as doing so). It's worth considering
-either expanding the use of exceptions consistently throughout the
-opcode set, or eliminating exceptions from the opcode set entirely. The
-strategy for error handling should be consistent, whatever it is. [I
-like the way C<LexPad>s and the C<errorson> settings provide the option
-for exception-based or non-exception-based implementations, rather than
-forcing one or the other.]
-
-{{ NOTE: There are a couple of different factors here.  One is the
-ability to globally define the severity of certain exceptions or
-categories of exceptions without needing to define a handler for each
+{{ FIXME - "errorson" as specified is dynamically rather than lexically
+scoped; is this good? ANR: There are a couple of different factors here.
+One is the ability to globally define the severity of certain exceptions
+or categories of exceptions without needing to define a handler for each
 one. (e.g. Perl 6 may have pragmas to set how severe type-checking
 errors are. A simple "incompatible type" error may be fatal under one
 pragma, a resumable warning under another pragma, and completely silent
@@ -404,6 +393,16 @@
 it still keeps the error information out-of-band, instead of mixing the
 error in with normal return values. }}
 
+It's a little odd that so few opcodes throw exceptions (these are the
+ones that are documented, but a few others throw exceptions internally
+even though they aren't documented as doing so). It's worth considering
+either expanding the use of exceptions consistently throughout the
+opcode set, or eliminating exceptions from the opcode set entirely. The
+strategy for error handling should be consistent, whatever it is. [I
+like the way C<LexPad>s and the C<errorson> settings provide the option
+for exception-based or non-exception-based implementations, rather than
+forcing one or the other.]
+
 =head2 Resuming after Exceptions
 
 Exceptions thrown by standard Parrot opcodes (like the one thrown by
@@ -418,6 +417,20 @@
   $P1 = new ['parrot';'exception'], $P0  # create new exception object
   throw $P1                              # throw it
 
+=head2 Consequenses
+
+Exceptions are designed to work with the Parrot calling conventions.
+Since the return addresses of C<bsr> subroutine calls and exception
+handlers are both pushed onto the control stack, it's generally a bad
+idea to combine the two.
+
+{{ TODO: If this continues to be true, then we need a way to turn off
+all exceptions. A number of built-in opcodes throw exceptions. If there
+is no way to prevent this, then it is never safe to use the control
+stack for anything other than exceptions. Alternatively, we leave the
+control stack safe for more primitive control flow, and pick another
+strategy for exceptions. }}
+
 =head1 ATTACHMENTS
 
 None.

Reply via email to