[pypy-dev] PPC JIT test_load_and_store()

David Edelsohn dje.gcc at gmail.com
Thu Aug 18 16:50:43 CEST 2011


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


More information about the pypy-dev mailing list