public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael S. Zick <mszick@goquest.com>
To: Alexandre Oliva <aoliva@redhat.com>,
	Zack Weinberg <zack@codesourcery.com>
Cc: Fergus Henderson <fjh@cs.mu.oz.au>,
	khalid aggag <khalidaggag@hotmail.com>,
	gcc@gcc.gnu.org
Subject: Re: A FrontEnd in C++?
Date: Mon, 19 Aug 2002 08:50:00 -0000	[thread overview]
Message-ID: <02081910502902.00732@localhost.localdomain> (raw)
In-Reply-To: <orsn1bc5r6.fsf@livre.redhat.lsd.ic.unicamp.br>

On Monday 19 August 2002 08:55 am, Alexandre Oliva wrote:
> On Aug 19, 2002, Zack Weinberg <zack@codesourcery.com> wrote:
> > Based on the number of problems we have encountered with the Ada front
> > end compared to the others, I think that as a matter of project policy
> > writing front ends in any language other than C should be discouraged.
>
> I disagree.  The problems have all been caused by the front end
> requiring a pre-existing, compatible build of itself to build.  Using
> C++ to create a front end for any language other than C++ wouldn't
> bring in any new problems.

I have to agree with Alexandre.
And this has a lot of bearing on the recent hot thread: "Faster compilation 
speed".

Based on current Makefile usage...
Referring to a 3-stage build as stage0, stage1, stage2 with stage0 currently 
unlabeled...

The (intended) purpose of the stage0 phase is to build a "build compatible" 
compiler from whatever is at hand.
Historically: "any 'ol C compiler"
Recently, this has been expanded "any 'ol C compiler" plus "any 'ol Ada 
compiler" (if they are link compatible or stage0 binutils can be built to 
make them so).

During my "pre-thinking" of revising the makefiles...
I don't see any reason (from the stand point of the makefiles, that is) why 
this can't be generalized to: "any 'ol collection of compilers for any 'ol 
collection of languages"

How does this apply to speeding up the compiler? - Qood question, I'm getting 
there...

Suppose the folks doing all of the work on optimizing code, optimizing 
register usage, etc; come to an agreement such as:
"Doing all of this in C is giving us:
1) poor spacial (sp?) locality for the code, it needs to be better.
2) the spacial locality of the data really sucks
let us rewrite these parts in lanuage xyz".

lisp? elist? RTL_the_language? whatever... don't get focused on any one name 
for now...

Consider for now, any of the many languages which can be implemented as an 
"extensible, threaded, interpertive" language. (I am talking late 1970's 
technology here.)

Functionally, the implemenation would:
1) translate source code -> bytecode (such as "precompile elisp")
2) on receipt of specific command code: 
    2a) traverse a function's byte code, optimize out (I.E: inline) all of 
the calls to its predcessor functions -> one bigger chunk of byte code.
    2b) do a few, simple "peephole" optimizations.
    2c) rather than interpret this now bigger, optimized chunk of byte code; 
use the byte code interpreter's look-up table to look-up the corresponding, 
native, binary, function calls (all of which are written PIC) - strip the 
pre-amble, post-amble, copy the remaining instructions somewhere - call it an 
object code library if you like.

You don't have to spend a lot of time making the above a real "killer 
language app" - it's lifetime will be very short.

I haven't totally lost my mind here - I did several of these about twenty 
years ago - it isn't any bigger a challange than you let it become.

What does that achive?
Considering how the binary was generated, you have done spacial (sp?) 
locality compression.  I.E: by coaxing the conversion process a little, you 
can force I-cache line(s) sizes of instruction chunks.

Now comes the speculation part, which I didn't do in those old TIL's...

Bytecode the data references the TIL language uses.
Follow the same translate, combine, simplifiy, convert.  Converting to 
"native", "packed" data structures.  I.E: eleminate as much "pointer chasing" 
as possible.

So that does spacial (sp?) locality compression for the data.  Here, again, 
with a little coaxing, build D-cache line(s) sizes of data structure chunks.

Now the bootstrap process becomes (adding a "partial" stage):

stage0a: 
generate a "build compatible", approximation of GCC using "any 'ol C 
compiler" and the existing trees, in-liners, etc. plus the source (in C) of 
the "self compiling" approximation of the language the new trees, in-liners, 
optimizers are written in.

