Commits

Maciej Fijalkowski committed 9ce7939

rename confusing locs

Comments (0)

Files changed (5)

rpython/jit/backend/x86/assembler.py

 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,
-    RegLoc, StackLoc, ConstFloatLoc, ImmedLoc, AddressLoc, imm,
-    imm0, imm1, FloatImmedLoc, RawStackLoc, RawEspLoc)
+    RegLoc, FrameLoc, ConstFloatLoc, ImmedLoc, AddressLoc, imm,
+    imm0, imm1, FloatImmedLoc, RawEbpLoc, RawEspLoc)
 from rpython.rlib.objectmodel import we_are_translated, specialize
 from rpython.jit.backend.x86 import rx86, codebuf
 from rpython.jit.metainterp.resoperation import rop, ResOperation
         if isinstance(loc, RegLoc) and loc.is_xmm:
             self.mc.SUB_ri(esp.value, 8)   # = size of doubles
             self.mc.MOVSD_sx(0, loc.value)
-        elif WORD == 4 and isinstance(loc, StackLoc) and loc.get_width() == 8:
+        elif WORD == 4 and isinstance(loc, FrameLoc) and loc.get_width() == 8:
             # XXX evil trick
             self.mc.PUSH_b(loc.value + 4)
             self.mc.PUSH_b(loc.value)
         if isinstance(loc, RegLoc) and loc.is_xmm:
             self.mc.MOVSD_xs(loc.value, 0)
             self.mc.ADD_ri(esp.value, 8)   # = size of doubles
-        elif WORD == 4 and isinstance(loc, StackLoc) and loc.get_width() == 8:
+        elif WORD == 4 and isinstance(loc, FrameLoc) and loc.get_width() == 8:
             # XXX evil trick
             self.mc.POP_b(loc.value)
             self.mc.POP_b(loc.value + 4)
             self.mc.POP(loc)
 
     def regalloc_immedmem2mem(self, from_loc, to_loc):
-        # move a ConstFloatLoc directly to a StackLoc, as two MOVs
+        # move a ConstFloatLoc directly to a FrameLoc, as two MOVs
         # (even on x86-64, because the immediates are encoded as 32 bits)
         assert isinstance(from_loc, ConstFloatLoc)
         low_part  = rffi.cast(rffi.CArrayPtr(rffi.INT), from_loc.value)[0]
         high_part = rffi.cast(rffi.CArrayPtr(rffi.INT), from_loc.value)[1]
         low_part  = intmask(low_part)
         high_part = intmask(high_part)
-        if isinstance(to_loc, RawStackLoc):
+        if isinstance(to_loc, RawEbpLoc):
             self.mc.MOV32_bi(to_loc.value,     low_part)
             self.mc.MOV32_bi(to_loc.value + 4, high_part)
         else:
             for src, dst in singlefloats:
                 if isinstance(dst, RawEspLoc):
                     # XXX too much special logic
-                    if isinstance(src, RawStackLoc):
+                    if isinstance(src, RawEbpLoc):
                         self.mc.MOV32(X86_64_SCRATCH_REG, src)
                         self.mc.MOV32(dst, X86_64_SCRATCH_REG)
                     else:
         assert isinstance(resloc, RegLoc)
         if isinstance(loc, RegLoc):
             self.mc.MOVD_rx(resloc.value, loc.value)
-        elif isinstance(loc, StackLoc):
+        elif isinstance(loc, FrameLoc):
             self.mc.MOV_rb(resloc.value, loc.value)
         else:
             not_implemented("llong_to_int: %s" % (loc,))
         elif tmploc is not None: # if both are None, just ignore
             ofs = self.cpu.get_ofs_of_frame_field('jf_guard_exc')
             mc.MOV(tmploc, heap(self.cpu.pos_exc_value()))
-            mc.MOV(RawStackLoc(ofs), tmploc)
+            mc.MOV(RawEbpLoc(ofs), tmploc)
         if exctploc is not None:
             assert exctploc.is_reg()
             mc.MOV(exctploc, heap(self.cpu.pos_exception()))
         else:
             assert tmploc is not None
             ofs = self.cpu.get_ofs_of_frame_field('jf_guard_exc')
-            mc.MOV(tmploc, RawStackLoc(ofs))
+            mc.MOV(tmploc, RawEbpLoc(ofs))
             mc.MOV_bi(ofs, 0)
             mc.MOV(heap(self.cpu.pos_exc_value()), tmploc)
         mc.MOV(heap(self.cpu.pos_exception()), exctploc)
 
     def new_stack_loc(self, i, pos, tp):
         base_ofs = self.cpu.get_baseofs_of_frame_field()
