dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]Compiling to the JVM


From: Gopal V
Subject: Re: [DotGNU]Compiling to the JVM
Date: Tue, 8 Oct 2002 08:17:00 +0530
User-agent: Mutt/1.2.5i

If memory serves me right, Andrew Clark wrote:
> I hope that I'm asking this in the right place -- is the cscc option to
> compile to Java bytecode (-mjvm) fully implemented? 

You've hit the spot ... the cscc option is still not implemented :-).
Sylvain has fixed up the assembler and the pnet/codegen/jv*.tc files
handle assembly generation.

> ...the resulting file isn't a valid class file (or jar file, for that
> matter).  The hex dump of the file is a little different, and I've looked at
> the source enough to know that there is at least some code in there that
> looks like it should be outputting Java bytecode.

Linker messes up the issue by linking the JVM assembly code into an IL
assembly :-( ... We've to teach cscc that -mjvm does not link ...

> 
> If it doesn't work, is there someone currently working on it?  If someone
> has some insight, I'd be willing to at least try to implement some of the
> functionallity.  I've looked on the dotgnu website and can't find any TODO
> or subprojects that seem to address this issue at all.  If it's feasible, I
> see the Java bytecode option as one of the most powerful features that this
> project could offer.

I also think the -mjvm option is very powerful ... So here's how the current
hacks work... First remove all Class references .. viz like Console

address@hidden gopal]$ cscc -S -mjvm Hello.cs
address@hidden gopal]$ ilasm -J -o Hello.class Hello.jl

But we still do not have the base classes compiled into .class files , so
I think Console.WriteLine is a long way ahead ... :-( .. But for testing 
purposes, I'm thinking of writing 'Object' and 'Console' classes in JL ... 
But java.lang.String cannot be inherited to System.String ... ???

So if you want to just check if the compiler works (see Object.jl attached), 

address@hidden gopal]$ mkdir System
address@hidden gopal]$ ilasm -J -o System/Object.class Object.jl
address@hidden gopal]$ java Hello

Hopefully you should not get any error messages or output... :-)

Gopal
-- 
The difference between insanity and genius is measured by success

Attachment: Object.jl
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]