[pypy-svn] r33192 - in pypy/dist/pypy/jit/codegen/i386: . test
pedronis at codespeak.net
pedronis at codespeak.net
Wed Oct 11 22:03:35 CEST 2006
Author: pedronis
Date: Wed Oct 11 22:03:31 2006
New Revision: 33192
Modified:
pypy/dist/pypy/jit/codegen/i386/rgenop.py
pypy/dist/pypy/jit/codegen/i386/test/test_genc_promotion.py
Log:
(arre, pedronis)
Try at doing proper stack aligment for calls on x86 darwin.
Keep ptr backend constants alive py putting them in a list as opaque GCREFs.
Addresses are considered atomic by backends and our boehm policy so they will not keep things alive!
Modified: pypy/dist/pypy/jit/codegen/i386/rgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/rgenop.py (original)
+++ pypy/dist/pypy/jit/codegen/i386/rgenop.py Wed Oct 11 22:03:31 2006
@@ -1,3 +1,4 @@
+import sys
from pypy.rpython.objectmodel import specialize
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.jit.codegen.i386.ri386 import *
@@ -8,7 +9,10 @@
from pypy.rpython.annlowlevel import llhelper
WORD = 4
-
+if sys.platform == 'darwin':
+ CALL_ALIGN = 4
+else:
+ CALL_ALIGN = 1
class Var(GenVar):
@@ -304,6 +308,12 @@
return self.returnvar(eax)
def genop_call(self, sigtoken, gv_fnptr, args_gv):
+ MASK = CALL_ALIGN-1
+ final_depth = self.stackdepth + len(args_gv)
+ delta = (final_depth+MASK)&~MASK-final_depth
+ if delta:
+ self.mc.SUB(esp, imm(delta*WORD))
+ self.stackdepth += delta
for i in range(len(args_gv)-1, -1, -1):
gv_arg = args_gv[i]
if gv_arg is not None:
@@ -813,12 +823,13 @@
def show_incremental_progress(self):
pass
+
class RI386GenOp(AbstractRGenOp):
from pypy.jit.codegen.i386.codebuf import MachineCodeBlock
def __init__(self):
self.mcs = [] # machine code blocks where no-one is currently writing
- self.keepalive_addrs = []
+ self.keepalive_gc_refs = []
def open_mc(self):
if self.mcs:
@@ -851,13 +862,13 @@
def genconst(self, llvalue):
T = lltype.typeOf(llvalue)
if T is llmemory.Address:
- self.keepalive_addrs.append(llvalue)
return AddrConst(llvalue)
elif isinstance(T, lltype.Primitive):
return IntConst(lltype.cast_primitive(lltype.Signed, llvalue))
elif isinstance(T, lltype.Ptr):
lladdr = llmemory.cast_ptr_to_adr(llvalue)
- self.keepalive_addrs.append(lladdr)
+ if T.TO._gckind == 'gc':
+ self.keepalive_gc_refs.append(lltype.cast_opaque_ptr(llmemory.GCREF, llvalue))
return AddrConst(lladdr)
else:
assert 0, "XXX not implemented"
@@ -917,7 +928,7 @@
if isinstance(T, lltype.Primitive):
return lltype.Signed
elif isinstance(T, lltype.Ptr):
- return llmemory.Address
+ return llmemory.GCREF
else:
assert 0, "XXX not implemented"
Modified: pypy/dist/pypy/jit/codegen/i386/test/test_genc_promotion.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/test/test_genc_promotion.py (original)
+++ pypy/dist/pypy/jit/codegen/i386/test/test_genc_promotion.py Wed Oct 11 22:03:31 2006
@@ -10,6 +10,3 @@
def test_many_promotions(self):
py.test.skip("in-progress")
-
- def test_more_promotes(self):
- py.test.skip("in-progress :(")
More information about the Pypy-commit
mailing list