Skip to content
This repository
Browse code

Add a new exception type, EXCEPTION_DIE. Make the die() ops use it in…

…stead of CONTROL_ERROR.

This also reverts commit 74ba753.
  • Loading branch information...
commit 56f0d98fa12a43d51b8121b8ab811dcade6c669b 1 parent 84e6508
Michael Schroeder authored November 07, 2011
2  compilers/pct/src/PAST/Compiler.pir
@@ -155,7 +155,7 @@ any value type.
155 155
     ##  type of exception handler we support
156 156
     .local pmc controltypes
157 157
     controltypes = new 'Hash'
158  
-    controltypes['CONTROL']  = '.CONTROL_RETURN, .CONTROL_OK, .CONTROL_BREAK, .CONTROL_CONTINUE, .CONTROL_TAKE, .CONTROL_LEAVE, .CONTROL_EXIT, .CONTROL_LOOP_NEXT, .CONTROL_LOOP_LAST, .CONTROL_LOOP_REDO'
  158
+    controltypes['CONTROL']  = '.CONTROL_ALL'
159 159
     controltypes['RETURN']   = '.CONTROL_RETURN'
160 160
     controltypes['OK']       = '.CONTROL_OK'
161 161
     controltypes['BREAK']    = '.CONTROL_BREAK'
1  include/parrot/exceptions.h
@@ -80,6 +80,7 @@ typedef enum {
80 80
     EXCEPTION_LIBRARY_NOT_LOADED,
81 81
     EXCEPTION_SYNTAX_ERROR,
82 82
     EXCEPTION_MALFORMED_PACKFILE,
  83
+    EXCEPTION_DIE,
83 84
     EXCEPTION_ALL = 0x0ffff,
84 85
 
85 86
     CONTROL_RETURN = 0x10000,
4  src/ops/core.ops
@@ -797,7 +797,7 @@ inline op die(in STR) :flow {
797 797
     opcode_t * const ret       = expr NEXT();
798 798
     PMC      * const resume    = pmc_new(interp, enum_class_Continuation);
799 799
     PMC      * const exception = Parrot_ex_build_exception(interp, EXCEPT_error,
800  
-                                    CONTROL_ERROR, $1);
  800
+                                    EXCEPTION_DIE, $1);
801 801
 
802 802
     VTABLE_set_pointer(interp, resume, ret);
803 803
 
@@ -813,7 +813,7 @@ inline op die(in PMC) :flow {
813 813
     PMC      * const resume    = pmc_new(interp, enum_class_Continuation);
814 814
     STRING   * const msg       = PMC_IS_NULL($1) ? NULL : VTABLE_get_string(interp, $1);
815 815
     PMC      * const exception =
816  
-        Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, msg);
  816
+        Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, msg);
817 817
 
818 818
     VTABLE_set_pointer(interp, resume, ret);
819 819
 
8  src/ops/core_ops.c
@@ -13807,7 +13807,7 @@ Parrot_die_s(opcode_t *cur_opcode, PARROT_INTERP) {
13807 13807
     opcode_t         * dest;
13808 13808
     opcode_t  * const  ret =  cur_opcode + 2;
13809 13809
     PMC       * const  resume = pmc_new(interp, enum_class_Continuation);
13810  
-    PMC       * const  exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, SREG(1));
  13810
+    PMC       * const  exception = Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, SREG(1));
13811 13811
 
13812 13812
     VTABLE_set_pointer(interp, resume, ret);
13813 13813
     VTABLE_set_attr_str(interp, exception, Parrot_str_new_constant(interp, "resume"), resume);
@@ -13820,7 +13820,7 @@ Parrot_die_sc(opcode_t *cur_opcode, PARROT_INTERP) {
13820 13820
     opcode_t         * dest;
13821 13821
     opcode_t  * const  ret =  cur_opcode + 2;
13822 13822
     PMC       * const  resume = pmc_new(interp, enum_class_Continuation);
13823  
-    PMC       * const  exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, SCONST(1));
  13823
+    PMC       * const  exception = Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, SCONST(1));
13824 13824
 
13825 13825
     VTABLE_set_pointer(interp, resume, ret);
13826 13826
     VTABLE_set_attr_str(interp, exception, Parrot_str_new_constant(interp, "resume"), resume);
@@ -13834,7 +13834,7 @@ Parrot_die_p(opcode_t *cur_opcode, PARROT_INTERP) {
13834 13834
     opcode_t  * const  ret =  cur_opcode + 2;
13835 13835
     PMC       * const  resume = pmc_new(interp, enum_class_Continuation);
13836 13836
     STRING    * const  msg = PMC_IS_NULL(PREG(1)) ? NULL : VTABLE_get_string(interp, PREG(1));
13837  
-    PMC       * const  exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, msg);
  13837
+    PMC       * const  exception = Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, msg);
13838 13838
 
13839 13839
     VTABLE_set_pointer(interp, resume, ret);
13840 13840
     VTABLE_set_attr_str(interp, exception, Parrot_str_new_constant(interp, "resume"), resume);
@@ -13848,7 +13848,7 @@ Parrot_die_pc(opcode_t *cur_opcode, PARROT_INTERP) {
13848 13848
     opcode_t  * const  ret =  cur_opcode + 2;
13849 13849
     PMC       * const  resume = pmc_new(interp, enum_class_Continuation);
13850 13850
     STRING    * const  msg = PMC_IS_NULL(PCONST(1)) ? NULL : VTABLE_get_string(interp, PCONST(1));
13851  
-    PMC       * const  exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, msg);
  13851
+    PMC       * const  exception = Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, msg);
13852 13852
 
13853 13853
     VTABLE_set_pointer(interp, resume, ret);
13854 13854
     VTABLE_set_attr_str(interp, exception, Parrot_str_new_constant(interp, "resume"), resume);

2 notes on commit 56f0d98

Will Coleda
Owner

Although it was masked at the time by #185, this change broke partcl's exception handling mechanism. (Covered in partcl/partcl#4).

Will Coleda
Owner

I've routed around this change, so no updates are necessary in parrot.

Please sign in to comment.
Something went wrong with that request. Please try again.