
Introduction The language Compiler Benchmark Future Conclusion Lisaac Efficient compilation strategy for object-oriented languages under the closed-world assumption Benoˆıt Sonntag – [email protected] http://www.lisaac.org Introduction The language Compiler Benchmark Future Conclusion History : Lisaac for IsaacOOS Language The futur... Lisaac In the past... Prototype based Object C language Oriented Language ⇓ ⇓ Unix system IsaacOOS Prototype Object Operating System Introduction The language Compiler Benchmark Future Conclusion Let them sink in a bigger box ? Introduction The language Compiler Benchmark Future Conclusion High-level vs Hardware Object Oriented for Hardware Software / High-Level / Expressivity Self Eiffel Lisaac Java C ASM Hardware support Introduction The language Compiler Benchmark Future Conclusion Class vs Prototype (1/3) Class Instance 1 Squeleton 1 Object (=class) Prototype Clone 1 Object prototype 1 other Object (=the One) Introduction The language Compiler Benchmark Future Conclusion Class vs Prototype (2/3) Prototype Class Class A A object (Prototype or not) B Instance 1 Object with A and B definition B.Clone Class B 1 other Object B object (Prototype or not) Introduction The language Compiler Benchmark Future Conclusion Class vs Prototype (3/3) Dynamic inheritance XOR Introduction The language Compiler Benchmark Future Conclusion Example : Hello world! hello.li Section Header + name := HELLO; Section Public − main < − ( (1+2).print; ’A’.print; ‘‘Hello world !\n’’.print; ); Command line : lisaac hello.li Executable result : hello (ou hello.exe for windows) Introduction The language Compiler Benchmark Future Conclusion Slot identifier − qsort tab:COLLECTION from low:INTEGER to high:INTEGER ← ( + i,j:INTEGER; + x,y:OBJECT; i := low; j := high; x := tab.item ((i + j)>> 1); { ... (i <= j).if { tab.swap j and i; ... }; }.do while {i <= j}; (low < j).if { qsort tab from low to j; }; (i < high).if { qsort tab from i to high; }; ); Introduction The language Compiler Benchmark Future Conclusion Slot identifier − qsort tab:COLLECTION from low:INTEGER to high:INTEGER ← ( + i,j:INTEGER; + x,y:OBJECT; i := low; j := high; x := tab.item ((i + j)>> 1); { ... (i <= j).if { tab.swap j and i; ... }; }.do while {i <= j}; (low < j).if { qsort tab from low to j; }; (i < high).if { qsort tab from i to high; }; ); Introduction The language Compiler Benchmark Future Conclusion Slot identifier: if − qsort tab:COLLECTION from low:INTEGER to high:INTEGER ← ( + i,j:INTEGER; + x,y:OBJECT; i := low; j := high; x := tab.item ((i + j)>> 1); { ... (i <= j). if { tab.textcolorblueswap j and i; ... } ; }.do while {i <= j}; (low < j).if { qsort tab from low to j; }; (i < high).if { qsort tab from i to high; }; ); Introduction The language Compiler Benchmark Future Conclusion Slot identifier : loop − qsort tab:COLLECTION from low:INTEGER to high:INTEGER ← ( + i,j:INTEGER; + x,y:OBJECT; i := low; j := high; x := tab.item ((i + j)>> 1); { ... (i <= j).if { tab.swap j and i; ... }; }.do while {i <= j}; (low < j).if { qsort tab from low to j; }; (i < high).if { qsort tab from i to high; }; ); Introduction The language Compiler Benchmark Future Conclusion If then else Introduction The language Compiler Benchmark Future Conclusion Assignment : code Example − color (r,g,b:INTEGER) < − ( true color:=r<<16|g<<8|b; ); ... ( color < − ( gray color := (r+g+b)/3; ); ); Introduction The language Compiler Benchmark Future Conclusion Inheritance : Dynamic once compute parent Once execution dynamic parent evaluation Section Inherit + parent:OBJECT < − ( + result:OBJECT; ...// compute my parent parent := result // my parent is a data now!!! ); Note The first lookup, the parent is dynamically defined The next lookup, the parent is a simple data value Introduction The language Compiler Benchmark Future Conclusion Multi-platform compiler Introduction The language Compiler Benchmark Future Conclusion Global analysis Java, C++: Classic technical Virtual Function Table (VFT) ⇒ Pointer of function ⇒ Indirect call ⇒ No optimization! Lisaac: Global analysis Transitive closure ⇒ Dispatch Binary Branch (DBB) ⇒ Static call ⇒ Full optimization! Introduction The language Compiler Benchmark Future Conclusion Global overview Lisaac source code First step Gathering the live code no yes Second step Stable ? Optimizing the with flow Closed Universe analysis no yes Third step Stable ? Back-end Optimizations Machine code / C code Introduction The language Compiler Benchmark Future Conclusion Dispatch Binary Branch (1/4) Introduction The language Compiler Benchmark Future Conclusion Dispatch Binary Branch (2/4) Introduction The language Compiler Benchmark Future Conclusion Dispatch Binary Branch (3/4) Introduction The language Compiler Benchmark Future Conclusion DBB: If then else Introduction The language Compiler Benchmark Future Conclusion Dispatch Binary Branch (4/4) Introduction The language Compiler Benchmark Future Conclusion Customization (1/6) Introduction The language Compiler Benchmark Future Conclusion Customization: Call #1 (2/6) Introduction The language Compiler Benchmark Future Conclusion Customization: Call #2 (3/6) Introduction The language Compiler Benchmark Future Conclusion Customization: Call #3 (4/6) Introduction The language Compiler Benchmark Future Conclusion Customization (5/6) Introduction The language Compiler Benchmark Future Conclusion Customization (6/6) Introduction The language Compiler Benchmark Future Conclusion Customization vs CPA number of arguments ATS 2 6 984 CPA 1,319 methods 124,903 methods 9 5 11352 20 4 74057 145 3 34326 526 2 3483 518 1 602 99 0 99 number of methods number of methods 600 500 400 300 200 100 0 10000 30000 50000 70000 20000 40000 60000 80000 Introduction The language Compiler Benchmark Future Conclusion Array: Pattern Matching control (1/2) used area supply area storage 0 1 2 3 4 5 6 7 size 4 NULL NC NC NC NC capacity 8 Obj_A Obj_B Obj_C Introduction The language Compiler Benchmark Future Conclusion Array: Pattern Matching control (2/2) Introduction The language Compiler Benchmark Future Conclusion As fast a C language Introduction The language Compiler Benchmark Future Conclusion Tiny test: Quicksort Introduction The language Compiler Benchmark Future Conclusion Compiler / Bootstrap Introduction The language Compiler Benchmark Future Conclusion Isaac OS benchmark Introduction The language Compiler Benchmark Future Conclusion MPEG2 benchmark Introduction The language Compiler Benchmark Future Conclusion Shootout benchmark (1/2) Introduction The language Compiler Benchmark Future Conclusion Shootout benchmark (2/2) Introduction The language Compiler Benchmark Future Conclusion Horizontal inheritance PARENT time Unpredictable (seconds) SmartEiffel method <- 40 abstract; 30 C++ inherit 20 CHILD_1 CHILD_2 CHILD_3 CHILD_N Lisaac method <- method <- method <- method <- 10 N "1".print; "2".print; "3".print; "n".print; 2 8 32 128 512 time Predictable 20 (seconds) Unpredictable MAIN Predictable MAIN C++ main <- main <- SmartEiffel Lisaac 1_000_000_000.times { 1_000_000_000.times { 10 array.item(random).method; array.item(random & 1).method; }; }; N 2 8 32 128 512 Introduction The language Compiler Benchmark Future Conclusion Vertical inheritance time Unpredictable PARENT 40 (seconds) SmartEiffel method <- "Hi".print; inherit 30 CHILD_1 crash inherit 20 C++ CHILD_2 Lisaac inherit 10 CHILD_3 N 2 8 32 128 512 CHILD_N time Predictable 20 (seconds) crash Unpredictable MAIN Predictable MAIN C++ SmartEiffel main <- main <- Lisaac 1_000_000_000.times { 1_000_000_000.times { 10 array.item(random).method; array.item(random & 1).method; }; }; N 2 8 32 128 512 Introduction The language Compiler Benchmark Future Conclusion Auto-cascading runtime Automatic cascading-calls detection. (seconds) 150 135 120 C++ MAIN 105 main <- 500_000_000.times { 90 receiver := array.item(random); 75 receiver.method1; 60 Lisaac receiver.method2; Same receiver receiver.method3; for all calls. 45 ... Dispatching code 30 ... is factorized. cascading receiver.methodN; 15 factor }; 1 2 3 4 5 6 7 8 9 10 N Introduction The language Compiler Benchmark Future Conclusion Call on self (this) PARENT time 256 method tmp <- m1 tmp <- (seconds) C++ tmp := self.m1(tmp) tmp + 1 tmp := self.m2(tmp) 128 . m2 tmp <- tmp := self.mN(tmp) tmp + 2 64 tmp . mN tmp <- 32 tmp + N 16 inherit 8 SmartEiffel CHILD_1 CHILD_2 CHILD_3 CHILD_N 4 m1 tmp <- m2 tmp <- m3 tmp <- mN tmp <- Lisaac tmp + 1+1 tmp + 2+2 tmp + 3+3 tmp + N+N 2 MAIN 1 main <- 200_000_000.times { tmp := array.item(random).method(tmp); 0.5 }; tmp.print; 0 N 24 8 16 32 64 128 256 Introduction The language Compiler Benchmark Future Conclusion Multiple inheritance (1/2) PARENT dta:INTEGER m1 tmp <- dta := dta + 1 method tmp <- tmp + dta tmp := self.m1(tmp) tmp := self.m2(tmp) m2 tmp <- . dta := dta + 2 tmp := self.mN(tmp) tmp + dta tmp . time mN tmp <- 32 (seconds) dta := dta + N tmp + dta 16 C++ Lisaac inherit 8 SmartEiffel CHILD_1 CHILD_2 CHILD_N dta1:INTEGER dta2:INTEGER dtaN:INTEGER 4 m1 tmp <- m2 tmp <- ... mN tmp <- dta1 := dta1 + 1 dta2 := dta2 + 1 dtaN := dtaN + 1 2 tmp + dta1 tmp + dta2 tmp + dtaN ... 1 0.5 INSTANCE_1 INSTANCE_2 ... INSTANCE_N 0 N MAIN 24 8 16 32 64 128 256 main <- 1_000_000.times { tmp := array.item(random).method(tmp); }; tmp.print; Introduction The language Compiler Benchmark Future Conclusion Multiple inheritance (2/2) N C++ SmartEiffel Lisaac C++ Lisaac 256 128 64 SmartEiffel 32 16 8 4 data segment text segment 2 128 64 32 16 8 4 2 1 256 128 64 32 16 8 4 2 1 0 0 1 2 4 8 16 32 64 128 256 1
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages50 Page
-
File Size-