From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: wip-rtl native patch Date: Thu, 9 Aug 2012 20:59:05 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=e89a8f234cbf55334f04c6d9d2c7 X-Trace: dough.gmane.org 1344538761 24436 80.91.229.3 (9 Aug 2012 18:59:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Aug 2012 18:59:21 +0000 (UTC) Cc: guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Aug 09 20:59:20 2012 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 1SzXww-00084t-2d for guile-devel@m.gmane.org; Thu, 09 Aug 2012 20:59:14 +0200 Original-Received: from localhost ([::1]:58138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzXwv-0005U1-4C for guile-devel@m.gmane.org; Thu, 09 Aug 2012 14:59:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzXwr-0005Tq-JL for guile-devel@gnu.org; Thu, 09 Aug 2012 14:59:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzXwp-0004bl-9m for guile-devel@gnu.org; Thu, 09 Aug 2012 14:59:09 -0400 Original-Received: from mail-gh0-f169.google.com ([209.85.160.169]:38185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzXwp-0004bR-3j for guile-devel@gnu.org; Thu, 09 Aug 2012 14:59:07 -0400 Original-Received: by ghrr18 with SMTP id r18so918018ghr.0 for ; Thu, 09 Aug 2012 11:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=JWDQ1PeYBMmDCrTv0wMtvNQILl1wfd4MizsPubSR990=; b=BgYHgs+kr5duFzVJq/eIDhVZH1L/UsPO//dzRLphHsGsoDZ0TU3MceYaaC8XAZmHJA kTZZZBfqxBGUEJueO5dPwkD3FY2tDeOCHNsv82v1/UkHRkx8A7q2hGxq30gEz3nOXiX2 /Xf4eVpphnTHtsr8sGiehrP0mCdShw+sfgwEsA8YfklCx5g/Jtj0oEUxUpKUFrfviuRt P55wqvg88CYJq9sWNWfPkheSrDs+FvYgvOpbUMW6eTjEAFIBjOY2n7hM7AQZzcot6opb KMpZH/BKMAMbd+Sg401ujJF04QcCOi+u/Ck/VIwFTJsbpBarf9uPpxl3tmzg+eJHS/nT eNzA== Original-Received: by 10.50.104.228 with SMTP id gh4mr2166368igb.71.1344538745844; Thu, 09 Aug 2012 11:59:05 -0700 (PDT) Original-Received: by 10.50.41.196 with HTTP; Thu, 9 Aug 2012 11:59:05 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.169 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:14786 Archived-At: --e89a8f234cbf55334f04c6d9d2c7 Content-Type: multipart/alternative; boundary=e89a8f234cbf55334a04c6d9d2c5 --e89a8f234cbf55334a04c6d9d2c5 Content-Type: text/plain; charset=ISO-8859-1 Hi, DO you think that this will do as an initial patch to wip-rtl in order to introduce the possibility to execute native code or JIT:ed code. We reserve the first two indexes in the ip text area to fit a pointer to native code to be executed. There is changes to two parts of the code 1. module/system/vm/rtl.scm, we wrap the make-asm record constructor to initiate the first two slots to 0 and advance the index pointer. 2. We add code in libguile/cm-engine.c rtl function execution stubs to include a check for 0 at the initial two/one positions in ip. depending on architecture this will lead to a nonzero value in the case native code should be executed. Currently the code will abort if the head is nonzero but this will change of cause as we introduce more code. When the head is zero the ip is incremented two steps and the code executes as usual. A cavet could be if writing compiled code out to disk is done lately when native code have been compiled in. In this case we should clean the native part (In the jit case). I did not find where the code that does this is located so I left it open for now. /Stefan --e89a8f234cbf55334a04c6d9d2c5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

DO you think that this will do as an initial patch to wip-rtl in= order to introduce the possibility to
execute native code or JIT:ed cod= e. We reserve the first two indexes in the ip text area to fit
a pointer= to native code to be executed.

There is changes to two parts of the code
1.=A0 module/system/vm/rtl= .scm, we wrap the make-asm record constructor to initiate the first
two = slots to 0 and advance the index pointer.

2. We add code in libguile= /cm-engine.c rtl function execution stubs to include a check for 0 at the i= nitial
two/one positions in ip. depending on architecture this will lead to a nonz= ero value in the case native code should be executed. Currently the code wi= ll abort if the head is nonzero but this will change of cause as we introdu= ce more code. When the head is zero the ip is incremented two steps and the= code executes as usual.

A cavet could be if writing compiled code out to disk is done lately wh= en native code have been compiled in. In this case we should clean the nati= ve part (In the jit case). I did not find where the code that does this is = located so I left it open for now.

/Stefan
--e89a8f234cbf55334a04c6d9d2c5-- --e89a8f234cbf55334f04c6d9d2c7 Content-Type: application/octet-stream; name="native-wip-rtl.diff" Content-Disposition: attachment; filename="native-wip-rtl.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h5o7snr10 ZGlmZiAtLWdpdCBhL2xpYmd1aWxlL3ZtLWVuZ2luZS5jIGIvbGliZ3VpbGUvdm0tZW5naW5lLmMK aW5kZXggMTU2YjM3My4uZmZhMzJkMiAxMDA2NDQKLS0tIGEvbGliZ3VpbGUvdm0tZW5naW5lLmMK KysrIGIvbGliZ3VpbGUvdm0tZW5naW5lLmMKQEAgLTk5MCw2ICs5OTAsMTggQEAgUlRMX1ZNX05B TUUgKFNDTSB2bSwgU0NNIHByb2dyYW0sIFNDTSAqYXJndiwgc2l6ZV90IG5hcmdzXykKICAgICog YWZ0ZXIgdGhlIGVuZCBvZiB0aGUgYGNhbGwnIGluc3RydWN0aW9uLiAgVGhlIHdvcmQgZm9sbG93 aW5nIHRoYXQKICAgICogaXMgdGhlIFJBLgogICAgKi8KKworI2RlZmluZSBDSEVDS19OQVRJVkUo aXApICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGlmKCooKHNjbV90X2JpdHMg KikgaXApID09IDApICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgaXAgKz0gMjsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfSAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZWxzZSAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHsgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAv KiBuYXRpdmUgY29kZSBub3QgaW1wbGVtZW50ZWQgKi8gICAgICAgICAgICAgICAgIFwKKyAgICAg IGFib3J0KCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAg IH0KKwogICBWTV9ERUZJTkVfT1AgKDIsIGNhbGwsICJjYWxsIiwgT1AzIChVOF9VMjQsIFg4X1Uy NCwgWDhfUjI0KSkKICAgICB7CiAgICAgICBzY21fdF91aW50MzIgZnJvbSwgcHJvYywgbjsKQEAg LTEwMTgsNiArMTAzMCwxMCBAQCBSVExfVk1fTkFNRSAoU0NNIHZtLCBTQ00gcHJv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