Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 5

Displaying posts with tag: gcc (reset)

Limiting functions to 32k stack in Drizzle (and scoped_ptr)
+1 Vote Up -0Vote Down

I wonder if this comes under “Code Style” or not…

Anyway, Monty and I finished getting Drizzle ready for adding “-Wframe-larger-than=32768″ as a standard compiler flag. This means that no function within the Drizzle source tree can use greater than 32kb stack – it’s a compiler warning – and with -Werror, it means that it’s a build error.

GCC is not perfect at detecting stack usage, but it’s pretty good.

Why have we done this?

Well, there is a little bit of recursion in the server… and we can craft queries to blow a small stack (not so good). On MacOS X, the default thread stack size is only 512kb. This gives not many frames if 32kb stack is a even remotely common.

I found

  [Read more...]
Profile guided optimization with gcc
+3 Vote Up -0Vote Down

Yesterday I wrote how certain build optimizations can have performance differences – and I decided to step a bit deeper into a quite interesting field – profile guided binary optimization. There’re quite a few interesting projects out there, like LLVM (I hear it is used extensively in iphone?) – which analyze run-time profile of compiled code and can do just in time adjustments of binary code. Apparently, you don’t need that fancy technology, and can use plain old gcc.

The whole plan is:

  • Compile all code with -fprofile-generate in {C|CXX|LD}FLAGS
  • Run the binary
  • Run your application/benchmark against that binary
  • Recompile all code with -fprofile-use (above steps will place lots of .gcda files in source tree)
  • PROFIT!!! (note the omission of
  •   [Read more...]
    Fun with the 387
    +0 Vote Up -0Vote Down

    Filed  GCC bug 39228:

    #include <stdio.h>
    #include <math.h>
    int main()
    {
            double a= 10.0;
            double b= 1e+308;
            printf("%d %d %dn", isinf(a*b), __builtin_isinf(a*b), __isinf(a*b));
            return 0;
    }

    mtaylor@drizzle-dev:~$ gcc -o test test.c
    mtaylor@drizzle-dev:~$ ./test
    0 0 1
    mtaylor@drizzle-dev:~$ gcc -o test test.c -std=c99
    mtaylor@drizzle-dev:~$ ./test
    1 0 1
    mtaylor@drizzle-dev:~$ gcc -o test test.c   -mfpmath=sse -march=pentium4
    mtaylor@drizzle-dev:~$ ./test
    1 1 1
    mtaylor@drizzle-dev:~$ g++ -o test test.c
    mtaylor@drizzle-dev:~$ ./test
    1 0 1

    Originally I found the simple isinf() case to be different on x86 than x86-64, ppc32 and sparc (32 and 64).

    After more research,












      [Read more...]
    floating point is not fun
    +0 Vote Up -0Vote Down
    #include <stdio.h>
    #include <math.h>
    
    int main()
    {
            double a= 10.0;
            double b= 1e+308;
            printf("%dn",isinf(a * b));
            return 0;
    }

    Prints 1 on: 64bit intel, 32bit PowerPC, 32bit SPARC, 64bit Sparc. But prints zero on 32bit intel.

    Oh, but if you build that with g++ instead of gcc on 32bit Intel, you get 1.

    workbench-5.1.1-alpha on Fedora 9
    +0 Vote Up -0Vote Down

    So, you want to compile Workbench for Linux, on Fedora 9. You need to install the following packages:


    autoconf automake libtool libzip-devel libxml2-devel libsigc++20-devel libglade2-devel gtkmm24-devel mesa-libGLU-devel mysql-libs mysql mysql-devel uuid-devel lua-devel glitz-devel glitz-glx-devel pixman-devel pcre-devel libgnome-devel gtk+-devel pango-devel cairo

    I feel I’m being too liberal with dependencies, but I’m not about to strip it, I just want to get it working first :)

    You need to have ctemplate and ctemplate-devel installed from updates-testing-newkey (relevant koji build log).

    By default, configure.in in Workbench looks for “google-ctemplate”, as opposed to just “ctemplate” as



      [Read more...]
    Showing entries 1 to 5

    Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

    Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.