-        return StackLoc(i, get_ebp_ofs(base_ofs, i), tp)
+        return FrameLoc(i, get_ebp_ofs(base_ofs, i), tp)
 
     def setup_failure_recovery(self):
         self.failure_recovery_code = [0, 0, 0, 0]
         else:
             [fail_descr_loc] = arglocs
         ofs = self.cpu.get_ofs_of_frame_field('jf_descr')
-        self.mov(fail_descr_loc, RawStackLoc(ofs))
+        self.mov(fail_descr_loc, RawEbpLoc(ofs))
         arglist = op.getarglist()
         if arglist and arglist[0].type == REF:
             gcmap = self.gcmap_for_finish
                         argtypes=descr.get_arg_types(),
                         callconv=descr.get_call_conv())
 
-        if IS_X86_32 and isinstance(resloc, StackLoc) and resloc.type == FLOAT:
+        if IS_X86_32 and isinstance(resloc, FrameLoc) and resloc.type == FLOAT:
             # a float or a long long return
             if descr.get_result_type() == 'L':
                 self.mc.MOV_br(resloc.value, eax.value)      # long long
         return self.mc.get_relative_pos()
 
     def _call_assembler_patch_je(self, result_loc, je_location):
-        if IS_X86_32 and isinstance(result_loc, StackLoc) and result_loc.type == FLOAT:
+        if (IS_X86_32 and isinstance(result_loc, FrameLoc) and
+            result_loc.type == FLOAT):
             self.mc.FSTPL_b(result_loc.value)
         self.mc.JMP_l8(0) # jump to done, patched later
         jmp_location = self.mc.get_relative_pos()
     return AddressLoc(loc, imm0, 0, offset)
 
 def raw_stack(offset, type=INT):
-    return RawStackLoc(offset, type)
+    return RawEbpLoc(offset, type)
 
 def heap(addr):
     return AddressLoc(ImmedLoc(addr), imm0, 0, 0)

rpython/jit/backend/x86/jump.py

-import sys
-from rpython.tool.pairtype import extendabletype
+
 from rpython.jit.backend.x86.regloc import ImmediateAssemblerLocation
-from rpython.jit.backend.x86.regloc import RegLoc, StackLoc
 
 def remap_frame_layout(assembler, src_locations, dst_locations, tmpreg):
     pending_dests = len(dst_locations)

rpython/jit/backend/x86/regalloc.py

         self.base_ofs = base_ofs
     
     def frame_pos(self, i, box_type):
-        return StackLoc(i, get_ebp_ofs(self.base_ofs, i), box_type)
+        return FrameLoc(i, get_ebp_ofs(self.base_ofs, i), box_type)
 
     @staticmethod
     def frame_size(box_type):
 
     @staticmethod
     def get_loc_index(loc):
