From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57925 invoked by alias); 23 Jan 2020 22:47:19 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 57910 invoked by uid 89); 23 Jan 2020 22:47:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE,KAM_SHORT,MIME_QP_LONG_LINE,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=H*c:MHil, H*c:HpplH, welcome!, HX-Spam-Relays-External:sk:mailout X-HELO: out1-smtp.messagingengine.com Received: from out1-smtp.messagingengine.com (HELO out1-smtp.messagingengine.com) (66.111.4.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2020 22:47:15 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id C876D21FBC; Thu, 23 Jan 2020 17:47:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 23 Jan 2020 17:47:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= medranocalvo.com; h=from:message-id:content-type:mime-version :subject:date:in-reply-to:cc:to:references; s=fm1; bh=R9+ol0EDjO VSRNlIKvKoqRre3k3CrJfaGKWpBu5romU=; b=nCSUVsGX9+1g26E/zG4/Mzv4ZE i0Uh+heb1pN+z5C3+YvYQVIHkOX0EUbv5uhRbJ2vGRHYv9IJBQe8DpVp0aKYROBD l5VFYi05B7PeHPGNapyFgcZblas5P8KUu9RGG/gF/j17ps8ape2cqlR6Tj9x9Jba QaTqzKfJoxOZfWcy/4k9Zdb38PFCttCUqAukx2lED+DKLx1lYZa79m+lgmtWFUUq i8qzShCX3VgmBj6vjEm1/9C6dL4bc9E7kIAQ2bFprZluhS0VLU026gXqBS2NeZK6 kP7dLKOpj6c4IaK3dAIKU9R/mAJJctcWp/Tvfkxcqbzpc27WxGW49JbPqGKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=R9+ol0 EDjOVSRNlIKvKoqRre3k3CrJfaGKWpBu5romU=; b=TCeIqC+OZj5p8nu1iQU/0h qoUQQGkF3QGzPw2Sw3bjSGtPR57OwUV+myEuoKY7eWEd+XdzfxQ8QCRYFAHdPWdy Y7xlQFFeyjOaZq3GNjLCMM0BHeqm164KalcYMGwYYOVsJQWCLIkvoIScPvJ4lJHd JCET6sKP8qWaw1kszdD4nNJeNnTOCDNZqxEprvXuWVR15Mfc14BldDN3ATHzPLRs 6D55wIJtztfmedhxosTZDsns0tYrTy8cyGQSek36R7BXo9HExXQf/g6VAxGIP7HY GU8bHynC40QHCEBm7rg5nc06UOXpSNx5oObIi/+R8DVJLGIOSSH9t4o1O0wj4/lA == X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrvddvgddutddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffktgggufffjgfvfhfosegrtdhmrehhtdejnecuhfhrohhmpeetughrihoj nhcuofgvughrrgpiohcuvegrlhhvohcuoegrughrihgrnhesmhgvughrrghnohgtrghlvh hordgtohhmqeenucffohhmrghinhepghhithhhuhgsrdgtohhmpdhprhhotggvughurhgv rdihohhupdhgnhhurdhorhhgpdgsohhthhhnvghrrdgtohhmnecukfhppeejjedrudekle drvddvrdejtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpegrughrihgrnhesmhgvughrrghnohgtrghlvhhordgtohhm Received: from amcmpro.fritz.box (x4dbd1646.dyn.telefonica.de [77.189.22.70]) by mail.messagingengine.com (Postfix) with ESMTPA id 139913060ACE; Thu, 23 Jan 2020 17:47:12 -0500 (EST) From: =?utf-8?Q?Adri=C3=A1n=20Medra=C3=B1o=20Calvo?= Message-Id: <5ADDBD63-E3E2-4A55-992A-FDD77FEA55D1@medranocalvo.com> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: Porting SLAYER to Android Date: Thu, 23 Jan 2020 22:47:00 -0000 In-Reply-To: Cc: Panicz Maciej Godek , kawa@sourceware.org To: Per Bothner References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-q1/txt/msg00015.txt Dear Panicz Maciej Godek, Per Bothner, > On 20. Jan 2020, at 16:12, Per Bothner wrote: >=20 > On 1/19/20 1:43 AM, Panicz Maciej Godek wrote: >=20 >> Now, I've been thinking about porting this project to the Android platfo= rm. >> But I know very little about Java, and even less about Android. >=20 > Welcome! >=20 > I did port Kawa to Android years ago, but I generally don't do much if any > Android programming. I know very little about the state of Android progr= amming, > but I believe there are people on this list who know more. I successfully integrated dx.jar with Kawa, though would need more work (an= d guidance). My approach was to expose some parts of KawaClassLoader so th= at I could implement a separate DexKawaClassLoader. There=E2=80=99s also https://github.com/medranocalvo/gradle-kawa-plugin . I worked on updating it= for newer Android Plugin for Gradle, but never published the updates. I have very little free time. If I find any, I=E2=80=99ll clean up the cha= nges open a pull request for further discussion, and update the gradle plug= in. Best regards, Adri=C3=A1n. >=20 >> - is there some class that could be used to represent the Kawa closures = in >> Java that could be stored in an array and invoked from Java? >=20 > If you eval Scheme lambda (as a string or an s-expression) the result is= a Java object - > specifically an instance of the class gnu.mapping.Procedure. You can def= initely > store that in an array and invoke it from Java. >=20 >> In the documentation, I have found this: >> https://www.gnu.org/software/kawa/Evaluating-Scheme-expressions-from-Jav= a.html >> but the question is whether the Scheme.eval method compiles the expressi= on >> (if it's, say, a function) or only interprets it? >=20 > The terms "compiling" and "interpreting" are vague and have various gray = areas. > Kawa on normal platforms (i.e. not Android/Dalvik) doesn't really disting= uish: > When a Scheme form it evaluated (as in the eval function/method or a REPL= ), > it is parsed, compiled to a bytecode class, and then a method in that cla= ss > is called. Then the bytecode is thrown away. However, if the eval result > is a function (or an object like a list that contains a function), then > of course the function is preserved as long as there is a reference to it, > which means that the bytecode is preserved and reused each time the funct= ion is called. >=20 > So yes, the evaluating a function compiles it to bytecode only once, and > reuses the bytecode each time it is called. >=20 > On Android the situation is different. It used its own non-standard bytec= ode and > virtual machine "Dalvik". Generating "Dalvik" bytecode is not supported b= y Kawa, > so instead Kawa just generates its internal "AST" data type (the Expressi= on > class) and then evaluates it. >=20 > It should be possible to generate regular JVM bytercode and then convert = them > as needed to Dalvik using dx.jar. However, I haven't tried that - someon= e else may have. >=20 > The Dalvik VM is discontinued, but Dalvik bytecode is still used for > distribution. I don't know what tools are used these days to generate > code on-the-fly on Android. >=20 >> - given some text file, is there any way to obtain some representations = of >> the subsequent s-expressions from that file? >=20 > If you literally means the s-expressions, that is what the standard Schem= e read > procedure does. If you mean the Kawa AST, I don't think there is a offic= ial > documented way to do that, but it is of course possible and probably simp= le. >=20 > The --debug-print-final-expr will print out the resulting (pre-bytecode-g= eneration) > Expression in human-readable form, but it is purely for debugging, and is= not > meant to be parseable. >=20 >> Does the above idea have any chance to work, or is there some other way = you >> would recommend? >=20 > Well, it's pretty vague, but it can definitely be made to work. >=20 > If performance of the Scheme code is an issue, you will need to find a > way to compile Kawa to Android internal format. >=20 > --=20 > --Per Bothner > per@bothner.com http://per.bothner.com/