on the use of ssa with scripting languages
play

On the use of SSA with Scripting Languages Paul Biggar and David - PowerPoint PPT Presentation

1. 18 min talking On the use of SSA with Scripting Languages 2. 12 min questions 3. Scripting langs are On the use of SSA with Scripting Languages Paul Biggar and David Gregg different Department of Computer Science and Statistics 4. Plan:


  1. 1. 18 min talking On the use of SSA with Scripting Languages 2. 12 min questions 3. Scripting langs are On the use of SSA with Scripting Languages Paul Biggar and David Gregg different Department of Computer Science and Statistics 4. Plan: Start with Trinity College Dublin motivating example Static Single-Assignment Form Seminar Paul Biggar and David Gregg 5. Plan: Introduce Autrans, France 27th April, 2009 weirdness 1 step Department of Computer Science and Statistics at a time Trinity College Dublin Static Single-Assignment Form Seminar Autrans, France 27th April, 2009 Trinity College Dublin 1

  2. Motivating Example Motivating Example function log ($printer, $prefix, $message) { 1 $fout = " $prefix : $message "; 2 1. This PHP snippet $printer->file_print ($fout); 3 4 can be ’intuitively’ $cout = " $prefix : $message " 5 function log ($printer, $prefix, $message) { 1 typed $printer->console_print ($cout); 6 } $fout = " $prefix : $message "; 7 2 $printer->file_print ($fout); 3 4 $cout = " $prefix : $message " 5 $printer->console_print ($cout); 6 } 7 Trinity College Dublin 2

  3. In SSA In SSA function log ($printer_0, $prefix_0, $message_0) { 1 $fout_0 = $prefix_0 . ": " . $message_0; 2 $printer_0->file_print ($fout_0); 1. Already in SSA - 3 4 only 1 assignment $cout_0 = $prefix_0 . ": " . $message_0; 5 function log ($printer_0, $prefix_0, $message_0) { 1 to each var $printer_0->console_print ($cout_0); 6 } $fout_0 = $prefix_0 . ": " . $message_0; 7 2 $printer_0->file_print ($fout_0); 3 4 $cout_0 = $prefix_0 . ": " . $message_0; 5 $printer_0->console_print ($cout_0); 6 } 7 Trinity College Dublin 3

  4. Value numbering Value numbering function log ($printer_0, $prefix_0, $message_0) { 1 $fout_0 = $prefix_0 . ": " . $message_0; 2 $printer_0->file_print ($fout_0); 3 4 $printer_0->console_print ($fout_0); 5 function log ($printer_0, $prefix_0, $message_0) { } 1 6 $fout_0 = $prefix_0 . ": " . $message_0; 2 $printer_0->file_print ($fout_0); 3 4 $printer_0->console_print ($fout_0); 5 } 6 Trinity College Dublin 4

  5. Aliased parameters? Aliased parameters? function log ($printer, $prefix, $message) { 1 ... 2 } 3 4 $p = new Printer; 5 function log ($printer, $prefix, $message) { log ($p, &$p->pre, &$p->mes); 1 6 ... 2 } 3 4 $p = new Printer; 5 log ($p, &$p->pre, &$p->mes); 6 Trinity College Dublin 5

  6. References in PHP References in PHP 1. Multiple names for the same heap Java style object 2. Very simple to convert into SSA - the references Java style scalars Trinity College Dublin 6

  7. References in PHP References in PHP 1. Multiple names for the same memory Java style location C++ style 2. No type declarations or signatures - differs Java style from C++ C++ style Trinity College Dublin 6

  8. References in PHP cont. References in PHP cont. 1. PHP references 1 $y = 1; are run-time values 2 if (...) 2. Symbol table 1 $y = 1; $x =& $y; 3 aliases 4 else 3. Can be references 2 if (...) $x = $y; 5 at some point, and $x =& $y; non-refs at another 6 3 7 $x = 5; point - again, 4 else 8 print $y; unlike C++ $x = $y; 5 6 7 $x = 5; 8 print $y; Trinity College Dublin 7

  9. Aliased parameters? Aliased parameters? 1. Call-time function log ($printer, $prefix, $message) { 1 pass-by-ref ... 2 } 2. All parameters can 3 4 be call-clobbered $p = new Printer; 5 function log ($printer, $prefix, $message) { log ($p, &$p->pre, &$p->mes); 1 3. Cant tell absence 6 ... of aliasing 2 } 3 4 $p = new Printer; 5 log ($p, &$p->pre, &$p->mes); 6 Trinity College Dublin 8

  10. SSA + Alias analysis SSA + Alias analysis What form of SSA to support alias analysis? What form of SSA to support alias analysis? Trinity College Dublin 9

  11. SSA + Alias analysis SSA + Alias analysis What form of SSA to support alias analysis? http://www.cs.man.ac.uk/~jsinger/ssa.html What form of SSA to support alias analysis? http://www.cs.man.ac.uk/~jsinger/ssa.html Trinity College Dublin 9

  12. SSA + Alias analysis SSA + Alias analysis What form of SSA to support alias analysis? Dynamic Single Assignment What form of SSA to support alias analysis? Paul Feautrier. Dataflow analysis of array and scalar Dynamic Single Assignment references. International Journal of Parallel Programming, 1. Not what I thought 1991. it was Paul Feautrier. Dataflow analysis of array and scalar references. International Journal of Parallel Programming, 1991. Trinity College Dublin 9

  13. SSA + Alias analysis SSA + Alias analysis What form of SSA to support alias analysis? Dynamic Single Assignment Cytron and Gershbein What form of SSA to support alias analysis? 1. Not clear how it Dynamic Single Assignment works Cytron and Gershbein 2. Despite Singer’s Ron Cytron and Reid Gershbein. Efficient accommodation of comment may-alias information in SSA form. PLDI 1993. Ron Cytron and Reid Gershbein. Efficient accommodation of may-alias information in SSA form. PLDI 1993. Trinity College Dublin 9

  14. SSA + Alias analysis SSA + Alias analysis What form of SSA to support alias analysis? Dynamic Single Assignment Cytron and Gershbein 1. Unclear how to What form of SSA to support alias analysis? Extended SSA Numbering modify SSA Dynamic Single Assignment algorithms Christopher Lapkowski and Laurie J. Hendren. Extended SSA Cytron and Gershbein numbering: Introducing SSA properties to language with 2. C++ references? Extended SSA Numbering multi-level pointers. Compiler Construction, 1998. Designed for multi-level pointers Christopher Lapkowski and Laurie J. Hendren. Extended SSA numbering: Introducing SSA properties to language with multi-level pointers. Compiler Construction, 1998. Trinity College Dublin 9

  15. SSA + Alias analysis SSA + Alias analysis What form of SSA to support alias analysis? Dynamic Single Assignment Cytron and Gershbein What form of SSA to support alias analysis? Extended SSA Numbering Extended Array SSA Dynamic Single Assignment 1. Requires strong Cytron and Gershbein type information Extended SSA Numbering Stephen Fink, Kathleen Knobe, and Vivek Sarkar. Unified analysis of array and object references in strongly typed Extended Array SSA languages. Static Analysis Symposium, 2000. Stephen Fink, Kathleen Knobe, and Vivek Sarkar. Unified analysis of array and object references in strongly typed languages. Static Analysis Symposium, 2000. Trinity College Dublin 9

  16. SSA + Alias analysis SSA + Alias analysis What form of SSA to support alias analysis? 1. Pedigree: SGI, Dynamic Single Assignment Cytron and Gershbein Mono, gcc What form of SSA to support alias analysis? Extended SSA Numbering Extended Array SSA 2. Worked on gcc Dynamic Single Assignment Hashed SSA 3. solves a lot of Cytron and Gershbein problems Extended SSA Numbering 4. very readable Extended Array SSA Fred C. Chow, Sun Chan, Shin-Ming Liu, Raymond Lo, and 5. clear in what Hashed SSA Mark Streich. Effective representation of aliases and indirect problems is solves memory operations in SSA form. Compiler Construction, 1996. Fred C. Chow, Sun Chan, Shin-Ming Liu, Raymond Lo, and Mark Streich. Effective representation of aliases and indirect memory operations in SSA form. Compiler Construction, 1996. Trinity College Dublin 9

  17. What is HSSA? What is HSSA? 1. Massimiliano Virtual variables Mantione will talk about this tomorrow Virtual variables 2. vars or sets of aliases, or some "name" ie heap node Trinity College Dublin 10

  18. What is HSSA? What is HSSA? Virtual variables 1. Massimiliano Mu: may-use Mantione will talk about this Virtual variables tomorrow 2. Annotates a Mu: may-use statement Trinity College Dublin 10

  19. What is HSSA? What is HSSA? Virtual variables Mu: may-use 1. Massimiliano Chi: may-def Mantione will talk Virtual variables about this tomorrow Mu: may-use Chi: may-def Trinity College Dublin 10

  20. What is HSSA? What is HSSA? Virtual variables 1. Massimiliano Mu: may-use Mantione will talk Chi: may-def about this Space efficient representation Virtual variables tomorrow 2. GVN and zero Mu: may-use variables Chi: may-def Space efficient representation Trinity College Dublin 10

  21. What is HSSA? What is HSSA? Virtual variables 1. Massimiliano Mu: may-use Mantione will talk Chi: may-def about this Space efficient representation Virtual variables tomorrow Drop indices to get out of SSA 2. just drop chis, so Mu: may-use might lose info Chi: may-def Space efficient representation Drop indices to get out of SSA Trinity College Dublin 10

  22. What is HSSA? What is HSSA? Virtual variables 1. Massimiliano Mu: may-use Mantione will talk Chi: may-def about this Space efficient representation Virtual variables tomorrow Drop indices to get out of SSA 2. ie during copy Must be careful not to move copies across live ranges Mu: may-use propagation Chi: may-def Space efficient representation Drop indices to get out of SSA Must be careful not to move copies across live ranges Trinity College Dublin 10

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend