* progress with native code generation in guile
@ 2012-06-09 17:47 Stefan Israelsson Tampe
2012-06-17 21:58 ` Ludovic Courtès
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Israelsson Tampe @ 2012-06-09 17:47 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1: Type: text/plain, Size: 922 bytes --]
Hi,
On linux, x86-64 I can now write,
(use-modules (native aschm))
(define b (asm
(inst mov rbx 1000000000) ;rbx = 1000,000,000
loop:
(inst cmp rbx 0)
(inst jmp #:eq out:)
(inst dec rbx)
(inst jmp loop:)
out:
(inst mov rax 2) ; return value in register rax
(inst pop rbx) ; we pushed the return adress before
(inst jmp rbx))) ; jump back
(mk-rwx b) ; Make the memory pages read write and
; execute
(run-native b) ; run the code using a simple scheme
And the code loops and return 0 (2).
So it is possible to generate assembler from whithin guile and execute it
which is pretty cool.
If you have the right architecture, you can play with it at:
https://gitorious.org/aschm
Have fun
Stefan
[-- Attachment #2: Type: text/html, Size: 1069 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: progress with native code generation in guile
2012-06-09 17:47 progress with native code generation in guile Stefan Israelsson Tampe
@ 2012-06-17 21:58 ` Ludovic Courtès
0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2012-06-17 21:58 UTC (permalink / raw)
To: guile-devel
Hi Stefan!
This sounds fun!
Similarly, there’s the old Guile-Lightning, which could achieve
something similar, albeit in an abstract ISA and not entirely in
Scheme. Might be worth a look.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-17 21:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-09 17:47 progress with native code generation in guile Stefan Israelsson Tampe
2012-06-17 21:58 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).