1 / 17

OSUIF: SUIF For Objects Urs H ölzle Holger Kienle UCSB

OSUIF: SUIF For Objects Urs H ölzle Holger Kienle UCSB. OSUIF In A Nutshell. extends SUIF IL to better support OO languages provides standard OO optimization passes tests SUIF2 extensibility model. Extending SUIF2 For OOPLS. symbol table support for classes, inheritance, methods

tejano
Download Presentation

OSUIF: SUIF For Objects Urs H ölzle Holger Kienle UCSB

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OSUIF: SUIF For ObjectsUrs HölzleHolger KienleUCSB

  2. OSUIF In A Nutshell • extends SUIF IL to better support OO languages • provides standard OO optimization passes • tests SUIF2 extensibility model

  3. Extending SUIF2 For OOPLS • symbol table • support for classes, inheritance, methods • support for incomplete types (transitive closure problem) • method calls • hide exact dispatch sequence • future: exceptions, garbage collection, ...

  4. Utility Passes • OSUIF -> SUIF • build-vtables: virtual tables • lower-instance-variables: layout of class-types • lower-methods: method dispatch • lower-static-fields, lower-static-methods: put static in global scope

  5. Example Front-End: Java • Java byte code -> OSUIF (Solaris) • class loading, resolution of the constant pool • control flow analysis (normal and exception handling) • data flow analysis (construct type information) • OSUIF code generation • no threads, exception handling • run-time system: optimized for clarity

  6. Current Status • included in SUIF release • more at http://www.cs.ucsb.edu/~osuif • tested on SPARC/Solaris • works with Sun JDK • successfully ran most SPECjvm98 programs in the past (currently less stable)

  7. OSUIF Extensions To SUIF • test of how easy it is to extend SUIF • no “privileged access”: what we did for OSUIF, any SUIF user can do • OSUIF itself is designed to be similarly extensibleSUIF --> OSUIF --> Java_OSUIF

  8. Example: Methods, Not Procedures Hoof specification: concrete InstanceMethodSymbol : ProcedureSymbol { searchable_list<LString> attributes; ClassType * reference owning_class omitted; bool is_dispatched default {true}; InstanceMethodSymbol * reference overridden_method omitted; };

  9. Compilation of Hoof specs osuif.hoof osuif.h (Interface) smgn osuif.cc (Implementation) osuif_factory.h (Node Creation) osuif_forwarders.h

  10. smgn-Generated Code: osuif.h class InstanceMethodSymbol : public ProcedureSymbol { public: // searchable_list<LString> attributes; void append_attribute(const LString & key); Iter<LString > get_attribute_iterator() const; void remove_attribute(const LString & key); bool has_attribute_member(const LString & key); int get_attribute_count() const; virtual void insert_attribute(int pos,const LString & x); // ClassType * reference owning_class omitted; virtual ClassType* get_owning_class () const; virtual void set_owning_class(ClassType* the_value); ... private: searchable_list<LString> _attributes; ClassType* _owning_class; bool _is_dispatched; InstanceMethodSymbol* _overridden_method; };

  11. smgn-Generated Code: osuif_factory.h InstanceMethodSymbol* create_instance_method_symbol ( SuifEnv * env, ProcedureType* type, const LString & name = emptyLString, bool is_address_taken = false, ProcedureDefinition* definition = 0, bool is_dispatched = true );

  12. Three Forms Of Extensibility • example: add Java access control (public / protected / private) • SUIF Annotation • string-attributes in InstanceMethodSymbol • subclassing from InstanceMethodSymbol

  13. Extensibility: SUIF Annotations concrete AccessAnnote : GeneralAnnote { bool is_public default {false}; bool is_protected default {false}; bool is_private default {false}; }; InstanceMethodSymbol* ims = create_instance_method_symbol ( ... ), AccessAnnote* annote = create_access_annote( ..., false, true, false ); ims -> append_annote( annote );

  14. Extensibility: String-attributes concrete InstanceMethodSymbol : ProcedureSymbol { searchable_list<LString> attributes; ... }; InstanceMethodSymbol* ims = create_instance_method_symbol( ... ), ims->append_attribute( "protected" ):

  15. Extensibility: Subclassing concrete JavaInstanceMethodSymbol : InstanceMethodSymbol { bool is_public default {false}; bool is_protected default {false}; bool is_private default {false}; }; JavaInstanceMethodSymbol* jims = create_java_instance_method_symbol ( ..., false, true, false );

  16. OSUIF Components • New IR Nodesosuifosuifextensions (single inheritance)j2s (Java)cpp_osuif (C++)

  17. OSUIF Components (cont'd) • passes • OSUIF -> SUIF ("lowering") • SUIF -> OSUIF ("raising") • v-table construction (single inheritance) • layout of instance fields (single inheritance) • miscellaneous: • typebuilder for MethodType • utilities for convenient IR node creation/manipulation

More Related