Possible to write compiler to Java VM? (I volunteer to summarize) 
Author Message
 Possible to write compiler to Java VM? (I volunteer to summarize)

Quote:

>Explicit continuations (such as those provided by Scheme's
>call-with-current-continuation primitive), when implemented on a stack
>based (virtual or real) machine, nearly requires machine support,
>since the stack (or segments in it) have to be copied elsewhere.  An
>alternative is to allocate all activation frames on the heap, hence
>without using any stack. This is actually doable, and work efficiently...

Although this works fairly well with a generational garbage collector
as in SML/NJ, you wouldn't want to do this with the conservative
garbage collector currently used to implement the Java VM.  You
wouldn't have to, since nearly all of the standard techniques used to
compile Scheme into C could be used with the Java VM.

Tail recursion is a more serious problem than first class
continuations.  But again, the standard techniques used to compile
Scheme-like languages into C could be used with the Java VM, with the
same 2x hit in overall performance.  This inefficiency will disappear
if Sun allows for tail recursive calls in some future revision of the
Java VM, as is rumored.

In the long term I think the most serious problem is that the obvious
implementation of a dynamically typed language in the Java VM is to
represent all values as Java objects.  You could hack up a special
case for integers, but the strong typing of the Java VM makes it hard
to do that without slowing everything else.

William D Clinger
--




Wed, 15 Jul 1998 03:00:00 GMT  
 Possible to write compiler to Java VM? (I volunteer to summarize)

Quote:

>Explicit continuations (such as those provided by Scheme's
>call-with-current-continuation primitive), when implemented on a stack
>based (virtual or real) machine, nearly requires machine support,
>since the stack (or segments in it) have to be copied elsewhere.  An
>alternative is to allocate all activation frames on the heap, hence
>without using any stack. This is actually doable, and work efficiently...


Quote:
> Although this works fairly well with a generational garbage collector
> as in SML/NJ, you wouldn't want to do this with the conservative
> garbage collector currently used to implement the Java VM.  You
> wouldn't have to, since nearly all of the standard techniques used to
> compile Scheme into C could be used with the Java VM.

For those who haven't seen it yet, the Cheney-on-the-MTA (inside joke),
also called 'pushy', scheme for doing 'precise' GC in C should work.
See ftp://ftp.netcom.com/pub/hb/hbaker/CheneyMTA.html (also .ps.Z) and
'cboyer13.c' in my ftp/www directory.  'cboyer13.c' is an actual implementation
in very portable ANSI C of the scheme.  This program also happens to be
a standard Lisp benchmark, so you can use it to evaluate the efficiency
of the scheme.

Quote:
> Tail recursion is a more serious problem than first class
> continuations.  But again, the standard techniques used to compile
> Scheme-like languages into C could be used with the Java VM, with the
> same 2x hit in overall performance.  This inefficiency will disappear
> if Sun allows for tail recursive calls in some future revision of the
> Java VM, as is rumored.

The CheneyMTA scheme mentioned above handles tail recursion, as well.

--
www/ftp directory:
ftp://ftp.netcom.com/pub/hb/hbaker/home.html
--




Wed, 15 Jul 1998 03:00:00 GMT  
 Possible to write compiler to Java VM? (I volunteer to summarize)

Quote:
>In the long term I think the most serious problem is that the obvious
>implementation of a dynamically typed language in the Java VM is to
>represent all values as Java objects.  You could hack up a special
>case for integers, but the strong typing of the Java VM makes it hard
>to do that without slowing everything else.

Probably the most efficient way of fixing this is to add a primitive
tagged type. E.g. as well as iload for integers and aload for objects,
add a 'tload' instruction for tagged values, and similarly for every
other VM instruction.

It would take a litle work to make tagged values interoperable with
untagged ones (so that Java libraries could be called from a
non-statically- typed language and vice-versa), but there is nothing
insoluble here.

David Hopwood

--




Fri, 17 Jul 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Possible to write compiler to Java VM?

2. Smalltalk VM / JAVA VM?

3. Eiffel to Java and Java VM code generation

4. IBM Compiler for VM is in the Dec 92 compiler list

5. Test writing volunteers needed

6. Language Foo -> Java VM compilers: which ones possible?

7. Java VM for 370 ?

8. J for the Java VM?

9. Java(tm) VM Research and Technology Symposium: August 1-2,

10. Smalltalk for Java VM?

11. Sun's intent to support Smalltalk on Java VM

12. Smalltalk on top of the Java VM

 

 
Powered by phpBB® Forum Software