On Fri, 06 Mar 2009, Szak�ts Viktor wrote:

Hi,

> set HB_COMPILER=msvc
> set HB_USER_CFLAGS=-GL
> set HB_USER_LDFLAGS=/LTCG
> ---
> source\macro\win\msvc\macroy.c(3095) : warning C4701: potentially
> uninitialized local variable 'hb_macrolval' used
> source\vm\classes.c(462) : warning C4702: unreachable code
> source\compiler\hbpcode.c(599) : warning C4702: unreachable code
> source\compiler\hbpcode.c(549) : warning C4702: unreachable code
> source\compiler\hbpcode.c(571) : warning C4702: unreachable code
> source\vm\classes.c(2940) : warning C4702: unreachable code
> source\compiler\win\msvc\harboury.c(7154) : warning C4701: potentially
> uninitialized local variable 'hb_complval' used

Wow, MS discovered Interprocedural Optimization (IPO).
This warnings are result of such optimization. Just simply now
MS knows that hb_errInternal() does not return and mark all code
below as unused.
IPO really nicely increase the speed. For speedtst and -gc3 it
gives ~15 speed improvement.
It's very simple trick. To .obj file some meta code is attached
and compiler is integrated with linker. Final binaries are not created
by linking already compiled binary code in .obj files but instead meta
code is extracted linker creates one big application in meta code and
these whole application is optimized by the compiler integrated with
linker and then final code is generated. It means that optimizations
can be done between different .c file just like for single .c file.
in sqlite3.c code we have authors joined all files into single one
to reach the same effect manually.

> The more grave problem is that Harbour executables won't start,
> but show this instead:
> ---
> Unrecoverable error 9998: Screen driver initialization failure
> ---

Becase we have some GT and RDD C REQUESTs just after hb_errInternal().
Now MSVC detects that this function never returns (it has at the and
exit()) and simply removed all code which is after thius function,
f.e. hbgtcore[3359]:
   hb_errInternal( 9998, "Screen driver initialization failure", NULL, NULL );

   /* force linking HB_GTSYS() */
   HB_FUNC_EXEC( HB_GTSYS );

If you want then you can cleanup all such bindings. But if MSVC
tries to be more clever then programmers then it won't help and
all such bindings in any locations will be pacified by optimizer.

> More on LTCG:
> http://msdn.microsoft.com/en-gb/magazine/cc301698.aspx
> _______________________________________________

As usual tone of words to describe very simple mechanism known from very
long time. "We are the leaders, wait for us."

best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to