[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mescc is SLOW (it's running twice -- and other things might be too)
From: |
Ekaitz Zarraga |
Subject: |
Mescc is SLOW (it's running twice -- and other things might be too) |
Date: |
Fri, 22 Dec 2023 22:32:42 +0100 |
Hi,
Some people at #bootstrappable realized that the mescc was doing
everything twice as it's warnings appeared twice in the terminal.
I tracked down the issue and yes, it does since 0.26.
Adding some debugging shows it very obviously:
```
$ out-0.25.1/bin/mescc TEST.c -o HOLA -vvv
parsing: input
compiling: input
:main
dumping: TEST.s
$ out-0.26/bin/mescc TEST.c -o HOLA -vvv
parsing: input
compiling: input
:main
dumping: TEST.s
parsing: input
compiling: input
:main
dumping: TEST.s
```
I think the root of this comes from:
9bd6dfab5c2b8458b0d6ef4d2d530eaf012b0bbc
Let me elaborate.
This is `scripts/mescc.scm.in` (shortened for brevity):
```
#! @GUILE@ \
--no-auto-compile -e main -L @guile_site_dir@ -C @guile_site_ccache_dir@ -s
!#
...
(cond-expand
(mes
(if (current-module) (use-modules (mescc))
(mes-use-module (mescc)))
(mescc:main (command-line)))
(guile
(use-modules (mescc))))
(define (main args)
(mescc:main args))
```
This file runs `(mescc:main)` twice in Mes, but once in Guile.
The cond-expand there is running the mescc:main function but the main
below is being run automatically when running `mescc` in the command
line. I guess, because the module system knows how to do it
automatically, and before it didn't.
This is producing the double compilation issue and but might affect in
other parts of the code where similar approaches were taken (I didn't
check).
Will removing the `(mescc:main (command-line))` form the `cond-expand`
fix this, or do we need to track if the module system is loaded or not
and act accordingly?
I'm not sure about what's cleaner, I'll let you decide.
Thanks,
Ekaitz
- Mescc is SLOW (it's running twice -- and other things might be too),
Ekaitz Zarraga <=