harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Garner <Robin.Gar...@anu.edu.au>
Subject Re: I hope the JVM implements most using Java itself
Date Wed, 11 May 2005 07:38:31 GMT
You might like to take a look at how the org.vmmagic classes implemented
in JikesRVM and (I believe) in JNode do this.  Essentially you this
interface defines 'magic' classes such as 'Address' that can be used in
the VM internals to access raw memory.  As far as the program text goes,
you are calling a method of an object, but the compiler produced
optimized machine code to do memory loads, stores etc.  So you get the
power to do low-level things, but with some measure of type safety etc.

One of the key advantages of implementing the VM in Java is that
performance critical code fragments, such as the memory allocator, can
be inlined right through into the user code, with no special effort on
the part of the compiler.  

Robin

On Wed, 2005-05-11 at 00:26 -0700, Will Pugh wrote:
> For most applications I would agree. GC is a pretty good way to go, it 
> has a number of good properties such as fast allocation, pretty decent 
> object grouping in many cases, pretty fast, etc.
> 
> However, you still can't work with raw memory, e.g. allocating blocks of 
> memory for working with many of the same objects, moving objects around 
> in physical memory, physically changing vtables for exisiting Java 
> Objects (potentially useful for some optimizations). A JVM has more to 
> do than just turn bytecode into native code, it also needs to manage 
> memory, changing already JITed machine code, potentially changing 
> existing object layouts/vtables.
> 
> 
> --Will
> 
> 王在祥 wrote:
> 
> >Sure. So I think the new JVM should provide more good memory control than 
> >Hotspot. I think the escape analysis would help this. 
> >
> >So:
> >1. allocate object is mostly as quick as stack object. 
> >2. most object will be gabage and throw away as quickly and takes no more GC 
> >cost.
> >
> >In this case, we may inprove the memory control and makes the JVM more 
> >effective on GC.
> >
> >:) it looks the Hotspot team dont believe escape analysis would help GC on 
> >the forums.java.net <http://forums.java.net> discussion.
> >
> >2005/5/11, Will Pugh <willpugh@sourcelabs.com>:
> >  
> >
> >>I think you would also want to pay attention to how much control you
> >>need over memory allocation. Java doesn't give you much control over
> >>memory, yet in many scenarios (such as start-up time or running on
> >>devices) working set can be just as important as the actual codes
> >>executed for performance. You would have much more control over working
> >>set/memory if you used C/C++.



Mime
View raw message