* Attempt to create an inline assembler for Guile
@ 2015-06-24 19:41 Sjoerd van Leent
2015-06-25 3:27 ` Nala Ginrut
2015-07-16 19:17 ` Ludovic Courtès
0 siblings, 2 replies; 4+ messages in thread
From: Sjoerd van Leent @ 2015-06-24 19:41 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1: Type: text/plain, Size: 423 bytes --]
Hi All,
In line with my will to create an assembler, I started first by being able
to execute something in memory, using the memory-mapper strategy. I am
aware not all platforms use the same mechanism, but this is a starting
point.
At a later point, an inline assembler can be used by a (more abstract) JIT
engine
I put my repository here:
https://github.com/santidhammo/guile-assembler
Met vriendelijke groet,
Sjoerd
[-- Attachment #2: Type: text/html, Size: 676 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Attempt to create an inline assembler for Guile
2015-06-24 19:41 Attempt to create an inline assembler for Guile Sjoerd van Leent
@ 2015-06-25 3:27 ` Nala Ginrut
2015-06-25 16:10 ` Sjoerd van Leent
2015-07-16 19:17 ` Ludovic Courtès
1 sibling, 1 reply; 4+ messages in thread
From: Nala Ginrut @ 2015-06-25 3:27 UTC (permalink / raw)
To: Sjoerd van Leent; +Cc: guile-devel
nice work!
I may take look at it closely.
And I would recommend you use FFI if you just want to get pagesize, it's
easier than writing bunch of C code:
=============================code========================
(use-modules (system foreign))
(define ffi (dynamic-link))
(define sysconf
(pointer->procedure int
(dynamic-func "sysconf" ffi)
(list int)))
(sysconf 30) ; 30 stands for _SC_PAGESIZE
==> 4096
==============================end=======================
Happy hacking!
On Wed, 2015-06-24 at 21:41 +0200, Sjoerd van Leent wrote:
> Hi All,
>
> In line with my will to create an assembler, I started first by being able
> to execute something in memory, using the memory-mapper strategy. I am
> aware not all platforms use the same mechanism, but this is a starting
> point.
>
> At a later point, an inline assembler can be used by a (more abstract) JIT
> engine
>
> I put my repository here:
>
> https://github.com/santidhammo/guile-assembler
>
> Met vriendelijke groet,
> Sjoerd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Attempt to create an inline assembler for Guile
2015-06-25 3:27 ` Nala Ginrut
@ 2015-06-25 16:10 ` Sjoerd van Leent
0 siblings, 0 replies; 4+ messages in thread
From: Sjoerd van Leent @ 2015-06-25 16:10 UTC (permalink / raw)
To: Nala Ginrut; +Cc: guile-devel
[-- Attachment #1: Type: text/plain, Size: 1492 bytes --]
Hi Nala
Ik actually use the underlying method in C at a number of other places. And
I am uncertain that other posixen might use other numbers. So I considered
exporting it directly.
In any case, the sysconf won't work on a handful of unfortunate operating
systems.
But you are right. The less in C, the better.
Op 25 jun. 2015 05:27 schreef "Nala Ginrut" <nalaginrut@gmail.com>:
> nice work!
> I may take look at it closely.
> And I would recommend you use FFI if you just want to get pagesize, it's
> easier than writing bunch of C code:
> =============================code========================
> (use-modules (system foreign))
> (define ffi (dynamic-link))
> (define sysconf
> (pointer->procedure int
> (dynamic-func "sysconf" ffi)
> (list int)))
>
> (sysconf 30) ; 30 stands for _SC_PAGESIZE
> ==> 4096
> ==============================end=======================
>
> Happy hacking!
>
> On Wed, 2015-06-24 at 21:41 +0200, Sjoerd van Leent wrote:
> > Hi All,
> >
> > In line with my will to create an assembler, I started first by being
> able
> > to execute something in memory, using the memory-mapper strategy. I am
> > aware not all platforms use the same mechanism, but this is a starting
> > point.
> >
> > At a later point, an inline assembler can be used by a (more abstract)
> JIT
> > engine
> >
> > I put my repository here:
> >
> > https://github.com/santidhammo/guile-assembler
> >
> > Met vriendelijke groet,
> > Sjoerd
>
>
>
[-- Attachment #2: Type: text/html, Size: 2087 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Attempt to create an inline assembler for Guile
2015-06-24 19:41 Attempt to create an inline assembler for Guile Sjoerd van Leent
2015-06-25 3:27 ` Nala Ginrut
@ 2015-07-16 19:17 ` Ludovic Courtès
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-07-16 19:17 UTC (permalink / raw)
To: guile-devel
Sjoerd van Leent <svanleent@gmail.com> skribis:
> I put my repository here:
>
> https://github.com/santidhammo/guile-assembler
Regarding executable pages, I think you can avoid C altogether by using
‘mmap’ from libc via the FFI:
(define mmap
(let* ((ptr (dynamic-func "mmap" (dynamic-link)))
(proc (pointer->procedure '* ptr (list ...))))
(lambda (x y z)
(pointer->bytevector (proc x y z) ...))))
Besides, that looks like a nice project!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-16 19:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-24 19:41 Attempt to create an inline assembler for Guile Sjoerd van Leent
2015-06-25 3:27 ` Nala Ginrut
2015-06-25 16:10 ` Sjoerd van Leent
2015-07-16 19:17 ` 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).