From 9ccf5811b30074921912b54207a0e9dfda0f0388 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 12 Sep 2009 18:15:16 -0500 Subject: [PATCH 1/2] vm: fix fp_trap_error() so that it can work properly in signal handlers --- vm/errors.cpp | 6 +++--- vm/mach_signal.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/vm/errors.cpp b/vm/errors.cpp index 1dcee889a3..c9d2a94e56 100644 --- a/vm/errors.cpp +++ b/vm/errors.cpp @@ -130,9 +130,9 @@ void divide_by_zero_error() general_error(ERROR_DIVIDE_BY_ZERO,F,F,NULL); } -void fp_trap_error() +void fp_trap_error(stack_frame *signal_callstack_top) { - general_error(ERROR_FP_TRAP,F,F,NULL); + general_error(ERROR_FP_TRAP,F,F,signal_callstack_top); } PRIMITIVE(call_clear) @@ -158,7 +158,7 @@ void misc_signal_handler_impl() void fp_signal_handler_impl() { - fp_trap_error(); + fp_trap_error(signal_callstack_top); } } diff --git a/vm/mach_signal.cpp b/vm/mach_signal.cpp index 50a924f8e4..facf512b77 100644 --- a/vm/mach_signal.cpp +++ b/vm/mach_signal.cpp @@ -55,12 +55,12 @@ static void call_fault_handler( MACH_PROGRAM_COUNTER(thread_state) = (cell)memory_signal_handler_impl; } else if(exception == EXC_ARITHMETIC && code != MACH_EXC_INTEGER_DIV) - { + { MACH_PROGRAM_COUNTER(thread_state) = (cell)fp_signal_handler_impl; - } - else - { - signal_number = exception == EXC_ARITHMETIC ? SIGFPE : SIGABRT; + } + else + { + signal_number = (exception == EXC_ARITHMETIC ? SIGFPE : SIGABRT); MACH_PROGRAM_COUNTER(thread_state) = (cell)misc_signal_handler_impl; } } From 018677319cb314615759ece038e6690e38cc1269 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 12 Sep 2009 21:07:31 -0400 Subject: [PATCH 2/2] math, syntax: fix help lint --- core/math/math-docs.factor | 6 +++--- core/syntax/syntax-docs.factor | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/math/math-docs.factor b/core/math/math-docs.factor index d98685fb48..97e0a1e7cf 100644 --- a/core/math/math-docs.factor +++ b/core/math/math-docs.factor @@ -282,12 +282,12 @@ HELP: fp-bitwise= { $examples "Not-a-number equality:" { $example - "USING: math prettyprint ;" + "USING: kernel math prettyprint ;" "0.0 0.0 / dup number= ." "f" } { $example - "USING: math prettyprint ;" + "USING: kernel math prettyprint ;" "0.0 0.0 / dup fp-bitwise= ." "t" } @@ -299,7 +299,7 @@ HELP: fp-bitwise= } { $example "USING: math prettyprint ;" - "-0.0 0.0 = ." + "-0.0 0.0 number= ." "t" } } ; diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index 19e644cb68..0a11f62c16 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -612,8 +612,8 @@ HELP: NAN: { $examples { $example "USE: prettyprint" - "NAN: deadbeef ." - "NAN: deadbeef" + "NAN: 80000deadbeef ." + "NAN: 80000deadbeef" } } ;