[pypy-svn] r77782 - in pypy/trunk/pypy: module/signal translator/c/src
arigo at codespeak.net
arigo at codespeak.net
Mon Oct 11 14:31:43 CEST 2010
Author: arigo
Date: Mon Oct 11 14:31:40 2010
New Revision: 77782
Modified:
pypy/trunk/pypy/module/signal/interp_signal.py
pypy/trunk/pypy/translator/c/src/signals.h
Log:
In signals.h, set the bit 30 instead of the highest bit. Helps on
64-bit platforms because the constant is within 32 bits.
Modified: pypy/trunk/pypy/module/signal/interp_signal.py
==============================================================================
--- pypy/trunk/pypy/module/signal/interp_signal.py (original)
+++ pypy/trunk/pypy/module/signal/interp_signal.py Mon Oct 11 14:31:40 2010
@@ -1,7 +1,6 @@
from pypy.interpreter.error import OperationError
from pypy.interpreter.baseobjspace import W_Root, ObjSpace
from pypy.interpreter.executioncontext import AsyncAction, AbstractActionFlag
-from pypy.rlib.rarithmetic import LONG_BIT, intmask
import signal as cpy_signal
from pypy.rpython.lltypesystem import lltype, rffi
from pypy.translator.tool.cbuild import ExternalCompilationInfo
@@ -64,8 +63,8 @@
class CheckSignalAction(AsyncAction):
"""An action that is automatically invoked when a signal is received."""
- # The C-level signal handler sets the highest bit of pypysig_occurred:
- bitmask = intmask(1 << (LONG_BIT-1))
+ # The C-level signal handler sets the bit 30 of pypysig_occurred:
+ bitmask = 1 << 30
def __init__(self, space):
AsyncAction.__init__(self, space)
Modified: pypy/trunk/pypy/translator/c/src/signals.h
==============================================================================
--- pypy/trunk/pypy/translator/c/src/signals.h (original)
+++ pypy/trunk/pypy/translator/c/src/signals.h Mon Oct 11 14:31:40 2010
@@ -6,20 +6,6 @@
#include <limits.h>
-#ifndef LONG_MAX
-#if SIZEOF_LONG == 4
-#define LONG_MAX 0X7FFFFFFFL
-#elif SIZEOF_LONG == 8
-#define LONG_MAX 0X7FFFFFFFFFFFFFFFL
-#else
-#error "could not set LONG_MAX in pyport.h"
-#endif
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN (-LONG_MAX-1)
-#endif
-
#include <stdlib.h>
#ifdef MS_WINDOWS
@@ -28,10 +14,6 @@
#include <signal.h>
-#ifndef SIG_ERR
-#define SIG_ERR ((PyOS_sighandler_t)(-1))
-#endif
-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
#define NSIG 12
#include <process.h>
@@ -65,11 +47,11 @@
/* utility to poll for signals that arrived */
int pypysig_poll(void); /* => signum or -1 */
-/* When a signal is received, the high bit of pypysig_occurred is set.
- After all signals are processed by pypysig_poll(), the high bit is
+/* When a signal is received, the bit 30 of pypysig_occurred is set.
+ After all signals are processed by pypysig_poll(), the bit 30 is
cleared again. The variable is exposed and RPython code is free to
use the other bits in any way. */
-#define PENDING_SIGNAL_BIT (LONG_MIN) /* high bit */
+#define PENDING_SIGNAL_BIT (1 << 30)
/* This is a struct for the JIT. See interp_signal.py. */
struct pypysig_long_struct {
long value;
More information about the Pypy-commit
mailing list