Path: utzoo!attcan!uunet!peregrine!elroy!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!vsi1!wyse!mips!earl@wright.mips.com From: earl@wright.mips.com (Earl Killian) Newsgroups: comp.arch Subject: Re: object <-> object translation (was Re: VLIW) Message-ID: <8690@wright.mips.COM> Date: 22 Nov 88 21:59:33 GMT References: <3386@pt.cs.cmu.edu> <74435@sun.uucp> <70@armada.UUCP> <550@m3.mfci.UUCP> <2152@ficc.uu.net> <552@m3.mfci.UUCP> <76500@sun.uucp> <10643@tekecs.TEK.COM> <8523@wright.mips.COM> <11560@cup.portal.com> Sender: earl@mips.COM Organization: MIPS Computer Systems, Sunnyvale CA Lines: 36 In-reply-to: bcase@cup.portal.com (Brian bcase Case) In article <11560@cup.portal.com>, bcase@cup (Brian bcase Case) writes: >Earl, you translated MIPS *binary* code to VAX and MIPS *binary* code >to MIPS? I thought it was MIPS assembly code.... In both cases it was MIPS object code, fully linked, ready to run. MIPS object code is much easier to deal with than assembler: no parsing! It's also very convenient this way. You want to profile nroff? It's as simple as: # instrument installed binary pixie /usr/bin/nroff -o nroff.pixie # takes less than one second of cpu time ./nroff.pixie nroffinput > nroffouput # takes about 2x longer than running unpixified nroff prof nroff > nroff.prof # you're done which is a lot easier than recompiling everything -p, and having -p libraries of everything on hand. >How did you deal with the jump tables associated with switch statements? >What strategy did you use for other indirect branches (e.g., returns)? Both versions used table lookup. To jump to a computed address, use the address as an index into a table to get the address of the translation. One table entry for every instruction, so the table is identically the size of the original text section, so it's no big deal. This technique breaks down for sparse address spaces. Fortunately (for this application), Unix address spaces are pretty constrained. Another technique would be to use relocation information in the binary. pixie works without relocation, at the cost of the table. -- UUCP: {ames,decwrl,prls,pyramid}!mips!earl USPS: MIPS Computer Systems, 930 Arques Ave, Sunnyvale CA, 94086