You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Weldon Washburn <we...@gmail.com> on 2006/09/06 06:32:00 UTC

[DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

A question for Jitrino.JET developers.  How hard would it be to modify the
existing Jitrino.JET code  so that the "new" opcode calls MMTk alloc()?

Thanks
-- 
Weldon Washburn
Intel Middleware Products Division

Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Egor Pasko <eg...@gmail.com>.
On the 0x1EF day of Apache Harmony mrbillcollector@gmail.com wrote:
> Pretty much thanks.
> 
> Though I think I am unsure as to what you mean by IRs.... sorry.

IR = Intermediate Representation (a widely used term in compiler
design), see http://en.wikipedia.org/wiki/Compiler

> On 19 Sep 2006 10:59:49 +0700, Egor Pasko <eg...@gmail.com> wrote:
> >
> > On the 0x1E9 day of Apache Harmony mrbillcollector@gmail.com wrote:
> > > Can someone clarify what Jetrnio.JET is please ?
> >
> > DRLVM has two JIT compilers:
> > * Jitrino.OPT -- aggressively optimizing compiler (having two IRs,
> >   high-level and platform-specific optimizations)
> > * Jitrino.JET -- fast JIT (no IR, simple design, fast compilation,
> >   improves startup time)
> >
> > does it anser your question?
> >
> > > On 9/8/06, Weldon Washburn <we...@gmail.com> wrote:
> > > >
> > > > On 9/8/06, Mikhail Fursov <mi...@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:
> > > >
> > > >
> > > > /**
> > > >
> > > > * 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?
> > > > >
> > > > > +The test in the patch throws NullPointerException because no memory
> > is
> > > > > allocated in alloc() now and JET tries to write vtable data by NULL
> > > > > address.
> > > > >
> > > > >
> > > > >
> > > > > On 9/7/06, Weldon Washburn <we...@gmail.com> wrote:
> > > > > >
> > > > > > At some point soon we need to go multithread.  When can you fix
> > the
> > > > > > vmmagic
> > > > > > atomic operations?
> > > > > >
> > > > >
> > > > > I need one more day to estimate the complexity of this move.
> > > > >
> > > > >
> > > > > --
> > > > > Mikhail Fursov
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Weldon Washburn
> > > > Intel Middleware Products Division
> > > >
> > > >
> > >
> > >
> > > --
> > > www.FaeLLe.com
> > > www.VikramMohan.com
> >
> > --
> > Egor Pasko, Intel Managed Runtime Division
> >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
> 
> 
> -- 
> www.FaeLLe.com
> www.VikramMohan.com

-- 
Egor Pasko, Intel Managed Runtime Division


---------------------------------------------------------------------
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


Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by FaeLLe <mr...@gmail.com>.
Pretty much thanks.

Though I think I am unsure as to what you mean by IRs.... sorry.

On 19 Sep 2006 10:59:49 +0700, Egor Pasko <eg...@gmail.com> wrote:
>
> On the 0x1E9 day of Apache Harmony mrbillcollector@gmail.com wrote:
> > Can someone clarify what Jetrnio.JET is please ?
>
> DRLVM has two JIT compilers:
> * Jitrino.OPT -- aggressively optimizing compiler (having two IRs,
>   high-level and platform-specific optimizations)
> * Jitrino.JET -- fast JIT (no IR, simple design, fast compilation,
>   improves startup time)
>
> does it anser your question?
>
> > On 9/8/06, Weldon Washburn <we...@gmail.com> wrote:
> > >
> > > On 9/8/06, Mikhail Fursov <mi...@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:
> > >
> > >
> > > /**
> > >
> > > * 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?
> > > >
> > > > +The test in the patch throws NullPointerException because no memory
> is
> > > > allocated in alloc() now and JET tries to write vtable data by NULL
> > > > address.
> > > >
> > > >
> > > >
> > > > On 9/7/06, Weldon Washburn <we...@gmail.com> wrote:
> > > > >
> > > > > At some point soon we need to go multithread.  When can you fix
> the
> > > > > vmmagic
> > > > > atomic operations?
> > > > >
> > > >
> > > > I need one more day to estimate the complexity of this move.
> > > >
> > > >
> > > > --
> > > > Mikhail Fursov
> > > >
> > > >
> > >
> > >
> > > --
> > > Weldon Washburn
> > > Intel Middleware Products Division
> > >
> > >
> >
> >
> > --
> > www.FaeLLe.com
> > www.VikramMohan.com
>
> --
> Egor Pasko, Intel Managed Runtime Division
>
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
www.FaeLLe.com
www.VikramMohan.com

Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Egor Pasko <eg...@gmail.com>.
On the 0x1E9 day of Apache Harmony mrbillcollector@gmail.com wrote:
> Can someone clarify what Jetrnio.JET is please ?

DRLVM has two JIT compilers:
* Jitrino.OPT -- aggressively optimizing compiler (having two IRs,
  high-level and platform-specific optimizations)
* Jitrino.JET -- fast JIT (no IR, simple design, fast compilation,
  improves startup time)

does it anser your question?

> On 9/8/06, Weldon Washburn <we...@gmail.com> wrote:
> >
> > On 9/8/06, Mikhail Fursov <mi...@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:
> >
> >
> > /**
> >
> > * 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?
> > >
> > > +The test in the patch throws NullPointerException because no memory is
> > > allocated in alloc() now and JET tries to write vtable data by NULL
> > > address.
> > >
> > >
> > >
> > > On 9/7/06, Weldon Washburn <we...@gmail.com> wrote:
> > > >
> > > > At some point soon we need to go multithread.  When can you fix the
> > > > vmmagic
> > > > atomic operations?
> > > >
> > >
> > > I need one more day to estimate the complexity of this move.
> > >
> > >
> > > --
> > > Mikhail Fursov
> > >
> > >
> >
> >
> > --
> > Weldon Washburn
> > Intel Middleware Products Division
> >
> >
> 
> 
> -- 
> www.FaeLLe.com
> www.VikramMohan.com

-- 
Egor Pasko, Intel Managed Runtime Division


---------------------------------------------------------------------
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


Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by FaeLLe <mr...@gmail.com>.
Can someone clarify what Jetrnio.JET is please ?

On 9/8/06, Weldon Washburn <we...@gmail.com> wrote:
>
> On 9/8/06, Mikhail Fursov <mi...@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:
>
>
> /**
>
> * 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?
> >
> > +The test in the patch throws NullPointerException because no memory is
> > allocated in alloc() now and JET tries to write vtable data by NULL
> > address.
> >
> >
> >
> > On 9/7/06, Weldon Washburn <we...@gmail.com> wrote:
> > >
> > > At some point soon we need to go multithread.  When can you fix the
> > > vmmagic
> > > atomic operations?
> > >
> >
> > I need one more day to estimate the complexity of this move.
> >
> >
> > --
> > Mikhail Fursov
> >
> >
>
>
> --
> Weldon Washburn
> Intel Middleware Products Division
>
>


-- 
www.FaeLLe.com
www.VikramMohan.com

Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Robin Garner <ro...@anu.edu.au>.
Weldon Washburn wrote:
> On 9/8/06, Mikhail Fursov <mi...@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


Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Weldon Washburn <we...@gmail.com>.
On 9/8/06, Mikhail Fursov <mi...@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:


/**

* 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?
>
> +The test in the patch throws NullPointerException because no memory is
> allocated in alloc() now and JET tries to write vtable data by NULL
> address.
>
>
>
> On 9/7/06, Weldon Washburn <we...@gmail.com> wrote:
> >
> > At some point soon we need to go multithread.  When can you fix the
> > vmmagic
> > atomic operations?
> >
>
> I need one more day to estimate the complexity of this move.
>
>
> --
> Mikhail Fursov
>
>


-- 
Weldon Washburn
Intel Middleware Products Division

Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Mikhail Fursov <mi...@gmail.com>.
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.

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).

Can we replace the 'alloc()' call with another Java method  that uses
unboxed API and behaves exactly like 'new' helper?

+The test in the patch throws NullPointerException because no memory is
allocated in alloc() now and JET tries to write vtable data by NULL address.



On 9/7/06, Weldon Washburn <we...@gmail.com> wrote:
>
> At some point soon we need to go multithread.  When can you fix the
> vmmagic
> atomic operations?
>

I need one more day to estimate the complexity of this move.


-- 
Mikhail Fursov

Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Weldon Washburn <we...@gmail.com>.
Mikhail,

Thanks.  Please put the mods in JIRA  Harmony-816.  Thanks for pointing out
the other drlvm threads.  It turns out that even though these java threads
are running,  the MMTk "user mode" setup that has been created for
initial integration only sees one single java thread.

At some point soon we need to go multithread.  When can you fix the vmmagic
atomic operations?

   Thanks
       Weldon




On 9/7/06, Mikhail Fursov <mi...@gmail.com> wrote:
>
> Weldon,
> the problem is clear. I going to add the support to JET in a day.
>
> + Note that even for a simple single method HelloWorld application DRLVM
> starts multiple threads to support finalization. Also some threads may be
> created by API itself (but I'm not sure it does). So, at least, you need
> to
> disable finalizer threads with -Dvm.finalize=false property.
>
>
> On 9/6/06, Weldon Washburn <we...@gmail.com> wrote:
> >
> > On 9/6/06, Mikhail Fursov <mi...@gmail.com> wrote:
> > >
> > > Weldon,
> > > The replacement of the 'new' opcode call with another call is
> relatively
> > > easy task.
> > >
> > > To send a working patch I need the following information:
> > > 1) Which Java method to call? Is it an instance method or a static?
> >
> >
> > Its an instance method.  Ideally you can use the same approach as the
> one
> > used when adding write barriers to Jitrino.JET.  Specifically
> > PlanLocal.javain Jira Harmony-816.  The API is:
> >
> > public Address alloc(int bytes, int align, int offset, int allocator,
> int
> > site);
> >
> > The only parameter I care about at this time is bytes.  This must  be
> > accurate.  I will ignore the rest of the parameters.  In other words, to
> > allocate a 52 byte object, the call site should look like:
> >
> > alloc( 52, 0, 0, 0, 0);
> >
> > Make sure the JIT loads the vtable ptr (and array length if required).
> >
> > 2) How to test the implementation? I can get and deploy all of your
> > changes
> > > or just to call some stub methods in a specialized testcase before
> > sending
> > > the result to you.
> >
> >
> >
> > It would be best to test with a stub that is similar to what's in
> > Harmony-816.  It would also be great if the object allocator can chosen
> by
> > pattern matching on the method name.  A similar facility already exists
> > for
> > the write barrier -- it might be a simple cut/paste.
> >
> > The above will work fine during the single thread stage of this project.
> > Once we decide to turn on multiple Java threads, we will need to stuff a
> > thread specific MMTk object in DRLVM's thread block.  Then during
> > execution
> > of JITed code, use vmmagic to load fs:14+offset_of_the_alloc_object
> into,
> > for example, EBX.  Do a "mov eax, [ebx]" to get the vtable pointer into
> > eax.  And finally, "call [eax + offset_of_the_alloc_method].
> >
> > Let me know if you have further questions.
> >
> >
> >
> > ?
> > >
> > >
> > > On 9/6/06, Weldon Washburn <we...@gmail.com> wrote:
> > > >
> > > > A question for Jitrino.JET developers.  How hard would it be to
> modify
> > > the
> > > > existing Jitrino.JET code  so that the "new" opcode calls MMTk
> > alloc()?
> > > >
> > > > Thanks
> > > > --
> > > > Weldon Washburn
> > > > Intel Middleware Products Division
> > > >
> > > >
> > >
> > >
> > > --
> > > Mikhail Fursov
> > >
> > >
> >
> >
> > --
> > Weldon Washburn
> > Intel Middleware Products Division
> >
> >
>
>
> --
> Mikhail Fursov
>
>


-- 
Weldon Washburn
Intel Middleware Products Division

Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Mikhail Fursov <mi...@gmail.com>.
Weldon,
the problem is clear. I going to add the support to JET in a day.

+ Note that even for a simple single method HelloWorld application DRLVM
starts multiple threads to support finalization. Also some threads may be
created by API itself (but I'm not sure it does). So, at least, you need to
disable finalizer threads with -Dvm.finalize=false property.


On 9/6/06, Weldon Washburn <we...@gmail.com> wrote:
>
> On 9/6/06, Mikhail Fursov <mi...@gmail.com> wrote:
> >
> > Weldon,
> > The replacement of the 'new' opcode call with another call is relatively
> > easy task.
> >
> > To send a working patch I need the following information:
> > 1) Which Java method to call? Is it an instance method or a static?
>
>
> Its an instance method.  Ideally you can use the same approach as the one
> used when adding write barriers to Jitrino.JET.  Specifically
> PlanLocal.javain Jira Harmony-816.  The API is:
>
> public Address alloc(int bytes, int align, int offset, int allocator, int
> site);
>
> The only parameter I care about at this time is bytes.  This must  be
> accurate.  I will ignore the rest of the parameters.  In other words, to
> allocate a 52 byte object, the call site should look like:
>
> alloc( 52, 0, 0, 0, 0);
>
> Make sure the JIT loads the vtable ptr (and array length if required).
>
> 2) How to test the implementation? I can get and deploy all of your
> changes
> > or just to call some stub methods in a specialized testcase before
> sending
> > the result to you.
>
>
>
> It would be best to test with a stub that is similar to what's in
> Harmony-816.  It would also be great if the object allocator can chosen by
> pattern matching on the method name.  A similar facility already exists
> for
> the write barrier -- it might be a simple cut/paste.
>
> The above will work fine during the single thread stage of this project.
> Once we decide to turn on multiple Java threads, we will need to stuff a
> thread specific MMTk object in DRLVM's thread block.  Then during
> execution
> of JITed code, use vmmagic to load fs:14+offset_of_the_alloc_object into,
> for example, EBX.  Do a "mov eax, [ebx]" to get the vtable pointer into
> eax.  And finally, "call [eax + offset_of_the_alloc_method].
>
> Let me know if you have further questions.
>
>
>
> ?
> >
> >
> > On 9/6/06, Weldon Washburn <we...@gmail.com> wrote:
> > >
> > > A question for Jitrino.JET developers.  How hard would it be to modify
> > the
> > > existing Jitrino.JET code  so that the "new" opcode calls MMTk
> alloc()?
> > >
> > > Thanks
> > > --
> > > Weldon Washburn
> > > Intel Middleware Products Division
> > >
> > >
> >
> >
> > --
> > Mikhail Fursov
> >
> >
>
>
> --
> Weldon Washburn
> Intel Middleware Products Division
>
>


-- 
Mikhail Fursov

Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Weldon Washburn <we...@gmail.com>.
On 9/6/06, Mikhail Fursov <mi...@gmail.com> wrote:
>
> Weldon,
> The replacement of the 'new' opcode call with another call is relatively
> easy task.
>
> To send a working patch I need the following information:
> 1) Which Java method to call? Is it an instance method or a static?


Its an instance method.  Ideally you can use the same approach as the one
used when adding write barriers to Jitrino.JET.  Specifically
PlanLocal.javain Jira Harmony-816.  The API is:

public Address alloc(int bytes, int align, int offset, int allocator, int
site);

The only parameter I care about at this time is bytes.  This must  be
accurate.  I will ignore the rest of the parameters.  In other words, to
allocate a 52 byte object, the call site should look like:

alloc( 52, 0, 0, 0, 0);

Make sure the JIT loads the vtable ptr (and array length if required).

2) How to test the implementation? I can get and deploy all of your changes
> or just to call some stub methods in a specialized testcase before sending
> the result to you.



It would be best to test with a stub that is similar to what's in
Harmony-816.  It would also be great if the object allocator can chosen by
pattern matching on the method name.  A similar facility already exists for
the write barrier -- it might be a simple cut/paste.

The above will work fine during the single thread stage of this project.
Once we decide to turn on multiple Java threads, we will need to stuff a
thread specific MMTk object in DRLVM's thread block.  Then during execution
of JITed code, use vmmagic to load fs:14+offset_of_the_alloc_object into,
for example, EBX.  Do a "mov eax, [ebx]" to get the vtable pointer into
eax.  And finally, "call [eax + offset_of_the_alloc_method].

Let me know if you have further questions.



?
>
>
> On 9/6/06, Weldon Washburn <we...@gmail.com> wrote:
> >
> > A question for Jitrino.JET developers.  How hard would it be to modify
> the
> > existing Jitrino.JET code  so that the "new" opcode calls MMTk alloc()?
> >
> > Thanks
> > --
> > Weldon Washburn
> > Intel Middleware Products Division
> >
> >
>
>
> --
> Mikhail Fursov
>
>


-- 
Weldon Washburn
Intel Middleware Products Division

Re: [DRLVM][JIT] can Jitrino.JET call MMTk alloc() instead of C helper?

Posted by Mikhail Fursov <mi...@gmail.com>.
Weldon,
The replacement of the 'new' opcode call with another call is relatively
easy task.

To send a working patch I need the following information:
1) Which Java method to call? Is it an instance method or a static?
2) How to test the implementation? I can get and deploy all of your changes
or just to call some stub methods in a specialized testcase before sending
the result to you.

?


On 9/6/06, Weldon Washburn <we...@gmail.com> wrote:
>
> A question for Jitrino.JET developers.  How hard would it be to modify the
> existing Jitrino.JET code  so that the "new" opcode calls MMTk alloc()?
>
> Thanks
> --
> Weldon Washburn
> Intel Middleware Products Division
>
>


-- 
Mikhail Fursov