harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weldon Washburn" <weldon...@gmail.com>
Subject [DRLVM] jitting MMTk vmmagic classes -- first stab at the requirements
Date Wed, 07 Jun 2006 20:48:55 GMT
All,

Below is a first stab at defining what the JIT needs to be aware of
when compiling the vmmagic classes.  I am hoping the MMTk crowd will
correct the mistakes in the below example.

There are multiple ways of doing address arithmetic with the vmmagic
classes.  The below is intended to illustrate specific pointer
handling concepts so that folks working on the compiler can figure out
what the JIT is supposed to do.  It is not necessarily the best
approach or representative of what a GC would ever do.

In a little while, I will attempt to map this example to machine code
that Jitrino.JET could generate.  Admittedly the code quality will be
bad or maybe even broken.  However, the motivation is to show the
compiler folks how a JIT could generate vmmagic.unboxed code.



// a bunch of non-vmmagic code (normal java code)...

public class Green {
	int f1;
	Green obj1;
}

Green g1 = new Green();

//beginning of code that involves vmmagic

ObjectReference oRef = ObjectReference.fromObject((Object)g1);  //oRef
is an unboxed ref ptr, the JIT is always required to enumerate oRef

Address aa = oRef.toAddress();  //aa is an unboxed raw pointer,  JIT
should never enumerate aa and aa can only exist within the scope of
the "Uninterruptible" interface

int ptrBits = aa.toInt();  	// the MMTk developer must be very careful
to keep all raw heap ptrs within the scope of an "Uninterruptible".
Question:  are there any tools to help the developer handle this
properly?

ptrBits = ptrBits + 12;  // ugly code, but for sake of illustration
assume the obj1 field is at location ref ptr + 12

Address interiorPtr = new Address(ptrBits);  // again, the JIT should
never enumerate interiorPtr

ObjectReference oRef2 = interiorPtr.loadObjectReference();  // the JIT
must enumerate oRef2

Green g2 = oRef2.toObject();

//end of code that involves vmmagic

g2.f1 = 45;

// a bunch of non-vmmagic code (normal java code)…



-- 
Weldon Washburn
Intel Middleware Products 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


Mime
View raw message