International Conference on Computer Systems and Education I ISc Bangalore Typ esafe Comp osition of Ob ject Mo dules Guruduth Banavar Gary Lindstrom Douglas Orr Department of Computer Science University of Utah Salt LakeCity Utah USA Abstract Intro duction It is widely agreed that strong typing in We describ e a facility that enables routine creases the reliability and eciency of soft typ echecking during the linkage of exter ware However compilers for statically typ ed nal declarations and denitions of separately languages suchasC and C in tradi compiled programs in ANSI C The primary tional nonintegrated programming environ advantage of our serverstyle typ echecked ments guarantee complete typ esafety only linkage facility is the ability to program the within a compilation unit but not across comp osition of ob ject mo dules via a suite of suchunits Longstanding and widely avail strongly typ ed mo dule combination op era able linkers comp ose separately compiled tors Such programmability enables one to units bymatching symb ols purely byname easily incorp orate programmerdened data equivalence with no regard to their typ es format conversion stubs at linktime In ad Such common denominator linkers accom dition our linkage facility is able to automat mo date ob ject mo dules from various source ically generate safe co ercion stubs for com languages by simply ignoring the static se patible encapsulated data mantics of the language Moreover com monly used ob ject le formats are not de signed to incorp orate source language typ e information in an easily accessible manner This researchwas sp onsored by the Advanced In this pap er we presenta technique to Research Pro jects Agency DOD monitored by the p erform typ e checking of ob ject mo dules as Department of the Navy Oce of the Chief of a routine linktime activity Our technique is Naval Research under Grantnumb er NJ The views and conclusions contained in this characterized by i the design of sp ecic lan do cument are those of the authors and should not guage typ e systems into a systemwide linker be interpreted as representing ocial p olicies ei ii programmed linktime control over indi ther expressed or implied of the Advanced Research vidual symb ols of ob ject mo dules and iii Pro jects Agency or the US Government Contact author G Banavar Computer Science MEB University of Utah Salt LakeCity UT USA e C style namemangling do es not accomplish mail banavarcsutahedu phone complete typ esafety across compilation units see fax Section utilization of standard debugging informa similar to Mo dula using memb er or tion generated by compilers for typ e check der and typ e signicance along with names ing We describ e in detail the realization of Furthermore our programmable linkage these steps for ANSI C facility enables the incorp oration of auto matic and userdened conversion routines A crucial enabler for this facility is the abil for encapsulated data For automatic con ity to resolve inconsistencies among compiled version we p ostulate safe adaptability rules ob ject mo dules at link time The existence for converting builtin data typ es using the of link time typ e errors do es not mean that language denition in conjunction with the program source les need to b e mo died and characteristics of particular hardware plat recompiled as this may not b e p ossible for forms We then utilize these rules to auto precompiled libraries Programmer control matically generate data conversion stubs for correcting link time typ e errors is pro at link time More imp ortantly program vided via the already existing programming mer dened conversion stubs can also b e eas facilities of OMOS our dynamic linker ily incorp orated at link time This op ens For instance consider the case where the up the p ossibility of programmercontrolled typ e of a declaration in one translation unit data evolution and conversion across hetero do es not match with a denition in another geneous data formats eg those arising from This can usually b e xed by i uniformly re dierent languages hardware architectures naming the declaration and its uses to match etc the actually intended denition name or ii Weprovide the abilitytosupportavari in the case when the names match but the etyoftyp e systems by designing our typ e typ es do not byintro ducing a new decla checking facility as an extension of an ob ject ration to match the denition and binding oriented framework The OO framework the renamed original declaration with a typ e contains generic typ e system related abstrac conversion function Our linkage facility eas tions suchas named typ es function typ es ily supp orts such transformations If a typ e record typ es etc that are sp ecialized via in error cannot b e corrected with such simple heritance to implement the typ e domain of transformations on ob ject mo dules it might sp ecic languages indicate a more serious error in the design of In the following sections we describ e in the mo dules involved detail the typ echecking of ob ject mo dules generated by compiling ANSI C programs Our linktime typ echecking facility p er Section intro duces our notion of mo dules mits us to adapt and utilize the full expres and interfaces Section briey describ es our sivepower of language typ e systems to b et ob ject server OMOS and Section discusses ter suit mo dern p ersistent distributed and the essential asp ects of the typ e system of heterogeneous environments For example ANSI C We then give some implementation structural typing can b e applied to languages details discuss related work and conclude such as ANSI C with namebased typing Pure namebased typing b ecomes a problem in p ersistent and distributed environments Ob ject Mo dules and where data and typ es could migrate out side the program in which they were orig their Interfaces inally created and lead to matching of names that mayormay not have the same We refer to an ANSI C program source or programmerintended meaning This argues ob ject le as a module consisting of a set for structural matching of aggregate typ es of attributes with no order signicance An the compiled mo dule O provides a deni attribute is either a lelevel declaration a tion of function f Consider the case where name with an asso ciated typ e eg extern a programmer creates and compiles mo dule int i or a lelevel denition a name O with the intention of using Os f deni with a data storage or function binding tion by p erforming O merge O but makes Typ e denitions eg struct denitions the incorrect presumption that f returns an and typedefs in C are not attributes of intIfmerge were untyp ed as it is in com a mo dule The interface of a mo dule con mon linkage O merge O would have b een sists of name typ e declared or dened legal howeveritdoesnottyp echeck in our tuples of the attributes of the mo dule In the linker since the interfaces of O and O are context of typ echecking ob ject mo dule inter not typ e compatible for a merge op eration faces attributes match if they have the same Let us say that the programmer of O dis name There cannot b e matching attributes y coversduringlinkage that f returns the de within a single interface and attributes that sired int value as a comp onent of the re match across interfaces must b e typ e com turned structure Traditionally in order to patible The notion of typ e compatibilityde make O and O compatible the program p ends on the particular mo dule combination mer would mo dify the source co de of either op eration b eing p erformed and is informally mo dule extensivelyifitwere available and describ ed b elow recompile This of course could adversely Our linker is based up on a formal mo del aect combination of the mo died mo dule of mo dules prop osed in achieving a ne with yet other mo dules Alternatively in our level of control over individual attributes of mo del of exible linktime mo dule adapta ob ject mo dules Briey ob ject mo dules are tion O can b e adapted to get the desired ef combined via a suite of mo dule combination fect by constructing a stub mo dule O O operators that were originally conceived to consists of a new declaration that matches describ e the many facets of inheritance in fs denition and a stub function that ex ob jectoriented programming Figure gives tracts the desired value from the structure the primary op erators their informal seman returned by f With this a mo died ver tics and typ e rules These op erators pro sion of O is obtained with the mo dule ex vide control over asp ects of visibility sharing pression O rename f f stub merge O and rebindability of individual attributes of which can then b e mergeed with O to get mo dules The p ower that this mo del lends the originally desired eect to ob ject mo dule linkage is briey given in Section and is describ ed in more detail in where the original implementation of The OMOS Linker the typ eless OMOS linker is describ ed The current eort incorp orates the rules of the In this section we describ e our linkage strongly typ ed mo dule mo del and illustrates facility the Ob ject MetaOb ject Server some of its applications OMOS The semantics of common linkageisem The OMOS linkerloader is designed to b o died in the mo dule op erator merge For provide a dynamic linking and loading facil a simple example of the use of this mo dule ity for client programs via the use of mo dule op erator consider Figure In this gure combination and instantiation OMOS im plements a p ersistent hierarchical namespace y In order to mo del languages that supp ort user muchlike
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages13 Page
-
File Size-