Permalink
Browse files

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...
mlschroe committed Nov 7, 2011
1 parent 84e6508 commit 56f0d98fa12a43d51b8121b8ab811dcade6c669b
Showing with 8 additions and 7 deletions.
  1. +1 −1 compilers/pct/src/PAST/Compiler.pir
  2. +1 −0 include/parrot/exceptions.h
  3. +2 −2 src/ops/core.ops
  4. +4 −4 src/ops/core_ops.c
@@ -155,7 +155,7 @@ any value type.
## type of exception handler we support
.local pmc controltypes
controltypes = new 'Hash'
- 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'
+ controltypes['CONTROL'] = '.CONTROL_ALL'
controltypes['RETURN'] = '.CONTROL_RETURN'
controltypes['OK'] = '.CONTROL_OK'
controltypes['BREAK'] = '.CONTROL_BREAK'
@@ -80,6 +80,7 @@ typedef enum {
EXCEPTION_LIBRARY_NOT_LOADED,
EXCEPTION_SYNTAX_ERROR,
EXCEPTION_MALFORMED_PACKFILE,
+ EXCEPTION_DIE,
EXCEPTION_ALL = 0x0ffff,
CONTROL_RETURN = 0x10000,
View
@@ -797,7 +797,7 @@ inline op die(in STR) :flow {
opcode_t * const ret = expr NEXT();
PMC * const resume = pmc_new(interp, enum_class_Continuation);
PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error,
- CONTROL_ERROR, $1);
+ EXCEPTION_DIE, $1);
VTABLE_set_pointer(interp, resume, ret);
@@ -813,7 +813,7 @@ inline op die(in PMC) :flow {
PMC * const resume = pmc_new(interp, enum_class_Continuation);
STRING * const msg = PMC_IS_NULL($1) ? NULL : VTABLE_get_string(interp, $1);
PMC * const exception =
- Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, msg);
+ Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, msg);
VTABLE_set_pointer(interp, resume, ret);
View
@@ -13807,7 +13807,7 @@ Parrot_die_s(opcode_t *cur_opcode, PARROT_INTERP) {
opcode_t * dest;
opcode_t * const ret = cur_opcode + 2;
PMC * const resume = pmc_new(interp, enum_class_Continuation);
- PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, SREG(1));
+ PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, SREG(1));
VTABLE_set_pointer(interp, resume, ret);
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) {
opcode_t * dest;
opcode_t * const ret = cur_opcode + 2;
PMC * const resume = pmc_new(interp, enum_class_Continuation);
- PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, SCONST(1));
+ PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, SCONST(1));
VTABLE_set_pointer(interp, resume, ret);
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) {
opcode_t * const ret = cur_opcode + 2;
PMC * const resume = pmc_new(interp, enum_class_Continuation);
STRING * const msg = PMC_IS_NULL(PREG(1)) ? NULL : VTABLE_get_string(interp, PREG(1));
- PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, msg);
+ PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, msg);
VTABLE_set_pointer(interp, resume, ret);
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) {
opcode_t * const ret = cur_opcode + 2;
PMC * const resume = pmc_new(interp, enum_class_Continuation);
STRING * const msg = PMC_IS_NULL(PCONST(1)) ? NULL : VTABLE_get_string(interp, PCONST(1));
- PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, msg);
+ PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error, EXCEPTION_DIE, msg);
VTABLE_set_pointer(interp, resume, ret);
VTABLE_set_attr_str(interp, exception, Parrot_str_new_constant(interp, "resume"), resume);

2 comments on commit 56f0d98

@coke

This comment has been minimized.

Show comment
Hide comment
@coke

coke Jan 26, 2012

Contributor

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

Contributor

coke replied Jan 26, 2012

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

@coke

This comment has been minimized.

Show comment
Hide comment
@coke

coke Jan 26, 2012

Contributor

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

Contributor

coke replied Jan 26, 2012

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

Please sign in to comment.