Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r72781:92b4b658ae4b
Date: 2014-08-12 16:43 -0700
http://bitbucket.org/pypy/pypy/changeset/92b4b658ae4b/
Log: merge default
diff --git a/lib_pypy/_tkinter/__init__.py b/lib_pypy/_tkinter/__init__.py
--- a/lib_pypy/_tkinter/__init__.py
+++ b/lib_pypy/_tkinter/__init__.py
@@ -30,6 +30,10 @@
return TkApp(screenName, className,
interactive, wantobjects, wantTk, sync, use)
+def dooneevent(flags=0):
+ return tklib.Tcl_DoOneEvent(flags)
+
+
def _flatten(item):
def _flatten1(output, item, depth):
if depth > 1000:
diff --git a/rpython/jit/backend/x86/callbuilder.py
b/rpython/jit/backend/x86/callbuilder.py
--- a/rpython/jit/backend/x86/callbuilder.py
+++ b/rpython/jit/backend/x86/callbuilder.py
@@ -1,8 +1,9 @@
+import sys
from rpython.rlib.clibffi import FFI_DEFAULT_ABI
from rpython.rlib.objectmodel import we_are_translated
from rpython.jit.metainterp.history import INT, FLOAT
from rpython.jit.backend.x86.arch import (WORD, IS_X86_64, IS_X86_32,
- PASS_ON_MY_FRAME)
+ PASS_ON_MY_FRAME, FRAME_FIXED_SIZE)
from rpython.jit.backend.x86.regloc import (eax, ecx, edx, ebx, esp, ebp, esi,
xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, r8, r9, r10, r11, edi,
r12, r13, r14, r15, X86_64_SCRATCH_REG, X86_64_XMM_SCRATCH_REG,
@@ -15,6 +16,8 @@
# Same for gcc 4.5.0, better safe than sorry
CALL_ALIGN = 16 // WORD
+stdcall_or_cdecl = sys.platform == "win32"
+
def align_stack_words(words):
return (words + CALL_ALIGN - 1) & ~(CALL_ALIGN-1)
@@ -44,11 +47,6 @@
self.stack_max = PASS_ON_MY_FRAME - asmgcroot.JIT_USE_WORDS
assert self.stack_max >= 3
- def emit_raw_call(self):
- self.mc.CALL(self.fnloc)
- if self.callconv != FFI_DEFAULT_ABI:
- self.current_esp += self._fix_stdcall(self.callconv)
-
def subtract_esp_aligned(self, count):
if count > 0:
align = align_stack_words(count)
@@ -246,6 +244,28 @@
self.fnloc = RawEspLoc(p - WORD, INT)
+ def emit_raw_call(self):
+ if stdcall_or_cdecl and self.is_call_release_gil:
+ # Dynamically accept both stdcall and cdecl functions.
+ # We could try to detect from pyjitpl which calling
+ # convention this particular function takes, which would
+ # avoid these two extra MOVs... but later. The ebp register
+ # is unused here: it will be reloaded from the shadowstack.
+ # (This doesn't work during testing, though. Hack hack hack.)
+ save_ebp = not self.asm.cpu.gc_ll_descr.is_shadow_stack()
+ ofs = WORD * (FRAME_FIXED_SIZE - 1)
+ if save_ebp: # only for testing (or with Boehm)
+ self.mc.MOV_sr(ofs, ebp.value)
+ self.mc.MOV(ebp, esp)
+ self.mc.CALL(self.fnloc)
+ self.mc.MOV(esp, ebp)
+ if save_ebp: # only for testing (or with Boehm)
+ self.mc.MOV_rs(ebp.value, ofs)
+ else:
+ self.mc.CALL(self.fnloc)
+ if self.callconv != FFI_DEFAULT_ABI:
+ self.current_esp += self._fix_stdcall(self.callconv)
+
def _fix_stdcall(self, callconv):
from rpython.rlib.clibffi import FFI_STDCALL
assert callconv == FFI_STDCALL
@@ -417,8 +437,9 @@
remap_frame_layout(self.asm, src_locs, dst_locs, X86_64_SCRATCH_REG)
- def _fix_stdcall(self, callconv):
- assert 0 # should not occur on 64-bit
+ def emit_raw_call(self):
+ assert self.callconv == FFI_DEFAULT_ABI
+ self.mc.CALL(self.fnloc)
def load_result(self):
if self.restype == 'S':
diff --git a/rpython/jit/backend/x86/test/test_runner.py
b/rpython/jit/backend/x86/test/test_runner.py
--- a/rpython/jit/backend/x86/test/test_runner.py
+++ b/rpython/jit/backend/x86/test/test_runner.py
@@ -438,20 +438,26 @@
if WORD != 4:
py.test.skip("32-bit only test")
from rpython.jit.backend.x86.regloc import eax, edx
- from rpython.jit.backend.x86 import codebuf
+ from rpython.jit.backend.x86 import codebuf, callbuilder
from rpython.jit.codewriter.effectinfo import EffectInfo
from rpython.rlib.libffi import types, clibffi
had_stdcall = hasattr(clibffi, 'FFI_STDCALL')
if not had_stdcall: # not running on Windows, but we can still test
monkeypatch.setattr(clibffi, 'FFI_STDCALL', 12345, raising=False)
+ monkeypatch.setattr(callbuilder, 'stdcall_or_cdecl', True)
+ else:
+ assert callbuilder.stdcall_or_cdecl
#
- for ffi in [clibffi.FFI_DEFAULT_ABI, clibffi.FFI_STDCALL]:
+ for real_ffi, reported_ffi in [
+ (clibffi.FFI_DEFAULT_ABI, clibffi.FFI_DEFAULT_ABI),
+ (clibffi.FFI_STDCALL, clibffi.FFI_DEFAULT_ABI),
+ (clibffi.FFI_STDCALL, clibffi.FFI_STDCALL)]:
cpu = self.cpu
mc = codebuf.MachineCodeBlockWrapper()
mc.MOV_rs(eax.value, 4) # argument 1
mc.MOV_rs(edx.value, 40) # argument 10
mc.SUB_rr(eax.value, edx.value) # return arg1 - arg10
- if ffi == clibffi.FFI_DEFAULT_ABI:
+ if real_ffi == clibffi.FFI_DEFAULT_ABI:
mc.RET()
else:
mc.RET16_i(40)
@@ -459,7 +465,7 @@
#
calldescr = cpu._calldescr_dynamic_for_tests([types.slong] * 10,
types.slong)
- calldescr.get_call_conv = lambda: ffi # <==== hack
+ calldescr.get_call_conv = lambda: reported_ffi # <==== hack
# ^^^ we patch get_call_conv() so that the test also makes sense
# on Linux, because clibffi.get_call_conv() would always
# return FFI_DEFAULT_ABI on non-Windows platforms.
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit