RVM
  1. RVM
  2. RVM-262

Improving typing of PPC VM_Assembler registers

    Details

    • Number of attachments :
      0

      Description

      Currently in the PPC assembler the type of a register is an int and the type of a displacement is an int. In the Intel compiler the registers are bytes, scales are shorts and the displacements ints. It is all too easy with the PPC assembler to pass a register as a displacement or vice versa. For example here are the definitions of STW and STWX:

      public final void emitSTW (int RS, int D, int RA)
      public final void emitSTWX (int RS, int RA, int RB)

      creating the statement:

      asm.emitSTW(T0, T1, T2)

      would not create any warnings (the 2nd argument probably means this should be an STWX) whereas had the definition of the registers been bytes (or even enums) the developer could have been spared some head scratching.

      This replaces SF RFE tracker 1658972.

        Issue Links

          Activity

          Hide
          Ian Rogers added a comment -

          r13833 added stronger typing to the Intel assembler's emit methods. By using a common interface of Register, operations for loading the TIB from the object model could avoid conversion to an integer and then back into an enumeration. That is:

          baselineEmitLoadTIB(VM_Assembler asm, int dest, int object)

          where dest and object are registers encoded as an int, could become:

          baselineEmitLoadTIB(VM_Assembler asm, Register dest, Register object)

          where Register is an interface common to all enumerations implementing registers.

          Show
          Ian Rogers added a comment - r13833 added stronger typing to the Intel assembler's emit methods. By using a common interface of Register, operations for loading the TIB from the object model could avoid conversion to an integer and then back into an enumeration. That is: baselineEmitLoadTIB(VM_Assembler asm, int dest, int object) where dest and object are registers encoded as an int, could become: baselineEmitLoadTIB(VM_Assembler asm, Register dest, Register object) where Register is an interface common to all enumerations implementing registers.

            People

            • Assignee:
              Unassigned
              Reporter:
              Ian Rogers
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: