DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: ! thunk

  1. #1
    Join Date
    Jun 2007
    Posts
    5

    ! thunk

    Like thunk, which is a code put by the compiler. Can the compiler reduce the binary size at run time?
    I mean lots of time when we do initialization things with in the program. Which never gets executed again and again. Can those part be removed from the binary itself at run time ?
    May be we require some key word support && || O/S support.

    -Siddhartha

  2. #2
    Join Date
    Nov 2003
    Posts
    4,118
    The initialization part is quite complex. static initialization for example is automatically done by the system, by storing the objects in a special memory region. Dynamic initialization requires the invocation of a constructor. The compiler can analyze the code and perhaps remove redundant parts from it but in order to do so, it has to see the entire program and *learn* how the program is used. This is called instrumentation. There are development suits that do that and optimize the executable after a few runs. Such optimizations consist of caching hot spots in the main memory instead of the virtual memory, inlining code sections at runtime, unloading parts of the program that aren't used etc.
    Danny Kalev

  3. #3
    Join Date
    Jun 2007
    Posts
    5

    How to see it working for C++

    Thanks Danny,
    I would like to see it working for C++ programs.
    Do you have a pointer on that?
    -Siddhartha

  4. #4
    Join Date
    Nov 2003
    Posts
    4,118

  5. #5
    Join Date
    Jun 2007
    Posts
    5

    Pgo

    Thanks a lot Danny,
    This is exactly what I was looking for.
    So does this mean that that after running the binary multiple times with the PGO / WPO switch, the final binary size will be reduced?
    This is interesting. Let me investigate and do more hands-on on that and come back to you with my understanding.
    Cheers,
    Siddhartha

  6. #6
    Join Date
    Nov 2003
    Posts
    4,118
    Yes, exactly. The size will either reduce or some parts of the program will not be loaded to the main memory.
    Danny Kalev

Similar Threads

  1. Interface leaks in C#?
    By Kevin Burton in forum .NET
    Replies: 12
    Last Post: 10-09-2000, 10:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center