|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.jni.JNIEnvironment
public final class JNIEnvironment
A JNIEnvironment is created for each Java thread.
Field Summary | |
---|---|
private boolean |
alwaysHasNativeFrame
true if the bottom stack frame is native, such as thread for CreateJVM or AttachCurrentThread |
private Address |
basePointerOnEntryToNative
When native code doesn't maintain a base pointer we can't chain through the base pointers when walking the stack. |
private Address |
externalJNIFunctions
This is the pointer to the shared JNIFunction table. |
private int |
hasPendingException
|
static FunctionTable |
JNIFunctions
This is the shared JNI function table used by native code to invoke methods in @link{JNIFunctions}. |
AddressArray |
JNIRefs
references passed to native code |
protected static int |
JNIREFS_ARRAY_LENGTH
initial size for JNI refs, later grow as needed |
protected static int |
JNIREFS_FUDGE_LENGTH
sometimes we put stuff onto the jnirefs array bypassing the code that makes sure that it does not overflow (evil assembly code in the jni stubs that would be painful to fix). |
protected int |
JNIRefsMax
Offset of end (last entry) of JNIRefs array |
int |
JNIRefsSavedFP
Previous frame boundary in JNIRefs array. |
private AddressArray |
JNIRefsShadow
|
int |
JNIRefsTop
Offset of current top ref in JNIRefs array |
private Address |
JNITopJavaFP
When transitioning between Java and C and back, we may want to stop a thread returning into Java and executing mutator code when a GC is in progress. |
static LinkageTripletTable |
LinkageTriplets
For the PowerOpenABI we need a linkage triple instead of just a function pointer. |
private Throwable |
pendingException
Currently pending exception (null if none) |
private Address |
savedJTOC
For saving JTOC register on entry to native, to be restored on JNI call from native (only used on PowerPC) |
protected RVMThread |
savedTRreg
For saving processor register on entry to native, to be restored on JNI call from native |
Constructor Summary | |
---|---|
JNIEnvironment()
Initialize a thread specific JNI environment. |
Method Summary | |
---|---|
static void |
boot()
Initialization required during VM booting; only does something if we are on a platform that needs linkage triplets. |
private void |
checkPush(Object ref,
boolean canGrow)
Check push of reference can succeed |
void |
deleteJNIRef(int offset)
Remove a reference from the JNIRefs stack. |
void |
dumpJniRefsStack()
Dump the JNIRefs stack to the sysWrite stream |
void |
entryToJNI(int encodedReferenceOffsets)
Save data and perform necessary conversions for entry into JNI. |
Object |
exitFromJNI(int offset)
Restore data, throw pending exceptions or convert return value for exit from JNI. |
Throwable |
getException()
|
Object |
getJNIRef(int offset)
Get a reference from the JNIRefs stack. |
boolean |
hasNativeStackFrame()
|
static void |
initFunctionTable(FunctionTable functions)
Initialize the array of JNI functions. |
int |
pushJNIRef(Object ref)
Push a reference onto thread local JNIRefs stack. |
void |
recordException(Throwable e)
Record an exception as pending so that it will be delivered on the return to the Java caller; clear the exception by recording null |
AddressArray |
refsArray()
|
int |
refsTop()
|
private void |
replaceJNIRefs(AddressArray newrefs)
Atomically copy and install a new JNIRefArray |
int |
savedRefsFP()
|
static void |
throwPendingException()
Return and clear the (known to be non-null) pending exception. |
Address |
topJavaFP()
|
private int |
uninterruptiblePushJNIRef(Address ref,
boolean isRef)
Push a JNI ref, used on entry to JNI NB only used for Intel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int JNIREFS_ARRAY_LENGTH
protected static final int JNIREFS_FUDGE_LENGTH
public static FunctionTable JNIFunctions
public static LinkageTripletTable LinkageTriplets
private final Address externalJNIFunctions
protected RVMThread savedTRreg
private final Address savedJTOC
private Address basePointerOnEntryToNative
private Address JNITopJavaFP
private Throwable pendingException
private int hasPendingException
private boolean alwaysHasNativeFrame
public AddressArray JNIRefs
private AddressArray JNIRefsShadow
public int JNIRefsTop
protected int JNIRefsMax
public int JNIRefsSavedFP
Constructor Detail |
---|
public JNIEnvironment()
Method Detail |
---|
public boolean hasNativeStackFrame()
public Address topJavaFP()
public AddressArray refsArray()
public int refsTop()
public int savedRefsFP()
private void checkPush(Object ref, boolean canGrow)
ref
- object to be pushedcanGrow
- can the JNI reference array be grown?public int pushJNIRef(Object ref)
ref
- the object to put on stack
private void replaceJNIRefs(AddressArray newrefs)
private int uninterruptiblePushJNIRef(Address ref, boolean isRef)
ref
- reference to place on stack or value of saved frame pointerisRef
- false if the reference isn't a frame pointerpublic void entryToJNI(int encodedReferenceOffsets)
encodedReferenceOffsets
- bit mask marking which elements on the stack hold objects that need
encoding as JNI ref identifierspublic Object exitFromJNI(int offset)
offset
- offset into JNI reference tables of result
public Object getJNIRef(int offset)
offset
- in JNIRefs stack
public void deleteJNIRef(int offset)
offset
- in JNIRefs stackpublic void dumpJniRefsStack()
public void recordException(Throwable e)
e
- An exception or errorpublic static void throwPendingException()
public Throwable getException()
public static void initFunctionTable(FunctionTable functions)
public static void boot()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |