Planet MySQL Planet MySQL: Meta Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 7

Displaying posts with tag: gcc (reset)

MySQL 5.6 on POWER (patch available)
+0 Vote Up -0Vote Down

The following sentence is brought to you by IBM Legal. The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions.

Okay, now that is out of the way….

If you’re the kind of person who follows the MySQL bugs database closely or subscribes to the MySQL Internals mailing list, you may have worked out that I’ve spent a small amount of time poking at MySQL on modern POWER systems.

Unlike Intel CPUs, POWER CPUs require explicit memory barriers to synchronize memory state between different CPUs. This means that when you’re implementing synchronization primitives,

  [Read more...]
Caring about stack usage
+0 Vote Up -0Vote Down

It may not be surprising that there’s been a few projects over the years that I’ve worked on where we’ve had to care about stack usage (to varying degrees).

For threaded userspace applications (e.g. MySQL, Drizzle) you get a certain amount of stack per thread – and you really don’t want to bust that. For a great many years now, there’s been both a configuration parameter in MySQL to set how much stack each thread (connection) gets as well as various checks in the source code to ensure there’s enough free stack to do a particular operation (IIRC open_table is the most hairy one of this in MySQL).

For the Linux Kernel, stack usage is a relatively (in)famous problem… although by now just about every real problem has been fixed and merely

  [Read more...]
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 7

    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.