summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-20 15:45:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-20 15:45:15 +0000
commite91e9e7bbf1d93cdff89878b776a7824a9bc2d99 (patch)
treedb5ce495631901ac5458a7373cfcb0bae9e2fc56
parentbb4f36de3a032909c90f6fa72f2134f198958145 (diff)
* eval.c (rb_with_disable_interrupt): prohibit thread context
switch during proc execution. [ruby-dev:21899] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--configure.in2
-rw-r--r--dln.c2
-rw-r--r--eval.c12
-rw-r--r--ext/tcltklib/tcltklib.c8
-rw-r--r--missing/isinf.c28
-rw-r--r--missing/isnan.c24
-rw-r--r--numeric.c7
8 files changed, 53 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index 287dd3f019..6f2264bfe7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,11 @@ Sat Dec 20 11:40:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/yaml.rb (YAML::YAML): adjust Marshal version.
+Sat Dec 20 03:56:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_with_disable_interrupt): prohibit thread context
+ switch during proc execution. [ruby-dev:21899]
+
Sat Dec 20 02:41:02 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/cgi.rb: add file. (yet another CGI library)
diff --git a/configure.in b/configure.in
index ee6cf7bb94..88be09ef9f 100644
--- a/configure.in
+++ b/configure.in
@@ -379,7 +379,7 @@ AC_FUNC_FSEEKO
AC_CHECK_FUNCS(ftello)
AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
strchr strstr strtoul crypt flock vsnprintf\
- isinf isnan finite hypot acosh erf)
+ isnan finite isinf hypot acosh erf)
AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd\
truncate chsize times utimes fcntl lockf lstat symlink readlink\
setitimer setruid seteuid setreuid setresuid setproctitle\
diff --git a/dln.c b/dln.c
index be3e6c4b6b..5f7982051e 100644
--- a/dln.c
+++ b/dln.c
@@ -91,7 +91,7 @@ char *getenv();
int eaccess();
-#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__)
++#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
diff --git a/eval.c b/eval.c
index a8f68392b9..6369df8025 100644
--- a/eval.c
+++ b/eval.c
@@ -4739,11 +4739,13 @@ rb_with_disable_interrupt(proc, data)
int status;
DEFER_INTS;
- PUSH_TAG(PROT_NONE);
- if ((status = EXEC_TAG()) == 0) {
- result = (*proc)(data);
- }
- POP_TAG();
+ RUBY_CRITICAL(
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ result = (*proc)(data);
+ }
+ POP_TAG();
+ );
ALLOW_INTS;
if (status) JUMP_TAG(status);
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index 50c654d814..ad7e377b66 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -800,7 +800,7 @@ ip_ruby(clientData, interp, argc, argv)
{
VALUE res;
int old_trapflag;
- struct eval_body_arg arg;
+ struct eval_body_arg arg;
int dummy;
/* ruby command has 1 arg. */
@@ -817,7 +817,7 @@ ip_ruby(clientData, interp, argc, argv)
arg.failed = 0;
/* evaluate the argument string by ruby */
- DUMP2("rb_eval_string(%s)", arg);
+ DUMP2("rb_eval_string(%s)", arg.string);
old_trapflag = rb_trap_immediate;
res = rb_ensure(ip_ruby_eval_body, (VALUE)&arg,
ip_ruby_eval_ensure, INT2FIX(old_trapflag));
@@ -1775,7 +1775,7 @@ eval_queue_handler(evPtr, flags)
{
struct eval_queue *q = (struct eval_queue *)evPtr;
- DUMP2("do_eval_queue_handler : evPtr = %lx", evPtr);
+ DUMP2("do_eval_queue_handler : evPtr = %p", evPtr);
DUMP2("eval queue_thread : %lx", rb_thread_current());
DUMP2("added by thread : %lx", q->thread);
@@ -2176,7 +2176,7 @@ invoke_queue_handler(evPtr, flags)
{
struct invoke_queue *q = (struct invoke_queue *)evPtr;
- DUMP2("do_invoke_queue_handler : evPtr = %lx", evPtr);
+ DUMP2("do_invoke_queue_handler : evPtr = %p", evPtr);
DUMP2("invoke queue_thread : %lx", rb_thread_current());
DUMP2("added by thread : %lx", q->thread);
diff --git a/missing/isinf.c b/missing/isinf.c
index 38772ba4f1..1b09f11f19 100644
--- a/missing/isinf.c
+++ b/missing/isinf.c
@@ -9,16 +9,33 @@ int
isinf(n)
double n;
{
- if (IsNANorINF(n) && IsINF(n)) {
- return 1;
- } else {
- return 0;
- }
+ if (IsNANorINF(n) && IsINF(n)) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
#else
#include "config.h"
+
+#if defined(HAVE_FINITE) && defined(HAVE_ISNAN)
+
+#ifdef HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
+
+int
+isinf(n)
+ double n;
+{
+ return (!finite(x) && !isnan(x))
+}
+
+#else
+
#ifdef HAVE_STRING_H
# include <string.h>
#else
@@ -44,3 +61,4 @@ isinf(n)
|| memcmp(&n, &ninf, sizeof n) == 0;
}
#endif
+#endif
diff --git a/missing/isnan.c b/missing/isnan.c
index df424c2e61..459048e936 100644
--- a/missing/isnan.c
+++ b/missing/isnan.c
@@ -1,31 +1,17 @@
/* public domain rewrite of isnan(3) */
-#ifdef _MSC_VER
-
-#include <float.h>
-int
-isnan(n)
- double n;
-{
- return _isnan(n);
-}
-
-#else
-
static int double_ne();
int
isnan(n)
- double n;
+ double n;
{
- return double_ne(n, n);
+ return double_ne(n, n);
}
-static
-int
+static int
double_ne(n1, n2)
- double n1, n2;
+ double n1, n2;
{
- return n1 != n2;
+ return n1 != n2;
}
-#endif
diff --git a/numeric.c b/numeric.c
index 341d0b8a3d..a33c83adaf 100644
--- a/numeric.c
+++ b/numeric.c
@@ -19,6 +19,10 @@
#include <floatingpoint.h>
#endif
+#ifdef _UNICOSMP
+#include <intrinsics.h>
+#endif
+
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
@@ -1828,6 +1832,9 @@ Init_Numeric()
#if defined(__FreeBSD__) && __FreeBSD__ < 4
/* allow divide by zero -- Inf */
fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_INV|FP_X_OFL));
+#elif defined(_UNICOSMP)
+ /* Turn off floating point exceptions for divide by zero, etc. */
+ _set_Creg(0, 0);
#endif
id_coerce = rb_intern("coerce");
id_to_i = rb_intern("to_i");