D language as script through JVM

Thiez thiezz at gmail.com
Thu Aug 16 07:08:56 PDT 2012


On Thursday, 16 August 2012 at 11:47:56 UTC, Paulo Pinto wrote:
> On Thursday, 16 August 2012 at 09:23:18 UTC, Thiez wrote:
>> On Thursday, 16 August 2012 at 00:48:44 UTC, Alexey Egorov 
>> wrote:
>>> I think there is no problems to make, for example, compiler 
>>> for Java Virtual Machine.
>>
>> Think again. Like Java, the JVM does not have pointer 
>> arithmetic, which means there is no straightforward way to 
>> write a D-to-JVM-bytecode compiler.
>>
>
> Actually you can do it, if you make use of sun.misc.Unsafe 
> package.
>
> http://www.docjar.com/docs/api/sun/misc/Unsafe.html
>
> --
> Paulo

It looks like the 'getAddress' function requires the memory to 
have been obtained using allocateMemory. It seems to me this 
would prevent the (excelllent) builtin gargbage collector from 
working, which would be a waste.

It seems .net would be a better target, but according to the 
thread that xenon325 links to, that either can't be done, or is 
very hard.


More information about the Digitalmars-d mailing list