[svn:parrot] r38503 - in trunk/src: . call pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Wed May 6 06:21:15 UTC 2009
Author: chromatic
Date: Wed May 6 06:21:15 2009
New Revision: 38503
URL: https://trac.parrot.org/parrot/changeset/38503
Log:
[src] Tidied some code; no functional changes.
Modified:
trunk/src/call/ops.c
trunk/src/exceptions.c
trunk/src/pmc/namespace.pmc
Modified: trunk/src/call/ops.c
==============================================================================
--- trunk/src/call/ops.c Wed May 6 06:20:50 2009 (r38502)
+++ trunk/src/call/ops.c Wed May 6 06:21:15 2009 (r38503)
@@ -201,9 +201,10 @@
const char *sig_p;
Parrot_Context * const old_ctx = CONTEXT(interp);
- interp->current_cont = new_ret_continuation_pmc(interp, NULL);
+ interp->current_cont = new_ret_continuation_pmc(interp, NULL);
interp->current_object = obj;
- dest = VTABLE_invoke(interp, sub, NULL);
+ dest = VTABLE_invoke(interp, sub, NULL);
+
if (!dest)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PARROT_USAGE_ERROR,
"Subroutine returned a NULL address");
Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c Wed May 6 06:20:50 2009 (r38502)
+++ trunk/src/exceptions.c Wed May 6 06:21:15 2009 (r38503)
@@ -331,12 +331,14 @@
Parrot_ex_throw_from_c(PARROT_INTERP, ARGIN(PMC *exception))
{
ASSERT_ARGS(Parrot_ex_throw_from_c)
- PMC * const handler = Parrot_cx_find_handler_local(interp, exception);
- RunProfile * const profile = interp->profile;
+
Parrot_runloop *return_point = interp->current_runloop;
- if (PMC_IS_NULL(handler)) {
+ RunProfile * const profile = interp->profile;
+ PMC * const handler =
+ Parrot_cx_find_handler_local(interp, exception);
+
+ if (PMC_IS_NULL(handler))
die_from_exception(interp, exception);
- }
/* If profiling, remember end time of lastop and generate entry for
* exception. */
@@ -350,8 +352,10 @@
}
if (Interp_debug_TEST(interp, PARROT_BACKTRACE_DEBUG_FLAG)) {
- STRING * const msg = VTABLE_get_string(interp, exception);
- int exitcode = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "exit_code"));
+ STRING * const exit_code = CONST_STRING(interp, "exit_code");
+ STRING * const msg = VTABLE_get_string(interp, exception);
+ int exitcode = VTABLE_get_integer_keyed_str(interp,
+ exception, exit_code);
Parrot_io_eprintf(interp,
"Parrot_ex_throw_from_c (severity:%d error:%d): %Ss\n",
@@ -370,7 +374,7 @@
Parrot_runops_fromc_args(interp, handler, "vP", exception);
/* After handling a C exception, you don't want to resume at the point
- * where the C exception was thrown, you want to resume the next outer
+ * where the C exception was thrown. You want to resume the next outer
* runloop. */
longjmp(return_point->resume, 1);
}
Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc Wed May 6 06:20:50 2009 (r38502)
+++ trunk/src/pmc/namespace.pmc Wed May 6 06:21:15 2009 (r38503)
@@ -68,8 +68,8 @@
if (sub->vtable_index != -1) {
/* Insert it in class, if there is a class */
if (!PMC_IS_NULL(classobj) && PObj_is_class_TEST(classobj)) {
- const char *vtable_key_c;
- vtable_key_c = Parrot_get_vtable_name(interp, sub->vtable_index);
+ const char *vtable_key_c =
+ Parrot_get_vtable_name(interp, sub->vtable_index);
PARROT_ASSERT(vtable_key_c);
vtable_key = Parrot_str_new(interp, vtable_key_c,
strlen(vtable_key_c));
@@ -583,8 +583,6 @@
/*
-/*
-
=item C<METHOD add_sub(STRING *name, PMC *sub)>
Stores the given sub under this namespace, with the given name. Throws an
@@ -595,12 +593,15 @@
*/
METHOD add_sub(STRING *name, PMC *sub) {
- STRING * const s_sub = CONST_STRING(INTERP, "Sub");
+ STRING * const s_sub = CONST_STRING(INTERP, "Sub");
STRING * const s_multisub = CONST_STRING(INTERP, "MultiSub");
+ Parrot_sub *real_sub;
+ INTVAL vtable_idx = 0;
- if (!VTABLE_isa(INTERP, sub, s_sub) &&
- !VTABLE_isa(INTERP, sub, s_multisub))
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
+ if (!VTABLE_isa(INTERP, sub, s_sub)
+ && !VTABLE_isa(INTERP, sub, s_multisub))
+ Parrot_ex_throw_from_c_args(INTERP, NULL,
+ EXCEPTION_INVALID_OPERATION,
"Invalid type %d in add_sub()", sub->vtable->base_type);
VTABLE_set_pmc_keyed_str(INTERP, SELF, name, sub);
@@ -608,8 +609,6 @@
/*
-/*
-
=item C<METHOD add_var(STRING *name, PMC *var)>
Stores the given variable under this namespace, with the given name.
More information about the parrot-commits
mailing list