390 likes | 618 Views
Binary Translation. Cambio di architettura. Problemi. E il vecchio software?. Costo di produzione software (tempo e denaro). Soluzioni. Compilare il vecchio sorgente con nuovi compilatori Emulazione hardware Emulazione/interpretazione software Binary translation. Binary translation.
E N D
Problemi E il vecchio software?
Soluzioni • Compilare il vecchio sorgente con nuovi compilatori • Emulazione hardware • Emulazione/interpretazione software • Binary translation
Binary translation • Nessuna ricompilazione
Binary translation • Nessuna ricompilazione • Indipendenza dal sorgente
Binary translation • Nessuna ricompilazione • Indipendenza dal sorgente • Risparmio di tempo
Binary translation • Nessuna ricompilazione • Indipendenza dal sorgente • Risparmio di tempo • Ottimizzazione
Binary translation • Nessuna ricompilazione • Indipendenza dal sorgente • Risparmio di tempo • Ottimizzazione • Risparmio sui test
Binary translation • Nessuna ricompilazione • Indipendenza dal sorgente • Risparmio di tempo • Ottimizzazione • Risparmio sui test • Nessun disagio per gli utenti
Binary translation • Nessuna ricompilazione • Indipendenza dal sorgente • Risparmio di tempo • Ottimizzazione • Risparmio sui test • Nessun disagio per gli utenti • Distribuzione multipiattaforma
Difficoltà • Simili a disassembler e decompilers • Problema della terminazione • Problema nella staticità
Esempio: dcc void main () { int loc1; int loc2; int loc3; int loc4; printf ("Input number of iterations: "); scanf ("%d", &loc1); loc3 = 1; while ((loc3 <= loc1)) { printf ("Input number:"); scanf ("%d", &loc2); loc4 = proc_1 (loc2); printf ("fibonacci(%d) = %u\n", loc2, loc4); loc3 = (loc3 + 1); } /* end of while */ exit(0); }
Esempio: REC main() { /* unknown */ void ebx; /* unknown */ void esi; /* unknown */ void Vfffffffc; (save)"Input number: "; printf(); (save) & Vfffffffc; (save)"%d"; scanf(); ebx = Vfffffffc; esp = esp + 12; if(ebx > 1) { esi = fib(ebx - 1); eax = fib(ebx - 2) + esi; } else { eax = ebx; } printf("fibonacci(%d) = %d\n", Vfffffffc, eax); esp = ebp - 12; return(0); }
Esempio: Boomerang Output di The Boomerang: void main() { int local0; local0 = proc1(3, 4) ; local0 = printf("%i\n", local0) ; return ; } int proc1(int arg1, int arg2) { return arg2+arg1; } Esempio di codice: int somma(int a, int b) { return a + b; } int main() { printf("%i\n", somma(3, 4)); }
MIMIC (Ibm 1987) • Emulatore • IBM System/370 IBM RT PC • Tecniche di caching • Fattore di espansione 1:4 (non 1:100)
Accelerator (Tandem 1992) • Traduttore binario • TNS CISC TNS RISC • 1% di interpretazione • Codice tradotto più veloce (5-8X)
Flashport (AT&T 1994) • Set generale di piattaforme • Intervento utente • Da una settimana a sei mesi di computazione
Tibbit (1995) • Motorola 68000 IBM RS/6000, AIX 3.2 • Traduzione applicazioni real-time tra processori con velocità differenti
Digital (anni 90) • VAX, MIPS, SPARC Alpha • VEST, Freeport express • Ore di computazione
FX!32 (Digital 1996) • Ibrido: emulatore/binary translator • WinNT(32bit) x86 WinNT(64bit) Alpha
NJMC (1999) • New Jersey Machine-Code Toolkit • Indipendente dalla macchina • Aiuta a scrivere parsers e debuggers • Introduce il Register Transfer Language (RTL)
Disassembler, generazione 1-2 • Dcc: 860 linee in più giorni • NJMC: 208 linee in poche ore
Aries (HP, 2000) • PA-RISC ia64 • all user-level applications
Futuro Aries(PA-RISC/ia64) Cindy ZhengCarol Thompson
Futuro Aries(PA-RISC/ia64) Cindy ZhengCarol Thompson HP-UXWOW64
Futuro Actually, being able to run IA-32 code on IA-64 HP-UX machines is not a primary goal for HP. Instead, it is a positive side effect of a software partitioning solution that HP is developing to allow multiple operating systems to share CPUs and other resources. IA-64 will never execute 32-bit code as well as a dedicated processor
Bibliografia (1) Libri: • "Compilers - Principles, Techniques and Tools", Aho, Sethi, Ullman, • "Advanced Compiler Design & Implementation", Steven Muchnick • "How debuggers work - Algorithms, Data Structures, and Architecture", Jonathan Rosemberg • “A Conceptual Foundation for Software Re-Engineering”,E. J. Byrne Links: • http://www.mpowernet.com/kamal/www.fravia.org • http://www.quequero.tk • http://www.program-transformation.org
Bibliografia (2) • “Transparent Execution, No Recompilation”Cindy ZhengCarol Thompson • “Running IA-32 Code on IA-64” by Christophe de Dinechin • “Binary Translation: Static, Dynamic, Retargetable?*”, C. Cifuentes, V. Malhotra