I have Gambit 4b17 and I cannot compile syntax-case.scm with gcc 4.0 for some reason. It sits there forever doing something and gcc eats up 700Mb+ of memory. I'm on Mac OSX 10.4.4.
Has anyone tried this?
Thanks, Joel
Afficher les réponses par date
I can't compile syntax-case.scm on my machine, either, although I think that's mainly because I don't usually have enough free RAM, and gcc eventually dies with an allocation error or other fault.
For some code I ported to Gambit, all I needed was syntax-rules, and I had better luck with Al Petrofsky's portable syntax-rules expander:
http://petrofsky.org/src/alexpander.scm
...although it's a bit less convenient to use, because you have to pre-expand any source containing syntax-rules macros. Nothing a makefile can't handle, of course.
Another issue I ran into with syntax-case.scm is that its define-macro implementation isn't completely compatible with Gambit's native define-macro: it doesn't support the same syntax for rest arguments, i.e. (define-macro (foo a . b) ...) isn't supported. This is a problem if you're using macro-based code written for Gambit, although it could probably be fixed fairly easily. But using Alexpander resolved that too, since it doesn't affect Gambit's native define-macro.
Anton
Joel Reymont wrote:
I have Gambit 4b17 and I cannot compile syntax-case.scm with gcc 4.0 for some reason. It sits there forever doing something and gcc eats up 700Mb+ of memory. I'm on Mac OSX 10.4.4.
Has anyone tried this?
Thanks, Joel
Gambit-list mailing list Gambit-list@iro.umontreal.ca http://mailman.iro.umontreal.ca/mailman/listinfo/gambit-list
On Jan 25, 2006, at 12:02 PM, Anton van Straaten wrote:
I can't compile syntax-case.scm on my machine, either, although I think that's mainly because I don't usually have enough free RAM, and gcc eventually dies with an allocation error or other fault.
For some code I ported to Gambit, all I needed was syntax-rules, and I had better luck with Al Petrofsky's portable syntax-rules expander:
...
I have a question---is the time that syntax-case takes to expand your source code so long compared to the time required to compile or run your application that you need to compile syntax-case.scm rather than running it interpreted?
Brad
Bradley Lucier wrote:
On Jan 25, 2006, at 12:02 PM, Anton van Straaten wrote:
I can't compile syntax-case.scm on my machine, either, although I think that's mainly because I don't usually have enough free RAM, and gcc eventually dies with an allocation error or other fault.
For some code I ported to Gambit, all I needed was syntax-rules, and I had better luck with Al Petrofsky's portable syntax-rules expander:
...
I have a question---is the time that syntax-case takes to expand your source code so long compared to the time required to compile or run your application that you need to compile syntax-case.scm rather than running it interpreted?
No, I wanted to compile it in order to simplify distribution and installation -- a single executable with no dependencies makes life easy.
In any case, the compilation requirements weren't the main reason I stopped using syntax-case. I was in a hurry, and when I hit the define-macro issue I mentioned, I decided that the Alexpander, which I was already familiar with, would be the line of least resistance.
Anton
On Jan 24, 2006, at 6:51 PM, Joel Reymont wrote:
I have Gambit 4b17 and I cannot compile syntax-case.scm with gcc 4.0 for some reason. It sits there forever doing something and gcc eats up 700Mb+ of memory. I'm on Mac OSX 10.4.4.
On my machine (dual 2GHz G5 with 8GB of RAM running Mac OS X 10.4.4):
[lindv2:~/Desktop] lucier% time gsc -dynamic syntax-case.scm 309.737u 47.772s 7:22.84 80.7% 0+0k 1+59io 0pf+0w [lindv2:~/Desktop] lucier% wc syntax-case.c 204300 204865 8182241 syntax-case.c [lindv2:~/Desktop] lucier% ll syntax-case.* -rw-r--r-- 1 lucier lucier 8182241 Jan 25 12:49 syntax-case.c -rwxr-xr-x 1 lucier lucier 3596922 Jan 25 12:56 syntax-case.o1* -rw-r--r-- 1 lucier lucier 6584413 Jan 25 12:47 syntax-case.scm
So, yes, it will take a long time to compile, it's an 8MB C source file consisting of one C function (and even if --enable-single-host is not specified, the largest part of syntax-case.c is still one C function).
If you want to save a bit of time or space during the compile, you could add -D___OPTIMIZE_SPACE to the command line in gsc-cc-o wherever you installed gsc and gsi. Or, you could copy gambit.h to the local directory where you're trying to compile syntax-case.scm and add the define there:
[lindv2:~/Desktop] lucier% cp /usr/local/Gambit-C/include/gambit.h . [lindv2:~/Desktop] lucier% vi gambit.h [lindv2:~/Desktop] lucier% diff -p /usr/local/Gambit-C/include/ gambit.h gambit.h *** /usr/local/Gambit-C/include/gambit.h Thu Jan 19 15:17:50 2006 --- gambit.h Wed Jan 25 13:03:48 2006 *************** *** 1192,1197 **** --- 1192,1198 ---- * Determine optimization goal. */
+ #define ___OPTIMIZE_SPACE #ifdef ___OPTIMIZE_TIME #ifdef ___OPTIMIZE_SPACE @error "Define either ___OPTIMIZE_TIME or ___OPTIMIZE_SPACE" [lindv2:~/Desktop] lucier% time gsc -dynamic syntax-case.scm 265.037u 41.735s 6:14.30 81.9% 0+0k 1+49io 0pf+0w
Even then, I noticed that cc1 temporarily required 1.25GB of memory near the end of the compilation (just by monitoring top as cc1 ran).
Brad
On Jan 24, 2006, at 6:51 PM, Joel Reymont wrote:
I have Gambit 4b17 and I cannot compile syntax-case.scm with gcc 4.0 for some reason. It sits there forever doing something and gcc eats up 700Mb+ of memory. I'm on Mac OSX 10.4.4.
If you copy gambit.h to the directory where you compile syntax- case.scm and add
[lindv2:~/Desktop] lucier% diff -p /usr/local/Gambit-C/include/ gambit.h gambit.h *** /usr/local/Gambit-C/include/gambit.h Thu Jan 19 15:17:50 2006 --- gambit.h Wed Jan 25 13:03:48 2006 *************** *** 1192,1197 **** --- 1192,1198 ---- * Determine optimization goal. */
+ #define ___OPTIMIZE_SPACE #ifdef ___OPTIMIZE_TIME #ifdef ___OPTIMIZE_SPACE @error "Define either ___OPTIMIZE_TIME or ___OPTIMIZE_SPACE"
to it, and change the declarations in syntax-case.scm to
(##declare (standard-bindings) (extended-bindings) (block) (not inline) (inlining-limit 0) (mostly-generic) )
then you get
[lindv2:~/Desktop] lucier% time gsc -dynamic syntax-case.scm 128.354u 17.284s 3:20.60 72.5% 0+0k 0+50io 0pf+0w
instead of
[lindv2:~/Desktop] lucier% time gsc -dynamic syntax-case.scm 309.737u 47.772s 7:22.84 80.7% 0+0k 1+59io 0pf+0w
and gcc requires 700 MB of memory instead of 1.25 GB. If you'll have only fixnum renamed variables in your code and you assume that there aren't any errors in the syntax-case code you can try
(##declare (standard-bindings) (extended-bindings) (block) (not inline) (inlining-limit 0) (fixnum) (not safe) )
and gcc will require about 600 MB and you'll have a time of
time gsc -dynamic syntax-case.scm 97.977u 13.132s 2:38.54 70.0% 0+0k 0+49io 0pf+0w
Brad