Slashdot Mirror


GCC 4.0.0 Released

busfahrer writes "Version 4.0.0 of the GNU Compiler Collection has been released. You can read the changelog or you can download the source tarball. The new version finally features SSA for trees, allowing for a completely new optimization framework." The changelog is pretty lengthy, and there's updates for every language supported from Ada to Java in addition to the usual flavors of C.

11 of 680 comments (clear)

  1. Sweetness by kronak · · Score: 5, Informative

    Glad to see they are targeting the AMD64 architecture for improvements.

  2. Re:Is anyone else curious what SSA trees are? by Entrope · · Score: 5, Informative

    Single static assignment is a way the compiler can rewrite the code (usually for optimization purposes) so each "variable" being analyzed is only written once. This makes a lot of optimizations easier to do, since it eliminates aliasing due to the programmer assigning different values to the same variable. You'd probably learn these things if you would RTFA.

  3. Re:Is anyone else curious what SSA trees are? by GillBates0 · · Score: 5, Informative
    Wikipedia (as usual) has a nice article about the Static Single Assignment (SSA) form.

    To put it simply, SSA is an intermediate representation where each variable in a block is defined only *once*. If a variable is defined multiple times, the target of any subsequent definitions of the same variable is replaced by a new variable name.

    SSA helps to simplify later optimizations passes of a compiler (for example: eliminating unused definitions, etc) as described in greater detail (with examples and flowcharts) in the article linked to.

    That's the SSA form in short. Now I need to ask somebody the difference between the standard SSA form and "SSA for trees".

    --
    An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
  4. Re:Figured this had to happen by k98sven · · Score: 5, Informative

    When they announced the release of Apple 10.4 "Tiger" I noticed this page: At that point I kinda figured gcc 4.0.0 had to be out by April 29th since Apple claimed they were using it for OS X.

    Well, you're wrong because GCC doesn't follow Apple's schedule, or anyone else's for that matter. Even a cursory glance at the GCC mailing list will tell you that.

    The reason Apple can promise this is that they're not actually shipping GCC 4. They're shipping their own fork of the GCC 4 code. It's probably about 99% the same code, but don't make the mistake of thinking they're shipping exactly what the FSF is distributing.

  5. Re:What a coincidence by Anonymous Coward · · Score: 5, Informative

    The parent poster is refering to the deprecation of Managed Extensions for C++ syntax in favor of C++/CLI (which is undergoing ISO standardization).

    While it is true the syntax has changed (much for the better: templates are now supported in managed C++ code and so are generics, keywords replace ugly __gc, and more), support for the old syntax is still in the compiler (/clr:oldSyntax), and IntelliSense.

    However, you will be unable to mix new syntax and old syntax code in the same project without taking some penalties (IntelliSense will break, at the least). The designer will even spit out old syntax code when designing an old form or control.

    While the old syntax is definitely on its last legs, the VC++ team was very concerned about not screwing over those (early) adopters of C++ code for the CLR thus far.

    A good resource to read up more on the subject would be Herb Sutter's Blog, Stan Lippman's Blog, or any of the other VC++ team member's blogs.

    Take this from a former VC++ teammate who left during the Whidbey product cycle (posting AC since I've never bothered to get a slashdot account).

  6. GCC 4.0's biggest winner is probably KDE by Anonymous Coward · · Score: 5, Informative

    due to the fact that all its c++ shared libraries will now be 40% smaller due to the symbol visibility improvements (i.e., no runtime adjustment needed by the linker for internal-only functions). This translates into a significant speed improvement for all KDE code.

    1. Re:GCC 4.0's biggest winner is probably KDE by Anonymous Coward · · Score: 5, Informative

      In case you hadn't noticed, the "slow" part of running KDE are the start up times. Once you actually get KDE loaded, the runtime speed is fine.

      -a GNOME/KDE agnostic fluxbox user

  7. Re:Is anyone else curious what SSA trees are? by IvyMike · · Score: 5, Informative

    There have been several good answers to your question, but if you're really new to compilers, you might want a little more context. Want a quick lesson in how compilers work? If you're willing to accept some gross oversimplifications, here's how most modern compilers work:

    1) Tokenize the input. For example, if you were compiling perl, you might choose to turn "print $foo" into three tokens; KEYWORD_PRINT, TYPE_SCALAR, and IDENTIFIER('foo'). The output is typically a stream of tokens. This step might be done by lex or flex.

    2) Parse the sequence of tokens using a set of rules called a grammar. For example, "TYPE_SCALAR" followed by "IDENTIFIER()" is might match a rule to generate a variable called "$foo", and "KEYWORD_PRINT" followed by a variable means call the function print on the contents of the variable. The output is typically an abstract syntax tree (AST); a high-level data structure representing the program. This step might be done by yacc or bison.

    3) Match the AST against a series of rules to output the final code. This might actually be two steps; you might generate something into a low-level register transfer language (RTL) that looks very much like assembly, and then turn THAT into actual machine instructions.

    At each stage, you might choose to optimize the output. You might also insert optimizations passes between steps. (For example, you might insert a pass between 2 and 3 to optimize the AST into a simpler AST.)

    Before SSA, GCC sort of skipped making any high-level AST; it used to go from parsing almost immediately into a RTL. You can still optimize RTL, but since it's pretty low-level, it misses out on higher-level context and made some optimizations really difficult.

    SSA is simply a form used for the high-level AST. Why SSA? It is a very nice form to optimize. Read the wikipedia article for more details on why SSA is particularly useful for some optimizations.

    Page 181 of this PDF file from the 2003 GCC Summit explains the flow of the GCC compiler.

  8. Patent issues by plgs · · Score: 5, Informative
    "Unfortunately we cannot implement Steensgaard [pointer] analysis due to patent issues."

    They mean this patent owned by this company. What a surprise.

  9. TR1 included! by Anthony+Liguori · · Score: 5, Informative
    I'm surprised noone's mention the inclusion of the C++ TR1. There's a ton of very cool new library features. Here are my two favorite:
    #include <tr1/functional>

    int foo(int x, int y) { return x * y; }

    using namespace std::tr1::placeholders;

    int main() {
    std::tr1::function<int (int, int)> f;
    std::tr1::function<int (int)> g;

    // f can be stored in a container
    f = foo;

    f(2, 3);

    g = std::tr1::bind(f, _1, 3);

    // this is equivalent to f(2, 3)
    f(2)
    }
    Not to mention the inclusion of shared_ptr which provides a reference counted pointer wrapper. This will eliminate 99% of the need to do manual memory management in C++. It's all very exciting, kudus to the G++ team on this!
  10. Re:Figured this had to happen by dvdeug · · Score: 5, Informative
    We're not shipping "a fork" of GCC 4. We're shipping GCC 4.0.0, which we compiled from source for Darwin 8.

    According to http://gcc.gnu.org/install/specific.html#powerpc-x -darwin,
    The version of GCC shipped by Apple typically includes a number of extensions not available in a standard GCC release. These extensions are generally for backwards compatibility and best avoided.

    i.e. you're using a forked version of GCC, and definitely not 4.0.0 out of the box.

    the whole notion of "a fork" runs 100% counter to all that open-source stuff

    No, actually, the importance of the ability to fork and wisdom to know when to fork is very important to "that open-source stuff".