guile-devel
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
progress with native code generation in guile
From
:
Stefan Israelsson Tampe
Subject
:
progress with native code generation in guile
Date
:
Sat, 9 Jun 2012 19:47:15 +0200
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
reply via email to
[Prev in Thread]
Current Thread
[
Next in Thread
]
progress with native code generation in guile
,
Stefan Israelsson Tampe
<=
Re: progress with native code generation in guile
,
Ludovic Courtès
,
2012/06/17
Prev by Date:
Re: Growable arrays?
Next by Date:
Re: Growable arrays?
Previous by thread:
subbytevectors
Next by thread:
Re: progress with native code generation in guile
Index(es):
Date
Thread