From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11742 invoked by alias); 8 Aug 2012 05:39:21 -0000 Received: (qmail 11526 invoked by uid 22791); 8 Aug 2012 05:39:18 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Aug 2012 05:38:59 +0000 Received: by pbcwy7 with SMTP id wy7so870252pbc.20 for ; Tue, 07 Aug 2012 22:38:58 -0700 (PDT) Received: by 10.68.225.233 with SMTP id rn9mr25884919pbc.135.1344404338316; Tue, 07 Aug 2012 22:38:58 -0700 (PDT) Received: from [192.168.1.30] (st0300.nas931.d-osaka.nttpc.ne.jp. [202.229.225.44]) by mx.google.com with ESMTPS id pe2sm9236014pbc.59.2012.08.07.22.38.56 (version=SSLv3 cipher=OTHER); Tue, 07 Aug 2012 22:38:57 -0700 (PDT) Message-ID: <5021FB65.2010704@gmail.com> Date: Wed, 08 Aug 2012 05:39:00 -0000 From: Fumiaki Isoya User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: gcc@gcc.gnu.org Subject: The Extension to ELF Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2012-08/txt/msg00073.txt.bz2 I'd just sent mail to rms@gnu.org and he replied. > I know nothing abnout ELF format, and I have not worked on GCC since > 1991. Thus, I simply am not in a position to judge the merits of your > suggestion. How about writing to gcc@gnu.org, which is the discussion > list for GCC? My original message is below. I'd like to hear your opinion. > Hello. > > This is the 3rd time to send email in this topic. My first > purpose in 1994 was to make a simple and lightweight OO language > which can run on 32bit native DOS. I planned the implementation > of C structure which has the first variable of a pointer to its > class. And I considered about the class which contains a pointer > table for instance methods. > > ------------------------------------------------------------------------ > class Object { > int a, b; /* instance variable */ > void do0 (); /* instance method */ > void do1 (); > void do2 (); > void do3 (); > void do4 (); > }; > > Object obj; > > ------------------------------------------------------------------------ > [MEMORY IMAGE] > > Object > +-----------+ > | Ptr super | > | Ptr do0 | > | Ptr do1 | > | Ptr do2 | > | Ptr do3 | > | Ptr do4 | > +-----------+ > > obj > +-----------+ > | Ptr class |---> Object > | int a | > | int b | > +-----------+ > > ------------------------------------------------------------------------ > class Point extends Object { > int x, y, z; /* instance variable */ > void do2 (); /* instance method (override) */ > void do5 (); /* instance method */ > void do6 (); /* instance method */ > }; > > Point pt; > > ------------------------------------------------------------------------ > [MEMORY IMAGE] > > Point > +--------------------+ > | Ptr super |---> Object > | Ptr do0 | > | Ptr do1 | > | Ptr do2 | > | Ptr do3 | > | Ptr do4 | > | Ptr do5 | > | Ptr do6 | > +--------------------+ > > pt > +-----------+ > | Ptr class |---> Point > | int a | > | int b | > | int x | > | int y | > | int z | > +-----------+ > > ------------------------------------------------------------------------ > > Even with this simple plan, trying to implement was very difficult > because I was going to keep the principle "What is necessary is to > re-compile only the source files you touched". > > Consider the class, for example, which has 5 instance methods. > The derived class adds 2 methods and overrides 1 method. The > object files are separate into two. The symbols of indices (in > asm file) will be something like the below. > > Object_super .define 0 > Object_do0 .define 4 > Object_do1 .define 8 > Object_do2 .define 12 > Object_do3 .define 16 > Object_do4 .define 20 > Object_MMAX .define 24 /* Method MAX */ > > Object_class .define 0 > Object_a .define 4 > Object_b .define 8 > Object_VMAX .define 12 /* Variable MAX */ > > > Point_super .define Object_super > Point_do0 .define Object_do0 > Point_do1 .define Object_do1 > Point_do2 .define Object_do2 > Point_do3 .define Object_do3 > Point_do4 .define Object_do4 > Point_do5 .define Object_MMAX .+ 0 > Point_do6 .define Object_MMAX .+ 4 > Point_MMAX .define Object MMAX .+ 8 > > Point_a .define Object_a > Point_b .define Object_b > Point_x .define Object_VMAX .+ 0 > Point_y .define Object_VMAX .+ 4 > Point_z .define Object_VMAX .+ 8 > Point_VMAX .define Object_VMAX .+ 12 > > > The object file of the derived class doesn't know the length of > the method table of the super class, nor the index of the method > to override. The calculation of constants to generate a suitable > method table must be ld's job as long as we keep the principle. > Take care this is not about the method dispatch. This is about > the classes as global variables which is generated by ld. It > contains a flat pointer table of instance methods. How do you > think about this principle? > > I suspect we should make decision of solving all symbols by the > calculation. That is, all symbols should be solved by the > calculation of the information that stored in Reverse Polish which > consists of constants, other symbols, and their arithmetic. It > also contains the information of shared libraries possibly. I > suppose this decision gives unified implementation of object > files, static libraries, and shared libraries. In fact it will be > the extended ELF. > > Please forgive me because I'm not any linker expert. I don't know > very much the details of ELF format. I know m68k asm, but I only > regards ld as a kind of constant resolver. I even don't know > really well about dynamic linking. But I believe this kind of > solution will be the best infrastructure (binutils, and the > mechanism of shared library) for the object oriented languages. > I'm not interested in designing OO language, I'm just talking > about infrastructure. I imagine the goal of this infrastructure > is to provide seamless linking of OO language's object files, C's > object files, and Asm's object files. > > I had read the article of the interview to Straustrap so many > years ago and he had said "My work is to design the language, I'm > not interested in implementations" or something like it. In > contrast with it, my interest is implementations. How do you > think about the great effects which he brought with his stance? >