Re: [pypy-dev] PPC JIT test_load_and_store()
To be more concrete, the current test code is def test_load_and_store(self): a = PPCBuilder() word1 = 1000 word2 = 2000 a.load_word(10, word1) # load constant 1000 into r10 a.load_word(11, word2) # load constant 2000 into r11 a.stw(10, 8, 0)# store r10 into memory at address in r8 a.stw(11, 9, 0)# store r11 into memory at address in r9 a.lwz(4, 8, 0) # load r4 from memory at address in r8 a.lwz(5, 9, 0) # load r5 from memory at address in r9 a.add(3, 4, 5) # r3 = r4 + r5 a.blr() f = a.assemble() assert f() == word1 + word2 r8 and r9 are not initialized and point to whatever locations those registers happen to hold. In libffi for PPC, r8 happens to hold the arg pointer, but there are no arguments and r9 is arbitrary. In both PPC32 and PPC64 libffi, r7 points to the function address, so a version that overwrites the beginning of the code produced by the JIT and already executed is a.stw(10, 7, 0) a.stw(11, 7, 4) a.lwz(4, 7, 0) a.lwz(5, 7, 4) Thanks, David ___ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
Re: [pypy-dev] PPC JIT test_load_and_store()
Hi David, On Thu, Aug 18, 2011 at 4:50 PM, David Edelsohn dje@gmail.com wrote: r8 and r9 are not initialized and point to whatever locations those registers happen to hold. I think that the test is just wrong... You need to load explicitly the address of some CArray in r8 and r9, for example with: p = lltype.malloc(rffi.CArray(lltype.Signed), 2) a.load_word(8, rffi.cast(lltype.Signed, p)) a.load_word(9, rffi.cast(lltype.Signed, p) + (4-or-8)) A bientôt, Armin. ___ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
Re: [pypy-dev] PPC JIT test_load_and_store()
On 08/18/2011 04:50 PM, David Edelsohn wrote: To be more concrete, the current test code is def test_load_and_store(self): a = PPCBuilder() word1 = 1000 word2 = 2000 a.load_word(10, word1) # load constant 1000 into r10 a.load_word(11, word2) # load constant 2000 into r11 a.stw(10, 8, 0)# store r10 into memory at address in r8 a.stw(11, 9, 0)# store r11 into memory at address in r9 a.lwz(4, 8, 0) # load r4 from memory at address in r8 a.lwz(5, 9, 0) # load r5 from memory at address in r9 a.add(3, 4, 5) # r3 = r4 + r5 a.blr() f = a.assemble() assert f() == word1 + word2 r8 and r9 are not initialized and point to whatever locations those registers happen to hold. In libffi for PPC, r8 happens to hold the arg pointer, but there are no arguments and r9 is arbitrary. In both PPC32 and PPC64 libffi, r7 points to the function address, so a version that overwrites the beginning of the code produced by the JIT and already executed is a.stw(10, 7, 0) a.stw(11, 7, 4) a.lwz(4, 7, 0) a.lwz(5, 7, 4) Thanks, David Hi David, thank you for telling me about the broken test. I fixed the problem, as Armin recommended, and also added your pathh no. 5 to the code. Tomorrow I will fix the broken import paths. Best regards, Sven ___ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev