From 3e2fc19b889726f40c41be66758dad283a7be20d Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 11 Apr 2009 16:16:08 +0000 Subject: [PATCH] 2009-04-11 18:23 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/Makefile * harbour/source/vm/vmmt/Makefile + harbour/source/vm/hvmall.c % added optional compilation HVM core files as single unit. It allows to use interprocedural optimizations for all defined functions. It's useful when compiler does not support IPO at link time. It should give some noticeable speed improvement for compilers which can benefit from such optimizations, f.e. GCC, ICC, MSVC. In my Linux box (GCC 4.3) it gives ~7% speed improvement in speedtst.prg linked with ST HVM and a little bit more in MT mode. It's interesting that it also reduces the HVM library size. At least for GCC builds. Set HB_HVM_ALL=yes envvar to enable such compilation. Warning some compiler may not compile such long single C file. --- harbour/ChangeLog | 16 +++++++ harbour/source/vm/Makefile | 43 +++++++++++------- harbour/source/vm/hvmall.c | 80 +++++++++++++++++++++++++++++++++ harbour/source/vm/vmmt/Makefile | 43 +++++++++++------- 4 files changed, 150 insertions(+), 32 deletions(-) create mode 100644 harbour/source/vm/hvmall.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9b9e505dab..9ecdcbdd34 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,22 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-11 18:23 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/vm/Makefile + * harbour/source/vm/vmmt/Makefile + + harbour/source/vm/hvmall.c + % added optional compilation HVM core files as single unit. + It allows to use interprocedural optimizations for all defined + functions. It's useful when compiler does not support IPO at link + time. It should give some noticeable speed improvement for compilers + which can benefit from such optimizations, f.e. GCC, ICC, MSVC. + In my Linux box (GCC 4.3) it gives ~7% speed improvement in + speedtst.prg linked with ST HVM and a little bit more in MT mode. + It's interesting that it also reduces the HVM library size. + At least for GCC builds. + Set HB_HVM_ALL=yes envvar to enable such compilation. + Warning some compiler may not compile such long single C file. + 2009-04-11 17:25 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/common/hbver.c + Added skeleton for hb_verHostCPU() diff --git a/harbour/source/vm/Makefile b/harbour/source/vm/Makefile index 573a829331..db42c298f5 100644 --- a/harbour/source/vm/Makefile +++ b/harbour/source/vm/Makefile @@ -24,41 +24,52 @@ else endif endif +ifeq ($(HB_HVM_ALL),yes) + +C_SOURCES=\ + hvmall.c \ + +else + C_SOURCES=\ hvm.c \ arrays.c \ - arrayshb.c \ - asort.c \ - break.c \ classes.c \ - cmdarg.c \ - debug.c \ - dynlibhb.c \ dynsym.c \ codebloc.c \ estack.c \ - eval.c \ - evalhb.c \ extend.c \ - extrap.c \ fm.c \ garbage.c \ hashes.c \ + itemapi.c \ + macro.c \ + memvars.c \ + set.c \ + thread.c \ + +endif + +C_SOURCES+=\ + arrayshb.c \ + asort.c \ + break.c \ + cmdarg.c \ + debug.c \ + dynlibhb.c \ + eval.c \ + evalhb.c \ + extrap.c \ hashfunc.c \ initexit.c \ initsymb.c \ - itemapi.c \ - macro.c \ - $(C_MAIN) \ - memvars.c \ memvclip.c \ pcount.c \ - proc.c \ pvalue.c \ + proc.c \ runner.c \ - set.c \ - thread.c \ vm.c \ + $(C_MAIN) \ PRG_SOURCES=\ harbinit.prg \ diff --git a/harbour/source/vm/hvmall.c b/harbour/source/vm/hvmall.c new file mode 100644 index 0000000000..c15976c8e4 --- /dev/null +++ b/harbour/source/vm/hvmall.c @@ -0,0 +1,80 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * common file with all HVM functions for compilers which can improve + * speed automatically inlining functions + * + * Copyright 2009 Przemyslaw Czerpak + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* this #define HAVE TO be placed before all #include directives + */ +#define _HB_HASH_INTERNAL_ +#define HB_MACRO_SUPPORT + +#define HB_NO_FALTTEN +#define HB_STACK_LOCAL_MACROS + +/* warning the order of included files is important + * due to macros used to overload some functions + */ + +#include "hvm.c" +#include "itemapi.c" +#include "hashes.c" +#include "arrays.c" +#include "classes.c" +#include "codebloc.c" +#include "dynsym.c" +#include "macro.c" +#include "set.c" +#include "memvars.c" +#include "thread.c" +#include "garbage.c" +#include "fm.c" +#include "extend.c" +#include "estack.c" diff --git a/harbour/source/vm/vmmt/Makefile b/harbour/source/vm/vmmt/Makefile index 8cdb3ba424..71aa2e96ce 100644 --- a/harbour/source/vm/vmmt/Makefile +++ b/harbour/source/vm/vmmt/Makefile @@ -25,41 +25,52 @@ else endif endif +ifeq ($(HB_HVM_ALL),yes) + +C_SOURCES=\ + hvmall.c \ + +else + C_SOURCES=\ hvm.c \ arrays.c \ - arrayshb.c \ - asort.c \ - break.c \ classes.c \ - cmdarg.c \ - debug.c \ - dynlibhb.c \ dynsym.c \ codebloc.c \ estack.c \ - eval.c \ - evalhb.c \ extend.c \ - extrap.c \ fm.c \ garbage.c \ hashes.c \ + itemapi.c \ + macro.c \ + memvars.c \ + set.c \ + thread.c \ + +endif + +C_SOURCES+=\ + arrayshb.c \ + asort.c \ + break.c \ + cmdarg.c \ + debug.c \ + dynlibhb.c \ + eval.c \ + evalhb.c \ + extrap.c \ hashfunc.c \ initexit.c \ initsymb.c \ - itemapi.c \ - macro.c \ - $(C_MAIN) \ - memvars.c \ memvclip.c \ pcount.c \ - proc.c \ pvalue.c \ + proc.c \ runner.c \ - set.c \ - thread.c \ vm.c \ + $(C_MAIN) \ PRG_SOURCES=\ harbinit.prg \