stage0b: 
toss the existing sources for trees, in-liners, etc; substituting the sources 
(in the new, whatever, language) for the new replacements.  Generating a 
"fully compiled", GCC-C compatible, New Optimizer compatible; "build 
compiler".

stage-next: Build GCC with the user specified options, features, and 
languages.

Continue per existing build process.

See - that bytecode thing didn't live very long (minutes, probably).

Such a process would allow even the "internals" of the GCC-C compiler be 
built from multiple languages.  I think it may be the direction to take in 
speeding up the compiler.

Mike

  reply	other threads:[~2002-08-19  8:50 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-17 15:45 khalid aggag
2002-08-17 18:06 ` Michael S. Zick
2002-08-19  0:46 ` Fergus Henderson
2002-08-19  1:02   ` Zack Weinberg
2002-08-19  2:18     ` Gabriel Dos Reis
2002-08-19  2:42       ` Michael S. Zick
2002-08-21 10:40       ` Zack Weinberg
2002-08-21 10:59         ` Michael Matz
2002-08-21 11:18           ` Zack Weinberg
2002-08-21 11:25             ` Daniel Berlin
2002-08-21 11:35               ` Michael Matz
2002-08-21 11:50                 ` Daniel Berlin
2002-08-22 13:03                   ` Pop Sébastian
2002-08-22 13:11                     ` Diego Novillo
2002-08-22 13:19                       ` Pop Sébastian
2002-08-22 20:19                     ` Daniel Berlin
2002-08-22 12:47                 ` Gabriel Dos Reis
2002-08-21 11:10         ` Phil Edwards
2002-08-21 11:43         ` Ross Smith
2002-08-21 12:24           ` Zack Weinberg
2002-08-22 12:47             ` Gabriel Dos Reis
2002-08-21 21:51         ` Fergus Henderson
2002-08-22 12:47         ` Gabriel Dos Reis
2002-08-22 14:16           ` Zack Weinberg
2002-08-22 15:41             ` Gabriel Dos Reis
2002-08-23  2:20             ` Fergus Henderson
2002-08-23 13:19               ` Toon Moene
2002-08-24  2:25               ` Kai Henningsen
2002-08-19  6:55     ` Alexandre Oliva
2002-08-19  8:50       ` Michael S. Zick [this message]
2002-08-19  7:20     ` Diego Novillo
2002-08-19 12:20     ` Mike Stump
2002-08-20  2:19     ` Florian Weimer
2002-08-19 10:51   ` Matt Austern
2002-08-20 11:18 ` Kelley Cook
2002-08-20 11:38   ` Kevin Handy
2002-08-18 14:36 khalid aggag
2002-08-18 15:37 ` Michael S. Zick
2002-08-18 22:48 ` Per Bothner
2002-08-19 16:18 Robert Dewar
2002-08-21 11:41 Robert Dewar
2002-08-21 12:59 ` Geoff Keating
2002-08-21 11:53 Robert Dewar
2002-08-21 12:03 ` Graham Stott
2002-08-21 16:16 ` Zack Weinberg
2002-08-21 11:54 Robert Dewar
2002-08-21 16:19 Richard Kenner
2002-08-22 14:17 ` Zack Weinberg
2002-08-21 16:26 Billinghurst, David (CRTS)
2002-08-21 17:19 Robert Dewar
2002-08-21 17:19 Robert Dewar
2002-08-21 18:00 Richard Kenner
2002-08-22  1:54 Robert Dewar
2002-08-22 13:50 Chris Lattner
2002-08-22 14:53 Robert Dewar
2002-08-22 20:37 ` Geoff Keating
2002-08-22 21:36 ` Hans-Peter Nilsson
2002-08-23  3:08 Robert Dewar
2002-08-24  6:54 Robert Dewar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02081910502902.00732@localhost.localdomain \
    --to=mszick@goquest.com \
    --cc=aoliva@redhat.com \
    --cc=fjh@cs.mu.oz.au \
    --cc=gcc@gcc.gnu.org \
    --cc=khalidaggag@hotmail.com \
    --cc=zack@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).