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: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?
Date Tue, 19 Sep 2006 08:57:54 GMT
Weldon Washburn wrote:
> On 9/8/06, Mikhail Fursov <mike.fursov@gmail.com> wrote:
>>
>> Weldon,
>> I added 'alloc' support to JIRA 816 (magic2.zip file)
>> Now it supports objects allocation only, not arrays. MMTk allocation 
>> works
>> only for class named 'test'  and methods with prefix  'testAlloc'. To 
>> turn
>> it on use "-Xjit jet::alloc4j" option.
> 
> 
> Thanks!  I will take a look this weekend.
> 
> I had a problem with implementation: usual 'new' vm helper does vtable 
> field
>> initialization in allocated object space by itself. Your alloc() method
>> doesn't.
>> In the patch in JIRA I added vtable initialization code right after the
>> alloc() call to JIT, that is actually bad design decision (IMO).
> 
> 
> You are correct.  Its bad design.  Writing the vtable pointer is not the
> responsibility of the JIT.  MMTk is somewhat vague on who owns vtable ptr
> init.  In any case, it looks like the jit should follow the call to alloc()
> with a call to postAlloc().  I will make sure the postAlloc() code fixes up
> the vtable ptr.  Its OK to "bend" the typeRef.  All I want is the hard ptr
> that gets written into the object header.  We will go back later and fix
> this interface hack.  See below:

Ummm ... MMTk isn't vague on who owns vtable ptr initialization - it's 
the responsibility of the VM.  MMTk strives to know as little about the 
object model as possible, apart from what is exposed through the 
ObjectModel interface.  OK, perhaps the contract isn't as clearly 
expressed as it chould be :)

In JikesRVM, the incoming interface (MM_Interface) provides the 
vm-specific features such as adding the object header size to the 
allocation request, filling in the non-GC portions of the header etc.  I 
think that approach would work for DRLVM.

MMTk definitely doesn't want to know about vtables and type pointers - 
after all there are plenty of systems it could be built into that don't 
have such things.

> 
> /**
> 
> * Perform post-allocation actions. For many allocators none are
> 
> * required.
> 
> *
> 
> * @param ref The newly allocated object
> 
> * @param typeRef the type reference for the instance being created
> 
> * @param bytes The size of the space to be allocated (in bytes)
> 
> * @param allocator The allocator number to be used for this allocation
> 
> */
> 
> public void postAlloc(ObjectReference ref, ObjectReference typeRef,
> 
> int bytes, int allocator) throws InlinePragma {
> 
> 
> 
> 
> 
> Can we replace the 'alloc()' call with another Java method  that uses
>> unboxed API and behaves exactly like 'new' helper?

I think that's what I'm saying MMTk expects.

cheers

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message