From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sjoerd van Leent Newsgroups: gmane.lisp.guile.devel Subject: Re: Attempt to create an inline assembler for Guile Date: Thu, 25 Jun 2015 18:10:34 +0200 Message-ID: References: <1435202845.12727.24.camel@Renee-desktop.suse> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0160c154080f87051959dd4e X-Trace: ger.gmane.org 1435248647 17936 80.91.229.3 (25 Jun 2015 16:10:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Jun 2015 16:10:47 +0000 (UTC) Cc: guile-devel To: Nala Ginrut Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jun 25 18:10:46 2015 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z89je-0005s7-1P for guile-devel@m.gmane.org; Thu, 25 Jun 2015 18:10:42 +0200 Original-Received: from localhost ([::1]:56477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z89jd-0000ZB-3I for guile-devel@m.gmane.org; Thu, 25 Jun 2015 12:10:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z89jY-0000V5-Sh for guile-devel@gnu.org; Thu, 25 Jun 2015 12:10:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z89jX-0008QG-Nt for guile-devel@gnu.org; Thu, 25 Jun 2015 12:10:36 -0400 Original-Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]:33868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z89jX-0008Q7-C9 for guile-devel@gnu.org; Thu, 25 Jun 2015 12:10:35 -0400 Original-Received: by lagx9 with SMTP id x9so48088340lag.1 for ; Thu, 25 Jun 2015 09:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wNa43oXWy1AHLJYPC5nrZi5hjhEUOf79P+IWEVyit3s=; b=xGKRLTOGvNnDIN08P2P431q1ENhztaANxCqy4hFx7Et2L/feVSD+oIsP8Uqr3V4cV/ xiVe79Sn9coc7YuzA6iSteYSWUVQ/aPS7KpkGgQNzD89EgloK04SjlK9AO2RTYYs9V5v jfkXlu8adge/RoTcD6g78ORc6Qx2rOP1SgSBgyvikx6GxlKfHPpaNDbj9mwJo+MtMe3z purABMyd9A3BKdhz0flpLXYeJN4/p1OMBS4yFFEdDU1ZxrzgWyU5PySf+Q+VEJZDSfdw /B3rX6Ahx0mfq3F/pS6RQeYOrR/hpAxhTreU29DynrzxdrHKVV1Mnyj2enQzdCbMQ47P wRgg== X-Received: by 10.152.37.102 with SMTP id x6mr45205655laj.69.1435248634627; Thu, 25 Jun 2015 09:10:34 -0700 (PDT) Original-Received: by 10.112.91.41 with HTTP; Thu, 25 Jun 2015 09:10:34 -0700 (PDT) Original-Received: by 10.112.91.41 with HTTP; Thu, 25 Jun 2015 09:10:34 -0700 (PDT) In-Reply-To: <1435202845.12727.24.camel@Renee-desktop.suse> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::235 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17755 Archived-At: --089e0160c154080f87051959dd4e Content-Type: text/plain; charset=UTF-8 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" : > 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 > > > --089e0160c154080f87051959dd4e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Nala

Ik actually use the underlying method in C at a number of ot= her 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 unfo= rtunate operating systems.

But you are right. The less in C, the better.

Op 25 jun. 2015 05:27 schreef "Nala Ginrut&= quot; <nalaginrut@gmail.com&= gt;:
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:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3Dcode=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D
(use-modules (system foreign))
(define ffi (dynamic-link))
(define sysconf
=C2=A0 (pointer->procedure int
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (dynamic-func "sysconf" ffi)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (list int)))

(sysconf 30) ; 30 stands for _SC_PAGESIZE
=3D=3D> 4096
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3Dend=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D

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


--089e0160c154080f87051959dd4e--