[svn:parrot] r44533 - in branches/exceptions_refactor/src: ops pmc
tene at svn.parrot.org
tene at svn.parrot.org
Sat Feb 27 08:15:09 UTC 2010
Author: tene
Date: Sat Feb 27 08:15:08 2010
New Revision: 44533
URL: https://trac.parrot.org/parrot/changeset/44533
Log:
Allow rethrowing subclasses of exception.
Add additional information to backtraces. (still needs docs update)
Modified:
branches/exceptions_refactor/src/ops/core.ops
branches/exceptions_refactor/src/pmc/callcontext.pmc
Modified: branches/exceptions_refactor/src/ops/core.ops
==============================================================================
--- branches/exceptions_refactor/src/ops/core.ops Sat Feb 27 04:06:47 2010 (r44532)
+++ branches/exceptions_refactor/src/ops/core.ops Sat Feb 27 08:15:08 2010 (r44533)
@@ -801,7 +801,7 @@
inline op rethrow(invar PMC) :flow {
opcode_t * dest;
- if (PMC_IS_NULL($1) || $1->vtable->base_type != enum_class_Exception) {
+ if (PMC_IS_NULL($1) || ! VTABLE_isa(interp, $1, Parrot_str_new_constant(interp, "Exception"))) {
opcode_t * const ret = expr NEXT();
PMC * except = Parrot_ex_build_exception(interp, EXCEPT_fatal,
EXCEPTION_UNIMPLEMENTED,
Modified: branches/exceptions_refactor/src/pmc/callcontext.pmc
==============================================================================
--- branches/exceptions_refactor/src/pmc/callcontext.pmc Sat Feb 27 04:06:47 2010 (r44532)
+++ branches/exceptions_refactor/src/pmc/callcontext.pmc Sat Feb 27 08:15:08 2010 (r44533)
@@ -1497,6 +1497,7 @@
while (cur_ctx) {
PMC *frame = Parrot_pmc_new(interp, enum_class_Hash);
PMC *annotations = NULL;
+ Parrot_Context_info info;
Parrot_Sub_attributes *sub;
/* Get sub and put it in the hash. */
@@ -1528,6 +1529,16 @@
VTABLE_set_pmc_keyed_str(interp, frame, CONST_STRING(interp, "annotations"), annotations);
+ if (Parrot_Context_get_info(interp, cur_ctx, &info)) {
+ PMC *hash = Parrot_pmc_new(interp, enum_class_Hash);
+ VTABLE_set_string_keyed_str(interp, hash, CONST_STRING(interp, "fullname"), info.fullname);
+ VTABLE_set_string_keyed_str(interp, hash, CONST_STRING(interp, "nsname"), info.nsname);
+ VTABLE_set_string_keyed_str(interp, hash, CONST_STRING(interp, "subname"), info.subname);
+ VTABLE_set_integer_keyed_str(interp, hash, CONST_STRING(interp, "pc"), info.pc);
+ VTABLE_set_string_keyed_str(interp, hash, CONST_STRING(interp, "file"), info.file);
+ VTABLE_set_integer_keyed_str(interp, hash, CONST_STRING(interp, "line"), info.line);
+ VTABLE_set_pmc_keyed_str(interp, frame, CONST_STRING(interp, "info"), hash);
+ }
/* Push frame and go to next caller. */
VTABLE_push_pmc(interp, result, frame);
cur_ctx = Parrot_pcc_get_caller_ctx(interp, cur_ctx);
More information about the parrot-commits
mailing list