Re: Generating Java Bytecode

Joe Hummel <jhummel@crispix.ICS.UCI.EDU>
21 Nov 1996 22:54:35 -0500

          From comp.compilers

Related articles
[4 earlier articles]
Generating Java Bytecode w.purvis@daresbury.ac.uk (Bill Purvis) (1996-11-19)
Re: Generating Java Bytecode macrakis@app2.osf.org (Stavros Macrakis) (1996-11-19)
Re: Generating Java Bytecode chapados@nortel.ca (nicolas (n.) chapados) (1996-11-19)
Re: Generating Java Bytecode gunnar@candleweb.no (Gunnar R|nning) (1996-11-19)
Re: Generating Java Bytecode jsa@alexandria.organon.com (1996-11-19)
Re: Generating Java Bytecode john@dwaf-hri.pwv.gov.za (John Carter) (1996-11-21)
Re: Generating Java Bytecode jhummel@crispix.ICS.UCI.EDU (Joe Hummel) (1996-11-21)
Re: Generating Java Bytecode bmd@cs.kuleuven.ac.be (Bart Demoen) (1996-11-21)
Re: Generating Java Bytecode stephens@math.ruu.nl (Bruce Stephens) (1996-11-21)
Re: Generating Java Bytecode torhr@storm.stud.ntnu.no (1996-11-21)
Re: Generating Java Bytecode kuznetso@MIT.EDU (1996-11-21)
Re: Generating Java Bytecode billms@ee.ucla.edu (Bill Mangione-Smith) (1996-11-21)
Re: Generating Java Bytecode pardo@cs.washington.edu (1996-11-21)
[11 later articles]
| List of all articles for this month |
From: Joe Hummel <jhummel@crispix.ICS.UCI.EDU>
Newsgroups: comp.compilers
Date: 21 Nov 1996 22:54:35 -0500
Organization: UC Irvine, Department of ICS
References: 96-11-108 96-11-125
Keywords: Java

Bill Purvis <w.purvis@daresbury.ac.uk> wrote:
>The Java VM does support the basic things you need for C's pointer
>rules - it's the Java Compiler that excludes them.


    Actually, I think it's the JVM that excludes general pointers...
But we have to be careful when we say "pointer". Ada has pointers,
and working Ada-->bytecode compilers seem to exist. But I think the
problem is in supporting general pointers, i.e. pointer arithmetic and
pointers to any old location in RAM:


            void *p;


            p = (void *) 0x0080001F; /* some memory location */
            *((int *) p) = 10; /* let's store 10 there */
            p++;


You can't write a legal bytecode stream to do these things, since (1)
you don't have acess to real memory addresses. "Ahh, but just treat
it as an integer!" True, but (2) the JVM enforces strict typing, so
once it's an integer there's no way to convert it to a memory
reference. Finally, even though the JVM does support references to
memory (for objects and arrays), (3) there's no way to do address
arithmetic (and you can't convert it to an integer and do the
arithmetic that way...).


    Ada doesn't support general pointers, at least it doesn't support
things like


            int i, *p;


            p = &i;
            p++;


I would imagine that Ada does support something like:


            p = (void *) 0x0080001F;


so I don't know how they get around this. Perhaps they don't support
it? Anyone know?


Cheers,


    - joe hummel


PS: Byte mag just ran an article on Sun's Java chip. In order to
support OS implementation, Sun added two bytecode instructions to the
chip -- to read and write real memory addresses.
--
Joe Hummel
ICS Graduate Student, UC Irvine
Internet: jhummel@ics.uci.edu
WWW: http://www.ics.uci.edu/~jhummel
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.