| Xavier Leroy. Efficient data representation in polymorphic languages. Research report 1264, INRIA, 1990. |
.... is not possible when dealing with a language that provides polymorphism, since all values have to be of the same size (in this case one word) A lot of work has been done regarding optimization of data representations and it turns out that not all data need to be boxed for polymorphism to work [Ler90a, JL92, App89, AM87, App94] 49 50 CHAPTER 10. THE ABSTRACT MACHINE The Zinc abstract machine deallocates dead, unreachable data by use of a garbage collector 1 . When planning the representation of data the garbage collector has to be taken into account. The garbage collector for the Caml ....
Xavier Leroy. Efficient data representation in polymorphic languages. Technical report, INRIA, 1990.
.... solutions to this problem have been proposed but require, either that the language is extended to deal explicitly with boxed unboxed representations as in [18] or that we use a more sophisticated type system to discover where coercions between boxed and unboxed representations are required as in [12, 13]. This section describes a new approach to these problems, avoiding the need for uniform boxed representations by generating specialized versions of polymorphic functions. Obviously, this fits in very closely with the work in the first part of the paper; indeed, we show how this can be described ....
X. Leroy. Efficient data representation in polymorphic languages. INRIA research report 1264, July 1990.
....objects (such as pairs of int) requires the wrapping procedure described above. The result is a rather inefficient representation. 4. 3 Coercion Based Approaches A novel coercion based approach to the problem of polymorphic code has been suggested by Leroy [26] building on his own earlier work [25] and complementing the work of Peyton Jones [22] Peyton Jones suggested introducing boxing and unboxing operations explicitly into the intermediate language (by way of an algebraic data type) exposing them for conventional optimisation. He further introduced the key restriction that polymorphic ....
Xavier Leroy. Efficient data representation in polymorphic languages. Research report 1264, INRIA, 1990. BIBLIOGRAPHY 68
....to be packaged as boxed values a uniform representation that is independent of the type of values involved. Converting between boxed and unboxed representations can be quite expensive and there have been a number of attempts to find techniques for reducing or eliminating unnecessary conversions [14, 18, 15, 7]. The alternative suggested here is to reduce polymorphic definitions to a collection of monomorphic versions, each of which can be implemented using an appropriate representation for the values that it manipulates. This will probably be most effective in languages with strict semantics where ....
X. Leroy. Efficient data representation in polymorphic languages. INRIA research report 1264, July 1990.
....[19] 5.4 Compiler Generation When the transformations above have been applied, code generation to Scheme is a simple matter of un parsing the intermediate form. Issues regarding efficient data representation are not dealt with in our prototype compiler (see Cardelli 1984 [6] and Leroy 1990 [14] for discussions regarding those problems) The Scheme code is finally optimized and compiled by the Scheme to C compiler. To compensate for the lack of inter procedural tail recursion removal in certain C compilers, we have designed machine dependent routines to perform this optimization, ....
Xavier Leroy. Efficient data representation in polymorphic languages. In Proceedings of the 1990 Workshop on Programming Language Implementation and Logic Programming (PLILP'90), LNCS-456. Springer-Verlag, 1990.
....also inefficiently managed by uniform representations as memory is wasted. 4.3 Mixed representation Mixed representation is a representation where all objects are not required to be of the same size. It mixes boxed objects and unboxed objects. Initial efforts using mixed representation are Leroy [18, 19] and Peyton Jones and Launchbury [21] and more recently Shao and Appel [27] Their works are complementary because Peyton Jones and Launchbury introduce a (non strict) language where boxing operations are explicit and introduce several source to source optimizations for this language while Leroy ....
X. Leroy. Efficient data representation in polymorphic languages. In P. Deransart and J.Ma/luszy'nski, editors, Int. Symp. on Programming Language Implementation and Logique Programming, volume 456 of Lecture Notes on Computer Science. Springer-Verlag, 1990. Also available as INRIA research report 1264.
....a single class that represents all its instantiations. For example, the homogeneous translation of the Pizza code for parametric hashtables in Figure 2 yields essentially the Java code in Figure 1. The homogeneous translation is similar to schemes for implementing parametric polymorphism in ML [Ler90, SA95] The homogeneous translation underlies the current Pizza compiler whose use has become widespread since December 1996. This translation yields compact code that can run in standard Java enabled browsers. By contrast, the heterogeneous translation maps a parameterised class into a separate ....
Xavier Leroy. Efficient data representation in polymorphic languages. In P. Deransart and J. Ma/luszy'nski, editors, Programming Language Implementation and Logic Programming, pages 255--276. Springer-Verlag, 1990. Lecture Notes in Computer Science 456.
....constructor. This is not strange, because this is what one needs to implement map on sum types. This may be generalized to any non recursive sum type. The equations for expressions are straightforward: hoption(c)iNone = None hoption(c)i(Some e) Some (hcie) 6. 4 Recursive data types Leroy [Ler90] pointed out that recursive data types may introduce an efficiency problem. If we introduce lists then the corresponding coercion constructor to the list type constructor is map. If we allow elements of lists to be unboxed, which is completely legal in our approach, then we might end up having ....
....coercion constructors (map) in them, except for a an outermost application of map(unbox) which corresponds to the unboxing that will be performed by a print routine. This indicates that it is advantageous to allow recursive data structures with unboxed components and not exclude these as Leroy[Ler90] does. Notice that the monomorphic program mi sort now performs no coercions at all. This will be the case for all monomorphic programs. 7.2.3 C p completions The last test shows the quality of the variant of our algorithm that produces C p completions. We have tested this with the same ....
Xavier Leroy. Efficient data representation in polymorphic languages. Technical Report 1264, INRIA, August 1990.
....For example, a value of type Int# may be passed to a polymorphic function, by first being coerced type Int by applying the Int constructor to it. Similarly, a value of type Int can be coerced into one of type Int# by evaluating it and extracting its value. This is exactly the approach taken by Leroy [1991]. For example, the expression: foldr ( #) 0# [4#, 5#] would, after the coercions have been introduced, look like this: case (foldr ( x. y. case x of Int x# case y of Int y# case ( # x# y#) of t# Int t#) Int 0#) Int 4#, Int 5#] of Int t1# t1# The unboxed constants have been boxed to ....
....not be attached to the unboxed values, which is of course much more efficient than manipulating the tagged representation. It is not clear how well his analysis would work in a non strict language where the order of evaluation is much harder to predict. Leroy s work has already been mentioned (Leroy [1991]) It deals with a strict language, and concentrates mainly on the coercion issues discussed in Section 10. It nicely complements this paper. 12 Further work 12.1 Overloading the built in operators In Section 6.1 we introduced the following example: data Cpx = Cpx Int Int addCpx (Cpx r1 i1) Cpx ....
X Leroy [April 1991], "Efficient data representations in polymorphic languages," INRIA Research Report 1264, Rocquencourt.
No context found.
Xavier Leroy. Efficient data representation in polymorphic languages. Research report 1264, INRIA, 1990.
Online articles have much greater impact More about CiteSeer.IST Add search form to your site Submit documents Feedback
CiteSeer.IST - Copyright Penn State and NEC