texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] Current work, nogencc and tree in generic programming


From: David Allouche
Subject: Re: [Texmacs-dev] Current work, nogencc and tree in generic programming
Date: Sun, 28 Apr 2002 18:06:09 +0200

On Sunday 28 April 2002 16:45, Joris van der Hoeven wrote:

> I am testing your changes. I am sorry for my blunt answer to your
> anti-gencc manifesto, but I am also sorry that you did not understand
> the reason behind this answer: I meant to make it clear that a profound
[snip]
> make many changes in the C++ code in the near future). Also, I might
> have spared you some time as to further changes which will be
> necessary.

I wanted to do it now for several reasons:

1. I wanted a completely crossreferenced Doxygen, missing 
cross-references due to the unresolved smart pointer's operator-> 
dramatically reduced the usefulness of the tool. There were probably 
other hidden problemes too.

2. I wanted to use templates for my project, just because C++ has 
templates and I know how to program in C++.

3. Since we are doing a lot of promotion, improving 
developper-friendliness is as much a priority as improving 
user-friendliness.

Anyway I think there is no point to debate on that. The work is done, the 
problem now is getting it at level for inclusion in the main 
distribution, and that require some stuff I cannot do by myself, like 
fixing the installer and testing the build on all platforms.

> 1. The compilation starts with error messages
>
> make[1]: Entering directory
> `/home/vdhoeven/texmacs/contrib/allouche/TeXmacs-1.0.0.1-nogencc-0.5-sr
>c/src' makefile:73: Deps/fromtm.d: No such file or directory
> makefile:73: Deps/scheme.d: No such file or directory
> makefile:73: Deps/totm.d: No such file or directory
> makefile:73: Deps/tree.d: No such file or directory
> ...
>
> This is not very logical

That is indeed a bit dirty. The problem is that it uses gmake features 
for automatic dependences resolution.

The gmake info documentation (node: How Makefiles Are Remade) says:

    To this end, after reading in all makefiles, `make' will consider
    each as a goal target and attempt to update it.

When first compiling from a clean distribution, the .d files are not 
present, so the first pass inclusion fails, and then the .d files are 
made.

I will fix that by defining a "deps" target to create the .d files, and 
move the removal of those files (as well as the Objects/*.rpo files) in a 
new "maintainer-clean" target.

> 2. The compilation time is much longer than before, even though we only
>    use -O2: this is bad.

That is true. That is a problem with the stupid automatic template 
instanciation of g++2 (I do not know if g++3 is any smarter). A template 
is instanciated (its code is generated) at the point where it is first 
needed in a translation unit. This causes a lot of duplicate code 
generation. At link time, the collect wrapper recompiles the units as 
necessary until there is no duplicate code. The resulting information 
about where templates must be instanciated is stored in the Objects/*.rpo 
files, so subsequent compilations generate almost no duplicate code.

We can speed up the compilation by moving the removal of the .rpo files 
to the maintainer-clean target.

We could also increase the size of the compilation units, by compiling 
only .cc files containing only #include "xxx.cc" directives. However I 
find this solution way too hackish because it make the .cc files

> 3. You systematically use
>
> -I Basic/Data -I Basic/Misc -I Basic/System -I Basic/Types -I Resource
> -I Window -I Typeset -I Edit -I Convert -I Texmacs -I Guile
>
> in the compilation options, even when some of them are not necessary.
>
> 4. It might have been nice to change all .gen.h to .hh.
> I did not know 4 years ago that it is was possible to use
> the .hh suffix, but this is better for highlighting in Emacs.
>
> 5. The makefile breaks at the linking stage:
>
> Objects/instanciations.o: In function `hashmap_iterator_rep<string,
> void *> type_info function':
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z6
>stringZPv+0x11): undefined reference to `iterator_rep<string> type_info
> function'
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z6
>stringZPv+0x17): undefined reference to `iterator_rep<string> type_info
> node'
> Objects/instanciations.o: In function `hashmap_iterator_rep<tree,
> unsigned long> type_info function':
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z4
>treeZUl+0x10): undefined reference to `iterator_rep<tree> type_info
> function'
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z4
>treeZUl+0x16): undefined reference to `iterator_rep<tree> type_info
> node'
> Objects/instanciations.o: In function `hashmap_iterator_rep<string,
> tree> type_info function':
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z6
>stringZ4tree+0x11): undefined reference to `iterator_rep<string>
> type_info function'
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z6
>stringZ4tree+0x17): undefined reference to `iterator_rep<string>
> type_info node'
> Objects/instanciations.o: In function `hashmap_iterator_rep<string,
> int> type_info function':
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z6
>stringZi+0x10): undefined reference to `iterator_rep<string> type_info
> function'
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z6
>stringZi+0x16): undefined reference to `iterator_rep<string> type_info
> node'
> Objects/instanciations.o: In function `hashmap_iterator_rep<string,
> string> type_info function':
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z6
>stringZ6string+0x11): undefined reference to `iterator_rep<string>
> type_info function'
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2Z6
>stringZ6string+0x17): undefined reference to `iterator_rep<string>
> type_info node'
> Objects/instanciations.o: In function `hashmap_iterator_rep<unsigned
> long, void *> type_info function':
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2ZU
>lZPv+0x11): undefined reference to `iterator_rep<unsigned long>
> type_info function'
> Objects/instanciations.o(.gnu.linkonce.t.__tft20hashmap_iterator_rep2ZU
>lZPv+0x17): undefined reference to `iterator_rep<unsigned long>
> type_info node' collect2: ld returned 1 exit status
> make[1]: ***
> [/home/vdhoeven/texmacs/contrib/allouche/TeXmacs-1.0.0.1-nogencc-0.5-sr
>c/TeXmacs-1.0.0.1/bin/texmacs.bin] Error 1
> make[1]: Leaving directory
> `/home/vdhoeven/texmacs/contrib/allouche/TeXmacs-1.0.0.1-nogencc-0.5-sr
>c/src' make: *** [TEXMACS] Error 2
>
> 6. What are the comments of the form
>
> // Local Variables:
> // mode: c++
> // c-basic-offset: 2
> // End:
>
> doing at the end of each file?
>
> More comments will follow as soon as you have a working version for me.
> It is important that the change does not induce any kind of performance
> loss whatsoever. For instance, it should be checked that -O2 is as
> efficient as -O3 with the extra options.
>
> Thanks, <Joris>
>
>
> _______________________________________________
> Texmacs-dev mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/texmacs-dev

-- 

                                  -- David --



reply via email to

[Prev in Thread] Current Thread [Next in Thread]