Author: edelsohn Branch: ppc-jit-backend Changeset: r56239:9d7776125dff Date: 2012-07-19 15:42 -0400 http://bitbucket.org/pypy/pypy/changeset/9d7776125dff/
Log: Merge. diff --git a/pypy/jit/backend/arm/opassembler.py b/pypy/jit/backend/arm/opassembler.py --- a/pypy/jit/backend/arm/opassembler.py +++ b/pypy/jit/backend/arm/opassembler.py @@ -1336,6 +1336,7 @@ emit_op_convert_longlong_bytes_to_float = gen_emit_unary_float_op('longlong_bytes_to_float', 'VMOV_cc') def emit_op_read_timestamp(self, op, arglocs, regalloc, fcond): + assert 0, 'not supported' tmp = arglocs[0] res = arglocs[1] self.mc.MRC(15, 0, tmp.value, 15, 12, 1) diff --git a/pypy/jit/backend/arm/test/test_basic.py b/pypy/jit/backend/arm/test/test_basic.py new file mode 100644 --- /dev/null +++ b/pypy/jit/backend/arm/test/test_basic.py @@ -0,0 +1,35 @@ +import py +from pypy.jit.metainterp.test import test_ajit +from pypy.rlib.jit import JitDriver +from pypy.jit.backend.arm.test.support import JitARMMixin + +class TestBasic(JitARMMixin, test_ajit.BaseLLtypeTests): + # for the individual tests see + # ====> ../../../metainterp/test/test_ajit.py + def test_bug(self): + jitdriver = JitDriver(greens = [], reds = ['n']) + class X(object): + pass + def f(n): + while n > -100: + jitdriver.can_enter_jit(n=n) + jitdriver.jit_merge_point(n=n) + x = X() + x.arg = 5 + if n <= 0: break + n -= x.arg + x.arg = 6 # prevents 'x.arg' from being annotated as constant + return n + res = self.meta_interp(f, [31], enable_opts='') + assert res == -4 + + def test_r_dict(self): + # a Struct that belongs to the hash table is not seen as being + # included in the larger Array + py.test.skip("issue with ll2ctypes") + + def test_free_object(self): + py.test.skip("issue of freeing, probably with ll2ctypes") + + def test_read_timestamp(self): + py.test.skip("The JIT on ARM does not support read_timestamp") diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py --- a/pypy/jit/backend/ppc/ppc_assembler.py +++ b/pypy/jit/backend/ppc/ppc_assembler.py @@ -975,7 +975,6 @@ self.mc = None self._regalloc = None assert self.datablockwrapper is None - self.stack_in_use = False self.max_stack_params = 0 def _walk_operations(self, operations, regalloc): @@ -1247,37 +1246,41 @@ """Pushes the value stored in loc to the stack Can trash the current value of SCRATCH when pushing a stack loc""" + if loc.is_imm() or loc.is_imm_float(): + assert 0, "not implemented yet" + self.mc.addi(r.SP.value, r.SP.value, -WORD) # decrease stack pointer + assert IS_PPC_64, 'needs to updated for ppc 32' if loc.is_stack(): # XXX this code has to be verified - assert not self.stack_in_use - target = StackLocation(self.ENCODING_AREA // WORD) # write to ENCODING AREA - self.regalloc_mov(loc, target) - self.stack_in_use = True + with scratch_reg(self.mc): + self.regalloc_mov(loc, r.SCRATCH) + # push value + self.mc.store(r.SCRATCH.value, r.SP.value, 0) elif loc.is_reg(): - self.mc.addi(r.SP.value, r.SP.value, -WORD) # decrease stack pointer # push value self.mc.store(loc.value, r.SP.value, 0) elif loc.is_fp_reg(): self.mc.addi(r.SP.value, r.SP.value, -WORD) # decrease stack pointer # push value self.mc.stfd(loc.value, r.SP.value, 0) - elif loc.is_imm(): - assert 0, "not implemented yet" - elif loc.is_imm_float(): - assert 0, "not implemented yet" else: raise AssertionError('Trying to push an invalid location') def regalloc_pop(self, loc): """Pops the value on top of the stack to loc. Can trash the current value of SCRATCH when popping to a stack loc""" + assert IS_PPC_64, 'needs to updated for ppc 32' if loc.is_stack(): # XXX this code has to be verified - assert self.stack_in_use - from_loc = StackLocation(self.ENCODING_AREA // WORD) # read from ENCODING AREA - self.regalloc_mov(from_loc, loc) - self.stack_in_use = False + with scratch_reg(self.mc): + # pop value + if IS_PPC_32: + self.mc.lwz(r.SCRATCH.value, r.SP.value, 0) + else: + self.mc.ld(r.SCRATCH.value, r.SP.value, 0) + self.mc.addi(r.SP.value, r.SP.value, WORD) # increase stack pointer + self.regalloc_mov(r.SCRATCH, loc) elif loc.is_reg(): # pop value if IS_PPC_32: diff --git a/pypy/jit/backend/ppc/test/test_regalloc_2.py b/pypy/jit/backend/ppc/test/test_regalloc_2.py --- a/pypy/jit/backend/ppc/test/test_regalloc_2.py +++ b/pypy/jit/backend/ppc/test/test_regalloc_2.py @@ -719,5 +719,5 @@ """ loop = self.interpret(ops, [6.0, 7.0, 0.0]) assert self.getfloat(0) == 42.0 - assert 0 - import pdb; pdb.set_trace() + assert self.getfloat(1) == 0 + assert self.getfloat(2) == 6.0 diff --git a/pypy/jit/backend/test/test_frame_size.py b/pypy/jit/backend/test/test_frame_size.py deleted file mode 100644 --- a/pypy/jit/backend/test/test_frame_size.py +++ /dev/null @@ -1,100 +0,0 @@ -import py, sys, random, os, struct, operator -from pypy.jit.metainterp.history import (AbstractFailDescr, - AbstractDescr, - BasicFailDescr, - BoxInt, Box, BoxPtr, - LoopToken, - ConstInt, ConstPtr, - BoxObj, Const, - ConstObj, BoxFloat, ConstFloat) -from pypy.jit.metainterp.resoperation import ResOperation, rop -from pypy.jit.metainterp.typesystem import deref -from pypy.jit.tool.oparser import parse -from pypy.rpython.lltypesystem import lltype, llmemory, rstr, rffi, rclass -from pypy.rpython.ootypesystem import ootype -from pypy.rpython.annlowlevel import llhelper -from pypy.rpython.llinterp import LLException -from pypy.jit.codewriter import heaptracker, longlong -from pypy.jit.codewriter.effectinfo import EffectInfo -from pypy.rlib.rarithmetic import intmask -from pypy.jit.backend.detect_cpu import getcpuclass - -CPU = getcpuclass() - -class TestFrameSize(object): - cpu = CPU(None, None) - cpu.setup_once() - - looptoken = None - - def f1(x): - return x+1 - - F1PTR = lltype.Ptr(lltype.FuncType([lltype.Signed], lltype.Signed)) - f1ptr = llhelper(F1PTR, f1) - f1_calldescr = cpu.calldescrof(F1PTR.TO, F1PTR.TO.ARGS, - F1PTR.TO.RESULT, EffectInfo.MOST_GENERAL) - namespace = locals().copy() - type_system = 'lltype' - - def parse(self, s, boxkinds=None): - return parse(s, self.cpu, self.namespace, - type_system=self.type_system, - boxkinds=boxkinds) - - def interpret(self, ops, args, run=True): - loop = self.parse(ops) - self.cpu.compile_loop(loop.inputargs, loop.operations, loop.token) - for i, arg in enumerate(args): - if isinstance(arg, int): - self.cpu.set_future_value_int(i, arg) - elif isinstance(arg, float): - self.cpu.set_future_value_float(i, arg) - else: - assert isinstance(lltype.typeOf(arg), lltype.Ptr) - llgcref = lltype.cast_opaque_ptr(llmemory.GCREF, arg) - self.cpu.set_future_value_ref(i, llgcref) - if run: - self.cpu.execute_token(loop.token) - return loop - - def getint(self, index): - return self.cpu.get_latest_value_int(index) - - def getfloat(self, index): - return self.cpu.get_latest_value_float(index) - - def getints(self, end): - return [self.cpu.get_latest_value_int(index) for - index in range(0, end)] - - def getfloats(self, end): - return [self.cpu.get_latest_value_float(index) for - index in range(0, end)] - - def getptr(self, index, T): - gcref = self.cpu.get_latest_value_ref(index) - return lltype.cast_opaque_ptr(T, gcref) - - - - def test_call_loop_from_loop(self): - - large_frame_loop = """ - [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14] - i15 = call(ConstClass(f1ptr), i0, descr=f1_calldescr) - finish(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15) - """ - large = self.interpret(large_frame_loop, range(15), run=False) - self.namespace['looptoken'] = large.token - assert self.namespace['looptoken']._arm_func_addr != 0 - small_frame_loop = """ - [i0] - i1 = int_add(i0, 1) - jump(i1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, descr=looptoken) - """ - - self.interpret(small_frame_loop, [110]) - expected = [111, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 112] - assert self.getints(16) == expected - _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit