From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: GNAT stuck, any idea on how to diagnose it? Date: Sun, 14 Sep 2014 21:45:16 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: Reply-To: anon@att.net NNTP-Posting-Host: Ppam/4RuSWiv4MdLAeGvxg.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: IBM NewsReader/2 2.0 Xref: number.nntp.dca.giganews.com comp.lang.ada:189004 Date: 2014-09-14T21:45:16+00:00 List-Id: GNAT is a command shell for Adacore's Ada compiler. And once it determines what action to be done, GNAT runs a number of programs. At first GNAT may call the GNAT1 (Ada compiler). This program converts Ada to assembly language, if the source code is correct, else reports errors. "gnat compile .ad[b|s]" or "gnat make .ad[b|s]" preforms GNAT --> "gcc .ad[b|s]" gcc --> "gnat1 .ad[b|s]" Second, if GNAT1 returns a no errors condition then GNAT calls the gcc assembler "as" (gcc assembler) GNAT --> "as " You can bypass GNAT and the "gcc" steps, by using gnat1 .ad[b|s] as .s Also, GNAT BIND works almost the same way as GNAT COMPILE except BIND creates either a Ada package (default) or a C binding package that can be linked to the runtime code. Note: The binder creates a package which starts with "b~" added to the source filename. GNAT --> "gnatbind .ali" GNAT --> "gcc .adb" gcc --> "gnat1 .adb" GNAT --> "as .s" bypassing GNAT would be: gnatbind .ali gnat1 options> .adb as .s But as for time GNAT does not take that much time. The part that takes the longest is the gcc backend which GNAT uses to convert it internal gcc IR language to assembly. Mostly it is the optimization phase in the gcc backend that requires more time ( options -O2 (default), -O3, -O4 ). now the process that GNAT1 uses is GNAT1 :== Ada source --> AST --> GCC IR at this movement the GCC backend takes over and processes the GCC IR into assembly gcc backend :== GCC IR --> ??? --> assembly code For speed, GNAT1 loads the entire code into memory at one time. Then basically processes the source as a large data array, while others compilers may read a line of code at a time (reduced speed). With all of the checks that the Ada requires in compiling, GNAT1 is very efficiency during the syntactic and semantic phases. Now the slow down starts to occur in the backend converter "gigi" which is written in C. The "gigi" uses the GCC backend which is efficiency for C/C++ but is not as efficiency for other languages like Ada, Fortran, etc. One explanation is in translating Ada into the "GCC IR" code the "gigi" may use or alter the code that makes it difficult for the GCC optimization to process. Which means that Adacore's GNAT by now (20 years) should have its own backend written in Ada, specifically for Ada. That way the world could see the true speed of the GNAT compiler. In , "Dmitry A. Kazakov" writes: >On Sun, 14 Sep 2014 09:21:18 +0000 (UTC), Natasha Kerensikova wrote: > > Would you know what is this `gnat1`? > What part of the build process is it? > What is the command above supposed to perform? > Is it known to occasionally take a lot of time?