Author: allison
Date: Sat May 10 10:19:09 2008
New Revision: 27419
Modified:
branches/pdd25cx/docs/stm/internals.pod
branches/pdd25cx/include/parrot/exceptions.h
branches/pdd25cx/lib/Parrot/Pmc2c/PCCMETHOD.pm
branches/pdd25cx/src/events.c
branches/pdd25cx/src/exceptions.c
branches/pdd25cx/src/jit/alpha/jit_emit.h
branches/pdd25cx/src/jit/arm/jit_emit.h
branches/pdd25cx/src/jit/hppa/jit_emit.h
branches/pdd25cx/src/jit/ia64/jit_emit.h
branches/pdd25cx/src/jit/mips/jit_emit.h
branches/pdd25cx/src/jit/ppc/jit_emit.h
branches/pdd25cx/src/jit/sun4/jit_emit.h
branches/pdd25cx/src/ops/core.ops
branches/pdd25cx/src/packfile/pf_items.c
branches/pdd25cx/src/thread.c
branches/pdd25cx/src/tsq.c
branches/pdd25cx/t/src/basic.t
Log:
[pdd25cx] Replace 'internal_exception' with 'exit_fatal'.
Modified: branches/pdd25cx/docs/stm/internals.pod
==============================================================================
--- branches/pdd25cx/docs/stm/internals.pod (original)
+++ branches/pdd25cx/docs/stm/internals.pod Sat May 10 10:19:09 2008
@@ -49,7 +49,7 @@
in C<default.pmc> performs the switch.
Methods which are considered read-only point to automatically generated
-versions that call C<internal_exception()> in the read-only vtable.
+versions that call C<exit_fatal()> in the read-only vtable.
The notion of read-onlyness is obtained first from C<src/vtable.tbl>'s
marking of methods with C<:write>. For MMD methods, it is guessed when
a method will write a value based on the signature of the method,
Modified: branches/pdd25cx/include/parrot/exceptions.h
==============================================================================
--- branches/pdd25cx/include/parrot/exceptions.h (original)
+++ branches/pdd25cx/include/parrot/exceptions.h Sat May 10 10:19:09 2008
@@ -137,6 +137,11 @@
__attribute__nonnull__(2);
PARROT_API
+PARROT_DOES_NOT_RETURN
+void exit_fatal(int exitcode, ARGIN(const char *format), ...)
+ __attribute__nonnull__(2);
+
+PARROT_API
void free_internal_exception(PARROT_INTERP)
__attribute__nonnull__(1);
Modified: branches/pdd25cx/lib/Parrot/Pmc2c/PCCMETHOD.pm
==============================================================================
--- branches/pdd25cx/lib/Parrot/Pmc2c/PCCMETHOD.pm (original)
+++ branches/pdd25cx/lib/Parrot/Pmc2c/PCCMETHOD.pm Sat May 10 10:19:09 2008
@@ -414,7 +414,7 @@
else {
/* there is no point calling real_exception here, because
PDB_backtrace can't deal with a missing to_ctx either. */
- internal_exception(1, "No caller_ctx for continuation \%p.", _ccont);
+ exit_fatal(1, "No caller_ctx for continuation \%p.", _ccont);
}
_ctx->current_cont = _ret_cont;
@@ -467,7 +467,7 @@
if (! _caller_ctx) {
/* there is no point calling real_exception here, because
PDB_backtrace can't deal with a missing to_ctx either. */
- internal_exception(1, "No caller_ctx for continuation \%p.", _ccont);
+ exit_fatal(1, "No caller_ctx for continuation \%p.", _ccont);
}
interp->returns_signature = _return_sig;
Modified: branches/pdd25cx/src/events.c
==============================================================================
--- branches/pdd25cx/src/events.c (original)
+++ branches/pdd25cx/src/events.c Sat May 10 10:19:09 2008
@@ -739,7 +739,7 @@
default:
mem_sys_free(entry);
mem_sys_free(event);
- internal_exception(1, "Unknown event to broadcast");
+ exit_fatal(1, "Unknown event to broadcast");
break;
}
}
@@ -897,7 +897,7 @@
*/
edebug((stderr, "msg arrived\n"));
if (read(PIPE_READ_FD, &buf, sizeof (buf)) !=
sizeof (buf))
- internal_exception(1,
+ exit_fatal(1,
"read error from msg pipe");
switch (buf.command) {
case IO_THR_MSG_TERMINATE:
@@ -919,7 +919,7 @@
break;
/* TODO */
default:
- internal_exception(1,
+ exit_fatal(1,
"unhandled msg in pipe");
break;
}
@@ -969,7 +969,7 @@
memset(&buf, 0, sizeof (buf));
buf.command = IO_THR_MSG_TERMINATE;
if (write(PIPE_WRITE_FD, &buf, sizeof (buf)) != sizeof (buf))
- internal_exception(1, "msg pipe write failed");
+ exit_fatal(1, "msg pipe write failed");
#endif
}
@@ -1121,7 +1121,7 @@
}
break;
default:
- internal_exception(1, "Unknown queue entry");
+ exit_fatal(1, "Unknown queue entry");
}
PARROT_ASSERT(event);
if (event->type == EVENT_TYPE_NONE) {
@@ -1194,7 +1194,7 @@
else {
/* we shouldn't get here probably
*/
- internal_exception(1, "Spurious event");
+ exit_fatal(1, "Spurious event");
}
/*
Modified: branches/pdd25cx/src/exceptions.c
==============================================================================
--- branches/pdd25cx/src/exceptions.c (original)
+++ branches/pdd25cx/src/exceptions.c Sat May 10 10:19:09 2008
@@ -48,14 +48,17 @@
/*
-=item C<void internal_exception>
+=item C<void exit_fatal>
-Signal a fatal exception. This involves printing an error message to stderr,
-and calling C<Parrot_exit> to invoke exit handlers and exit the process with
the
-given exitcode. No error handlers are used, so it is not possible for Parrot
-bytecode to intercept a fatal error (cf. C<real_exception>). Furthermore, no
-stack unwinding is done, so the exit handlers run in the current dynamic
-environment.
+Signal a fatal error condition. This should only be used with dire errors that
+cannot throw an exception (because no interpreter is available, or the nature
+of the error would interfere with the exception system).
+
+This involves printing an error message to stderr, and calling C<exit> to exit
+the process with the given exitcode. It is not possible for Parrot bytecode to
+intercept a fatal error (for that, use C<real_exception>). C<exit_fatal> does
+not call C<Parrot_exit> to invoke exit handlers (that would require an
+interpreter).
=cut
@@ -64,7 +67,7 @@
PARROT_API
PARROT_DOES_NOT_RETURN
void
-internal_exception(int exitcode, ARGIN(const char *format), ...)
+exit_fatal(int exitcode, ARGIN(const char *format), ...)
{
va_list arglist;
va_start(arglist, format);
@@ -73,11 +76,6 @@
/* caution against output swap (with PDB_backtrace) */
fflush(stderr);
va_end(arglist);
-/*
- * RT #45907 get rid of all the internal_exceptions or call them
- * with an interpreter arg
- Parrot_exit(interp, exitcode);
- */
exit(exitcode);
}
@@ -565,7 +563,7 @@
handler decides that is appropriate, or zero to make the error non-resumable.
C<exitcode> is a C<exception_type_enum> value.
-See also C<internal_exception()>, which signals fatal errors, and
+See also C<exit_fatal()>, which signals fatal errors, and
C<run_handler>, which calls the handler.
=cut
Modified: branches/pdd25cx/src/jit/alpha/jit_emit.h
==============================================================================
--- branches/pdd25cx/src/jit/alpha/jit_emit.h (original)
+++ branches/pdd25cx/src/jit/alpha/jit_emit.h Sat May 10 10:19:09 2008
@@ -412,7 +412,7 @@
*(fixup_ptr++) |= *(disp + 2) & 0x1f;
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR, "Unknown fixup
type:%d\n",
+ exit_fatal(EXCEPTION_JIT_ERROR, "Unknown fixup type:%d\n",
fixup->type);
break;
}
Modified: branches/pdd25cx/src/jit/arm/jit_emit.h
==============================================================================
--- branches/pdd25cx/src/jit/arm/jit_emit.h (original)
+++ branches/pdd25cx/src/jit/arm/jit_emit.h Sat May 10 10:19:09 2008
@@ -359,7 +359,7 @@
{
ldr_str_dir_t direction = dir_Up;
if (offset > 4095 || offset < -4095) {
- internal_exception(EXCEPTION_JIT_ERROR,
+ exit_fatal(EXCEPTION_JIT_ERROR,
"Unable to generate offset %d, larger than 4095\n",
offset);
}
@@ -1083,7 +1083,7 @@
: "r0", "r1", "r2");
if (result < 0) {
- internal_exception(EXCEPTION_JIT_ERROR,
+ exit_fatal(EXCEPTION_JIT_ERROR,
"Synchronising I and D caches failed with
errno=%d\n",
-result);
}
Modified: branches/pdd25cx/src/jit/hppa/jit_emit.h
==============================================================================
--- branches/pdd25cx/src/jit/hppa/jit_emit.h (original)
+++ branches/pdd25cx/src/jit/hppa/jit_emit.h Sat May 10 10:19:09 2008
@@ -669,7 +669,7 @@
jit_emit_nop(fixup_ptr);
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR, "Unknown fixup
type:%d\n",
+ exit_fatal(EXCEPTION_JIT_ERROR, "Unknown fixup type:%d\n",
fixup->type);
break;
}
Modified: branches/pdd25cx/src/jit/ia64/jit_emit.h
==============================================================================
--- branches/pdd25cx/src/jit/ia64/jit_emit.h (original)
+++ branches/pdd25cx/src/jit/ia64/jit_emit.h Sat May 10 10:19:09 2008
@@ -644,7 +644,7 @@
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR, "Unknown fixup
type:%d\n",
+ exit_fatal(EXCEPTION_JIT_ERROR, "Unknown fixup type:%d\n",
fixup->type);
break;
}
Modified: branches/pdd25cx/src/jit/mips/jit_emit.h
==============================================================================
--- branches/pdd25cx/src/jit/mips/jit_emit.h (original)
+++ branches/pdd25cx/src/jit/mips/jit_emit.h Sat May 10 10:19:09 2008
@@ -415,7 +415,7 @@
*(fixup_ptr++) |= (char)d & ~3;
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR, "Unknown fixup
type:%d\n",
+ exit_fatal(EXCEPTION_JIT_ERROR, "Unknown fixup type:%d\n",
fixup->type);
break;
}
Modified: branches/pdd25cx/src/jit/ppc/jit_emit.h
==============================================================================
--- branches/pdd25cx/src/jit/ppc/jit_emit.h (original)
+++ branches/pdd25cx/src/jit/ppc/jit_emit.h Sat May 10 10:19:09 2008
@@ -952,7 +952,7 @@
}
break;
default:
- internal_exception(1, "set_returns_jit - unknown type");
+ exit_fatal(1, "set_returns_jit - unknown type");
break;
}
}
@@ -973,7 +973,7 @@
if (!recursive) {
/* create args array */
- internal_exception(1, "set_args_jit - can't do that yet ");
+ exit_fatal(1, "set_args_jit - can't do that yet ");
}
constants = CONTEXT(interp)->constants;
@@ -1012,7 +1012,7 @@
jit_emit_mov_ri_i(NATIVECODE, params_map, CUR_OPCODE[2 + i]);
break;
default:
- internal_exception(1, "set_args_jit - unknown type");
+ exit_fatal(1, "set_args_jit - unknown type");
break;
}
}
@@ -1201,7 +1201,7 @@
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR, "Unknown fixup
type:%d\n",
+ exit_fatal(EXCEPTION_JIT_ERROR, "Unknown fixup type:%d\n",
fixup->type);
break;
}
Modified: branches/pdd25cx/src/jit/sun4/jit_emit.h
==============================================================================
--- branches/pdd25cx/src/jit/sun4/jit_emit.h (original)
+++ branches/pdd25cx/src/jit/sun4/jit_emit.h Sat May 10 10:19:09 2008
@@ -435,7 +435,7 @@
jit_info->optimizer->cur_section->branch_target->load_size;
if ((offset > emitm_branch_max) || (offset < emitm_branch_min))
- internal_exception(EXCEPTION_JIT_ERROR,
+ exit_fatal(EXCEPTION_JIT_ERROR,
"Branches beyond 8 Megabytes not yet supported\n");
offset /= 4;
emitm_2b(jit_info->native_ptr, annul, cond, branch, offset);
@@ -522,7 +522,7 @@
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR,
+ exit_fatal(EXCEPTION_JIT_ERROR,
"Unsupported op parameter type %d\n",
op_type);
}
@@ -565,7 +565,7 @@
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR,
+ exit_fatal(EXCEPTION_JIT_ERROR,
"Unsupported op parameter type %d\n", op_type);
}
}
@@ -613,7 +613,7 @@
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR,
+ exit_fatal(EXCEPTION_JIT_ERROR,
"Unsupported op parameter type %d\n", op_type);
}
}
@@ -643,7 +643,7 @@
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR,
+ exit_fatal(EXCEPTION_JIT_ERROR,
"Unsupported op parameter type %d\n", op_type);
}
}
@@ -676,7 +676,7 @@
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR, "Unknown fixup
type:%d\n",
+ exit_fatal(EXCEPTION_JIT_ERROR, "Unknown fixup type:%d\n",
fixup->type);
break;
}
@@ -922,7 +922,7 @@
emitm_ld_i(jit_info->native_ptr, XSR1, 0, emitm_o(rdx));
break;
default:
- internal_exception(1,
+ exit_fatal(1,
"jit_vtable_n_op: unimp type %d, arg %d vtable %d",
op_info->types[i - 1], i, nvtable);
break;
@@ -963,7 +963,7 @@
Parrot_jit_regoff((int)®_NUM(interp, val), interp));
break;
default:
- internal_exception(EXCEPTION_JIT_ERROR, "jit_vtable1r: ill LHS");
+ exit_fatal(EXCEPTION_JIT_ERROR, "jit_vtable1r: ill LHS");
}
}
@@ -1123,7 +1123,7 @@
int i2 = *(jit_info->cur_op + 2);
if (i2 <= 0 || i2 >= interp->n_vtable_max)
- internal_exception(1, "Illegal PMC enum (%d) in new", i2);
+ exit_fatal(1, "Illegal PMC enum (%d) in new", i2);
/* get "a" pmc first - calling function: pmc_new_noinit(...) */
/* PMC* pmc_new_noinit(PARROT_INTERP, INTVAL base_type) */
Modified: branches/pdd25cx/src/ops/core.ops
==============================================================================
--- branches/pdd25cx/src/ops/core.ops (original)
+++ branches/pdd25cx/src/ops/core.ops Sat May 10 10:19:09 2008
@@ -560,7 +560,7 @@
if (! caller_ctx) {
/* there is no point calling real_exception here, because
PDB_backtrace can't deal with a missing to_ctx either. */
- internal_exception(1, "No caller_ctx for continuation %p.", ccont);
+ exit_fatal(1, "No caller_ctx for continuation %p.", ccont);
}
src_indexes = interp->current_returns;
Modified: branches/pdd25cx/src/packfile/pf_items.c
==============================================================================
--- branches/pdd25cx/src/packfile/pf_items.c (original)
+++ branches/pdd25cx/src/packfile/pf_items.c Sat May 10 10:19:09 2008
@@ -171,7 +171,7 @@
{
cvt_num12_num8(dest, src);
/* TODO endianize */
- internal_exception(1, "TODO cvt_num12_num8_be\n");
+ exit_fatal(1, "TODO cvt_num12_num8_be\n");
}
/*
Modified: branches/pdd25cx/src/thread.c
==============================================================================
--- branches/pdd25cx/src/thread.c (original)
+++ branches/pdd25cx/src/thread.c Sat May 10 10:19:09 2008
@@ -817,15 +817,15 @@
{
if (tid >= n_interpreters) {
UNLOCK(interpreter_array_mutex);
- internal_exception(1, "%s: illegal thread tid %d", from, tid);
+ exit_fatal(1, "%s: illegal thread tid %d", from, tid);
}
if (tid == 0) {
UNLOCK(interpreter_array_mutex);
- internal_exception(1, "%s: illegal thread tid %d (main)", from, tid);
+ exit_fatal(1, "%s: illegal thread tid %d (main)", from, tid);
}
if (!interpreter_array[tid]) {
UNLOCK(interpreter_array_mutex);
- internal_exception(1, "%s: illegal thread tid %d - empty", from, tid);
+ exit_fatal(1, "%s: illegal thread tid %d - empty", from, tid);
}
return interpreter_array[tid];
}
Modified: branches/pdd25cx/src/tsq.c
==============================================================================
--- branches/pdd25cx/src/tsq.c (original)
+++ branches/pdd25cx/src/tsq.c Sat May 10 10:19:09 2008
@@ -382,7 +382,7 @@
queue_destroy(ARGMOD(QUEUE *queue))
{
if (peek_entry(queue))
- internal_exception(1, "Queue not empty on destroy");
+ exit_fatal(1, "Queue not empty on destroy");
COND_DESTROY(queue->queue_condition);
MUTEX_DESTROY(queue->queue_mutex);
Modified: branches/pdd25cx/t/src/basic.t
==============================================================================
--- branches/pdd25cx/t/src/basic.t (original)
+++ branches/pdd25cx/t/src/basic.t Sat May 10 10:19:09 2008
@@ -20,7 +20,7 @@
=head1 DESCRIPTION
-Tests C<printf> and C<internal_exception> functions.
+Tests C<printf> and C<exit_fatal> functions.
=cut
@@ -37,14 +37,14 @@
Hello, World!
OUTPUT
-c_output_is( <<'CODE', <<'OUTPUT', "direct internal_exception call" );
+c_output_is( <<'CODE', <<'OUTPUT', "direct exit_fatal call" );
#include <parrot/parrot.h>
#include <parrot/exceptions.h>
int
main(int argc, char* argv[])
{
- internal_exception(0, "Blow'd Up(tm)"); /* ' */
+ exit_fatal(0, "Blow'd Up(tm)"); /* ' */
}
CODE
Blow'd Up(tm)