Re: [Chicken-users] x32 ABI fits Chicken very well

2015-09-01 Thread Peter Bex
On Tue, Sep 01, 2015 at 07:51:42AM +0200, Sven Hartrumpf wrote:
> Hi all.
> 
> Now that the "apply-hack" files are gone, Chicken is even more portable.
> I am happy to report that Chicken 4.10.1 builds perfectly for the x32 ABI
> ( https://en.wikipedia.org/wiki/X32_ABI ).

Wow, this is very cool!  Thank you for trying this and reporting your
experiences!  I've added it to the portability page at
http://wiki.call-cc.org/portability

> Why should you try x32 that most people ignore?
> - For garbage-intense Scheme program, you will see speed-ups of 10 to 30 %
>   compared to x86-64 because the GC has less work to do.
> - You can expect speed-ups of 20 - 30 % compared to i386 because all
>   registers are available (on a 64bit CPU) and the full CPU instruction
>   set is usable by Chicken's C compiler.

This is cool. There's one important caveat: bytevectors (ie, strings and
blobs) are limited to 16MiB.  This is the same limit that applies to i386,
which I think is one of the most important limitations of 32 bit CHICKEN.

> Write a small gccx32 script like:
> #!
> gcc -mx32 $*
> 
> > export CC=gccx32
> > export ARCH=x86-64

I'm a bit unsure about the use of the ARCH option.  Is it still needed
now that we have dropped the apply hack?  So far, it seems to be used
for Mac's universal builds (it passes a -m64 option there).  Perhaps we
can add a similar option for Makefile.linux to support x32 directly?

Can you try whether the attached patch works without requiring the
gccx32 script?  The idea is that you can do simply "make ARCH=x32"
with this.

Cheers,
Peter
diff --git a/Makefile.linux b/Makefile.linux
index 45ae3a2..9dafd45 100644
--- a/Makefile.linux
+++ b/Makefile.linux
@@ -50,6 +50,14 @@ LIBRARIES = -lm -ldl
 NEEDS_RELINKING = yes
 USES_SONAME = yes
 
+# architectures
+
+ifeq ($(ARCH),x32)
+C_COMPILER_OPTIONS += -mx32
+# Is this needed?
+#LINKER_OPTIONS += -mx32
+endif
+
 # special files
 
 CHICKEN_CONFIG_H = chicken-config.h


signature.asc
Description: Digital signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] x32 ABI fits Chicken very well

2015-09-01 Thread Daniel Leslie
On Tue, Sep 1, 2015 at 12:53 AM, Peter Bex  wrote:

> This is the same limit that applies to i386,
> which I think is one of the most important limitations of 32 bit CHICKEN.
>

Worth noting is that OpenBSD still supports i386, which is mentioned as a
platform in the wiki:
http://wiki.call-cc.org/platforms#openbsd
http://www.openbsd.org/i386.html

-Dan
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] x32 ABI fits Chicken very well

2015-09-01 Thread Peter Bex
On Tue, Sep 01, 2015 at 08:03:02AM -0700, Daniel Leslie wrote:
> On Tue, Sep 1, 2015 at 12:53 AM, Peter Bex  wrote:
> 
> > This is the same limit that applies to i386,
> > which I think is one of the most important limitations of 32 bit CHICKEN.
> >
> 
> Worth noting is that OpenBSD still supports i386, which is mentioned as a
> platform in the wiki:
> http://wiki.call-cc.org/platforms#openbsd
> http://www.openbsd.org/i386.html

I'm not sure what you're trying to say here.  Linux and most other OSes
also still support i386 for the foreseeable future.

Just for the record, we don't intend to drop support for i386 in CHICKEN;
this just _adds_ support for x32, which itself is a mode that only works
on x86-64 CPUs and only on Linux (correct me if I'm wrong).

Cheers,
Peter


signature.asc
Description: Digital signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users