-        assert isinstance(loc, StackLoc)
+        assert isinstance(loc, FrameLoc)
         return loc.position
 
 if WORD == 4:
                 gcmap[val // WORD // 8] |= r_uint(1) << (val % (WORD * 8))
         for box, loc in self.fm.bindings.iteritems():
             if box.type == REF:
-                assert isinstance(loc, StackLoc)
+                assert isinstance(loc, FrameLoc)
                 val = loc.position + JITFRAME_FIXED_SIZE
                 gcmap[val // WORD // 8] |= r_uint(1) << (val % (WORD * 8))
         for i in range(len(gcmap)):
             box = jump_op.getarg(i)
             if isinstance(box, Box):
                 loc = arglocs[i]
-                if isinstance(loc, StackLoc):
+                if isinstance(loc, FrameLoc):
                     self.fm.hint_frame_locations[box] = loc
 
     def consider_jump(self, op):

rpython/jit/backend/x86/regloc.py

 
 #
 # This module adds support for "locations", which can be either in a Const,
-# or a RegLoc or a StackLoc.  It also adds operations like mc.ADD(), which
+# or a RegLoc or a FrameLoc.  It also adds operations like mc.ADD(), which
 # take two locations as arguments, decode them, and calls the right
 # mc.ADD_rr()/ADD_rb()/ADD_ri().
 #
     def get_position(self):
         raise NotImplementedError # only for stack
 
-class RawStackLoc(AssemblerLocation):
+class RawEbpLoc(AssemblerLocation):
     """ The same as stack location, but does not know it's position.
     Mostly usable for raw frame access
     """
         return self.type == FLOAT
 
     def add_offset(self, ofs):
-        return RawStackLoc(self.value + ofs)
+        return RawEbpLoc(self.value + ofs)
 
     def is_stack(self):
         return True
     def is_float(self):
         return self.type == FLOAT
 
-class StackLoc(RawStackLoc):
+class FrameLoc(RawEbpLoc):
     _immutable_ = True
     
     def __init__(self, position, ebp_offset, type):

rpython/jit/backend/x86/test/test_jump.py

 
     def regalloc_immedmem2mem(self, from_loc, to_loc):
         assert isinstance(from_loc, ConstFloatLoc)
-        assert isinstance(to_loc,   StackLoc)
+        assert isinstance(to_loc,   FrameLoc)
         self.ops.append(('immedmem2mem', from_loc, to_loc))
 
     def got(self, expected):
                 continue
             assert len(op1) == len(op2)
             for x, y in zip(op1, op2):
-                if isinstance(x, StackLoc) and isinstance(y, MODRM):
+                if isinstance(x, FrameLoc) and isinstance(y, MODRM):
                     assert x.byte == y.byte
                     assert x.extradata == y.extradata
                 else:
         while len(result) < count:
             x = fn()
             keys = [x._getregkey()]
-            if isinstance(x, StackLoc) and x.get_width() > WORD:
+            if isinstance(x, FrameLoc) and x.get_width() > WORD:
                 keys.append(keys[0] + WORD)
             for key in keys:
                 if key in seen:
                     regs2[loc.value] = newvalue
                 else:
                     regs1[loc.value] = 'value-int-%d' % i
-            elif isinstance(loc, StackLoc):
+            elif isinstance(loc, FrameLoc):
                 stack[loc.value] = 'value-width%d-%d' % (loc.get_width(), i)
                 if loc.get_width() > WORD:
                     stack[loc.value+WORD] = 'value-hiword-%d' % i
                     return regs2[loc.value]
                 else:
                     return regs1[loc.value]
-            if isinstance(loc, StackLoc):
+            if isinstance(loc, FrameLoc):
                 got = stack[loc.value]
                 if loc.get_width() > WORD:
                     got = (got, stack[loc.value+WORD])
                     regs2[loc.value] = newvalue
                 else:
                     regs1[loc.value] = newvalue
-            elif isinstance(loc, StackLoc):
+            elif isinstance(loc, FrameLoc):
                 if loc.get_width() > WORD:
                     newval1, newval2 = newvalue
                     stack[loc.value] = newval1
                     assert isinstance(dst, RegLoc)
                     assert dst.is_xmm
                 else:
-                    assert isinstance(src, (RegLoc, StackLoc, ImmedLoc))
-                    assert isinstance(dst, (RegLoc, StackLoc))
-                    assert not (isinstance(src, StackLoc) and
-                                isinstance(dst, StackLoc))
+                    assert isinstance(src, (RegLoc, FrameLoc, ImmedLoc))
+                    assert isinstance(dst, (RegLoc, FrameLoc))
+                    assert not (isinstance(src, FrameLoc) and
+                                isinstance(dst, FrameLoc))
                 write(dst, read(src))
             elif op[0] == 'push':
                 src, = op[1:]
-                assert isinstance(src, (RegLoc, StackLoc))
+                assert isinstance(src, (RegLoc, FrameLoc))
                 extrapushes.append(read(src))
             elif op[0] == 'pop':
                 dst, = op[1:]
-                assert isinstance(dst, (RegLoc, StackLoc))
+                assert isinstance(dst, (RegLoc, FrameLoc))
                 write(dst, extrapushes.pop())
             elif op[0] == 'immedmem2mem':
                 src, dst = op[1:]
                 assert isinstance(src, ConstFloatLoc)
-                assert isinstance(dst, StackLoc)
+                assert isinstance(dst, FrameLoc)
                 write(dst, read(src, 8))
             else:
                 assert 0, "unknown op: %r" % (op,)
         def regalloc_immedmem2mem(self, x, y):
             print "?????????????????????????"
     def main():
-        srclocs = [StackLoc(9999, x, 'i') for x,y in CASE]
-        dstlocs = [StackLoc(9999, y, 'i') for x,y in CASE]
+        srclocs = [FrameLoc(9999, x, 'i') for x,y in CASE]
+        dstlocs = [FrameLoc(9999, y, 'i') for x,y in CASE]
         remap_frame_layout(FakeAssembler(), srclocs, dstlocs, eax)
     # it works when run directly
     main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.