Skip to content

Instantly share code, notes, and snippets.

@cotto
Created July 15, 2010 16:00
Show Gist options
  • Save cotto/477154 to your computer and use it in GitHub Desktop.
Save cotto/477154 to your computer and use it in GitHub Desktop.
Index: src/pmc/task.pmc
===================================================================
--- src/pmc/task.pmc (revision 48096)
+++ src/pmc/task.pmc (working copy)
@@ -110,6 +110,10 @@
An interpreter in which to execute this task.
+=item C<data>
+
+Additional data for the task.
+
=back
=cut
@@ -168,7 +172,9 @@
core_struct->birthtime = 0.0;
core_struct->codeblock = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "code"));
- core_struct->interp = (Parrot_Interp)VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "data"));
+ core_struct->data = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "data"));
+
+ core_struct->interp = (Parrot_Interp)VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "interp"));
}
/*
@@ -233,6 +239,9 @@
value = Parrot_pmc_new(INTERP, enum_class_Float);
VTABLE_set_number_native(INTERP, value, core_struct->birthtime);
}
+ else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "data"))) {
+ value = core_struct->data;
+ }
else {
value = PMCNULL;
}
Index: src/exceptions.c
===================================================================
--- src/exceptions.c (revision 48096)
+++ src/exceptions.c (working copy)
@@ -242,6 +242,7 @@
if (PObj_get_FLAGS(handler) & SUB_FLAG_C_HANDLER) {
/* it's a C exception handler */
Parrot_runloop * const jump_point = (Parrot_runloop *)address;
+ jump_point->exception = exception;
longjmp(jump_point->resume, 1);
}
@@ -367,6 +368,7 @@
if (PObj_get_FLAGS(handler) & SUB_FLAG_C_HANDLER) {
Parrot_runloop * const jump_point =
(Parrot_runloop * const)VTABLE_get_pointer(interp, handler);
+ jump_point->exception = exception;
longjmp(jump_point->resume, 1);
}
Index: include/parrot/call.h
===================================================================
--- include/parrot/call.h (revision 48096)
+++ include/parrot/call.h (working copy)
@@ -29,6 +29,7 @@
* jump buffer stack */
opcode_t *handler_start; /* Used in exception handling */
int id; /* runloop id */
+ PMC *exception; /* Reference to the exception object */
/* let the biggest element cross the cacheline boundary */
Parrot_jump_buff resume; /* jmp_buf */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment