[gambit-list] Native backend

Marc Feeley feeley at iro.umontreal.ca
Mon Oct 1 11:42:59 EDT 2018


> On Oct 1, 2018, at 4:24 AM, Alex Silva <asandroq at gmail.com> wrote:
> 
> Hallo,
> 
> On 29/09/18 21:29, Marc Feeley wrote:
>> For those interested in how the native backend for Gambit is progressing, here are some links to the paper that was presented yesterday at the Scheme workshop, and the slides of the talk.  Laurent Huberdeau did a great job!
>> 
> 
> This is very interesting! In which branch is this being developed? How
> can we try it out?

Here are the steps (on a x86-64 platform):

% git checkout cpu
% ./configure --enable-single-host CC="gcc -D___SUPPORT_LOWLEVEL_EXEC"
% make
% cp bin/gambcomp-C bin/gambcomp-x86-64
% cat > fib.scm
(declare (standard-bindings) (block) (not safe))

(define (fib n)
  (if (fx< n 2)
      n
      (fx+ (fib (fx- n 1))
           (fib (fx- n 2)))))

(pp (time (fib 40)))
^D
% gsc/gsc -:=. -target x86-64 fib.scm
% gsi/gsi fib
(time (fib 40))
    289 ms real time
    288 ms cpu time (288 user, 0 system)
    no collections
    no bytes allocated
    1 minor fault
    no major faults
102334155
% gsc/gsc -:=. fib.scm
% gsi/gsi fib
(time (fib 40))
    315 ms real time
    316 ms cpu time (316 user, 0 system)
    no collections
    no bytes allocated
    1 minor fault
    no major faults
102334155

Here is a list of the primitives that are inlined by the native backend.
If you use other primitives, they will be actual calls to the runtime
library compiled with the C backend (i.e. slow).  Remember that this is
work in progress and that some things are not yet optimized and some
things are unimplemented or broken.

##not                                                                           
##identity                                                                      

##fixnum?                                                                       
##pair?                                                                         
##null?                                                                         
##char?                                                                         
##special?                                                                      
##mem-allocated?                                                                

##fx+                                                                           
##fx+?                                                                          
##fx-                                                                           
##fx-?                                                                          
##fx<                                                                           
##fx<=                                                                          
##fx>                                                                           
##fx>=
##fx=                                                                           

##cons                                                                          
##car                                                                           
##cdr                                                                           
##set-car!                                                                      
##set-cdr!                                                                      

##vector-ref                                                                    
##vector-set!                                                                   
##vector-length                                                                 

So at this point the native backend is more a “proof of concept” and there is still lots of work to be done before this is a practical alternative to the C backend.

Marc




More information about the Gambit-list mailing list