cvsuser     04/03/17 01:38:20

  Modified:    .        MANIFEST
               src      interpreter.c
               t/pmc    object-meths.t
  Log:
  rm .cvsignore; STACKED_EXCEPTIONS in runops; test by Jens Rieks
  
  Revision  Changes    Path
  1.600     +0 -1      parrot/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST,v
  retrieving revision 1.599
  retrieving revision 1.600
  diff -u -w -r1.599 -r1.600
  --- MANIFEST  17 Mar 2004 09:18:35 -0000      1.599
  +++ MANIFEST  17 Mar 2004 09:38:09 -0000      1.600
  @@ -2190,7 +2190,6 @@
   languages/scheme/t/logic/basic.t                  [scheme]
   languages/scheme/t/logic/defines.t                [scheme]
   languages/scheme/t/logic/lists.t                  [scheme]
  -languages/tcl/.cvsignore                          [tcl]
   languages/tcl/CHANGELOG                           [tcl]
   languages/tcl/LICENSE                             [tcl]
   languages/tcl/MAINTAINER                          [tcl]
  
  
  
  1.285     +14 -8     parrot/src/interpreter.c
  
  Index: interpreter.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/interpreter.c,v
  retrieving revision 1.284
  retrieving revision 1.285
  diff -u -w -r1.284 -r1.285
  --- interpreter.c     17 Mar 2004 08:54:41 -0000      1.284
  +++ interpreter.c     17 Mar 2004 09:38:14 -0000      1.285
  @@ -1,7 +1,7 @@
   /*
   ################################################################################
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: interpreter.c,v 1.284 2004/03/17 08:54:41 leo Exp $
  +$Id: interpreter.c,v 1.285 2004/03/17 09:38:14 leo Exp $
   ################################################################################
   
   =head1 NAME
  @@ -902,16 +902,22 @@
   
   */
   
  +#define STACKED_EXCEPTIONS 1
  +
   void
   runops(struct Parrot_Interp *interpreter, size_t offset)
   {
       /*
  -     * having stacked exceptions for each runlevel doesn't work
  -     * (after a longjmp the interpreter is totally messed up)
  -     * I don't know, if we even need this, so for now just one
  -     * exception is created
  +     * having stacked exceptions for each runlevel didn't work always
  +     * (after a longjmp the interpreter was totally messed up)
  +     *
  +     * But these are necessary to catch exceptions in reentered
  +     * run loops, e.g. if a delegate methods throws an exception
        */
  -    if (!interpreter->exceptions) {
  +#if ! STACKED_EXCEPTIONS
  +    if (!interpreter->exceptions)
  +#endif
  +    {
           new_internal_exception(interpreter);
           if (setjmp(interpreter->exceptions->destination)) {
               /* an exception was thrown */
  @@ -929,9 +935,9 @@
       runops_ex(interpreter, offset);
       /*
        * pop off exception and put it onto the free list
  -     * N/Y s. above
  +     * s. above
        */
  -    if (0) {
  +    if (STACKED_EXCEPTIONS) {
           Parrot_exception *e = interpreter->exceptions;
           interpreter->exceptions = e->prev;
           interpreter->exc_free_list = e;
  
  
  
  1.12      +42 -2     parrot/t/pmc/object-meths.t
  
  Index: object-meths.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/pmc/object-meths.t,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -r1.11 -r1.12
  --- object-meths.t    11 Mar 2004 17:09:55 -0000      1.11
  +++ object-meths.t    17 Mar 2004 09:38:20 -0000      1.12
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: object-meths.t,v 1.11 2004/03/11 17:09:55 leo Exp $
  +# $Id: object-meths.t,v 1.12 2004/03/17 09:38:20 leo Exp $
   
   =head1 NAME
   
  @@ -16,7 +16,7 @@
   
   =cut
   
  -use Parrot::Test tests => 10;
  +use Parrot::Test tests => 11;
   use Test::More;
   
   output_like(<<'CODE', <<'OUTPUT', "callmethod - unknown");
  @@ -353,3 +353,43 @@
   A::blah
   B::foo
   OUTPUT
  +
  +output_is(<<'CODE', <<'OUTPUT', "exceptions and different runloops");
  +_main:
  +    newsub P0, .Exception_Handler, _eh
  +    set_eh P0
  +
  +    newclass P0, "Foo"
  +
  +    newsub P0, .Sub, __init
  +    store_global "Foo", "__init", P0
  +
  +    print "new\n"
  +    find_type I0, "Foo"
  +    new P2, I0
  +    print "back in main\n"
  +    end
  +
  +_eh:
  +    print "eh!\n"
  +    set P0, P5["_invoke_cc"]
  +    invoke P0
  +
  +__init:
  +    set P10, P1
  +    print "in __init\n"
  +
  +    # raise an exception
  +    set S0, "qux"
  +    callmethod
  +
  +    print "back in __init\n"
  +    invoke P10
  +CODE
  +new
  +in __init
  +eh!
  +back in __init
  +back in main
  +OUTPUT
  +
  
  
  

Reply via email to