Running VM State - Modification, Complexity, Cleanliness

Nathan Meyers nmeyers at teleport.com
Mon Feb 12 08:36:00 PST 2001


On Mon, Feb 12, 2001 at 07:08:24AM -0800, Steve Sansha wrote:
> Also: Does the Virtual Machine allow self-modifying
> code?  I'm sure it's possible for the bytecode to
> create a new byte[] and use custom-built classloader
> to actually load it, but is their an easier
> alternative?  
> (I'm guessing it's not, since it's a type-safe
> language)

You may find a broken VM implementation that lets you do such a thing, but
Java's pretty strict about access to memory. Writing into space occupied
by loaded bytecodes isn't in spec. And, with the possibility that the code
has been JITted, changing bytecodes on the fly would be very bad news.

Custom classloaders are easy to write - there really is no "easier
alternative". Loading your own manufactured bytecodes requires an almost
trivial subclass of ClassLoader.


> Also: I'm sending this to Kaffe because it seems to be
> the best-documented, best-spirited VM... But just so I
> 
> know, are their any documents (except the in-source
> code documentation) for Sun's reference
> implementation?  I've looked around and can't find
> any.

Sun publishes detailed specs about the language, the JVM, the classfile
format, and such. As for details on JVM implementation - I doubt it. And
that's a moving target anyway.

Nathan


> 
> (Thanks * 1,000,000)  -Steve
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35 
> a year!  http://personal.mail.yahoo.com/


More information about the kaffe mailing list