Hi Cafe!<div><br></div><div>I know, this topic comes back on the list from time to time. I know, there probably isn&#39;t anything new since the last time it was asked here, on reddit or on SO.</div><div>However, I remember seeing that iPwn Studios were thinking about getting GHC to build applications for android, in addition to their ghc-iphone project. Is this correct? Is there anything new on that front? Is anyone else working/thinking-to-work on this?</div>
<div><div><br></div><div>Aside from these questions, I&#39;m wondering about the &quot;easiest&quot; way to get a ghc-android compiler up and running. I have found a few things, but they all look really, really painful and cumbersome, like <a href="http://stackoverflow.com/a/5152910/193424">http://stackoverflow.com/a/5152910/193424</a> or <a href="http://stackoverflow.com/a/7301024/193424">http://stackoverflow.com/a/7301024/193424</a> . </div>
<div><br></div><div>Recently, I heard about Renderscript: <a href="http://developer.android.com/guide/topics/renderscript/index.html">http://developer.android.com/guide/topics/renderscript/index.html</a></div><div>Of course, we could write a binding or some kind of EDSL à-la Atom to have some funny apps/games running on Android by generating Renderscript code under the hood. However, something in the &quot;Renderscript Runtime Layer&quot; section caught my attention:</div>
<div><br></div><div>&gt; <span style="color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px;background-color:rgb(255,255,255)">You define your Renderscript code in </span><code style="color:rgb(0,112,0);line-height:1em;font-size:13px;background-color:rgb(255,255,255)">.rs</code><span style="color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px;background-color:rgb(255,255,255)"> and </span><code style="color:rgb(0,112,0);line-height:1em;font-size:13px;background-color:rgb(255,255,255)">.rsh</code><span style="color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px;background-color:rgb(255,255,255)"> files in the </span><code style="color:rgb(0,112,0);line-height:1em;font-size:13px;background-color:rgb(255,255,255)">src/</code><span style="color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px;background-color:rgb(255,255,255)"> directory of your Android project. The code is compiled to intermediate bytecode by the </span><code style="color:rgb(0,112,0);line-height:1em;font-size:13px;background-color:rgb(255,255,255)">llvm</code><span style="color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px;background-color:rgb(255,255,255)"> compiler </span></div>
<div><span style="color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px;background-color:rgb(255,255,255)">&gt; that runs as part of an Android build. When your application runs on a device, the bytecode is then compiled (just-in-time) to machine code by another </span><code style="color:rgb(0,112,0);line-height:1em;font-size:13px;background-color:rgb(255,255,255)">llvm</code><span style="color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px;background-color:rgb(255,255,255)"> compiler that</span></div>
<div><span style="color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px;background-color:rgb(255,255,255)">&gt; resides on the device. The machine code is optimized for the device and also cached, so subsequent uses of the Renderscript enabled application does not recompile the </span></div>
<div><span style="background-color:rgb(255,255,255);color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px;line-height:16px">&gt; bytecode.</span></div><div><br></div><div>But hey, GHC *does* have an LLVM backend! So can&#39;t we somehow break that chain of compilers so that we can plug GHC&#39;s LLVM codegen on top of it and then use their llvm-on-the-device thing? I know I am skipping over many, many technical details like how we could have an analog to their &quot;reflected layer&quot; on the java side but I would really be interested in hearing your opinions/objections/thoughts on this.</div>
<div><br></div><div>-- </div>Alp Mestanogullari<br>
</div>