use of com.oracle.svm.agent.stackaccess.InterceptedState in project graal by oracle.
the class JniCallInterceptor method findClass.
@CEntryPoint(name = "FindClass")
@CEntryPointOptions(prologue = AgentIsolate.Prologue.class)
private static JNIObjectHandle findClass(JNIEnvironment env, CCharPointer name) {
InterceptedState state = initInterceptedState();
JNIObjectHandle callerClass = getCallerClass(state, env);
JNIObjectHandle result = jniFunctions().getFindClass().invoke(env, name);
if (nullHandle().equal(result) || clearException(env)) {
result = nullHandle();
}
if (shouldTrace()) {
traceCall(env, "FindClass", nullHandle(), nullHandle(), callerClass, result.notEqual(nullHandle()), state, fromCString(name));
}
return result;
}
use of com.oracle.svm.agent.stackaccess.InterceptedState in project graal by oracle.
the class JniCallInterceptor method throwNew.
@CEntryPoint(name = "ThrowNew")
@CEntryPointOptions(prologue = AgentIsolate.Prologue.class)
private static int throwNew(JNIEnvironment env, JNIObjectHandle clazz, CCharPointer message) {
InterceptedState state = initInterceptedState();
JNIObjectHandle callerClass = getCallerClass(state, env);
int result = jniFunctions().getThrowNew().invoke(env, clazz, message);
if (shouldTrace()) {
traceCall(env, "ThrowNew", clazz, nullHandle(), callerClass, (result == JNIErrors.JNI_OK()), state, Tracer.UNKNOWN_VALUE);
}
return result;
}
use of com.oracle.svm.agent.stackaccess.InterceptedState in project graal by oracle.
the class JniCallInterceptor method toReflectedMethod.
@CEntryPoint(name = "ToReflectedMethod")
@CEntryPointOptions(prologue = AgentIsolate.Prologue.class)
private static JNIObjectHandle toReflectedMethod(JNIEnvironment env, JNIObjectHandle clazz, JNIMethodId method, boolean isStatic) {
InterceptedState state = initInterceptedState();
JNIObjectHandle callerClass = getCallerClass(state, env);
JNIObjectHandle declaring = getMethodDeclaringClass(method);
String name = null;
String signature = null;
CCharPointerPointer namePtr = StackValue.get(CCharPointerPointer.class);
CCharPointerPointer signaturePtr = StackValue.get(CCharPointerPointer.class);
if (jvmtiFunctions().GetMethodName().invoke(jvmtiEnv(), method, namePtr, signaturePtr, nullPointer()) == JvmtiError.JVMTI_ERROR_NONE) {
name = fromCString(namePtr.read());
signature = fromCString(signaturePtr.read());
jvmtiFunctions().Deallocate().invoke(jvmtiEnv(), namePtr.read());
jvmtiFunctions().Deallocate().invoke(jvmtiEnv(), signaturePtr.read());
}
JNIObjectHandle result = jniFunctions().getToReflectedMethod().invoke(env, clazz, method, isStatic);
if (shouldTrace()) {
traceCall(env, "ToReflectedMethod", clazz, declaring, callerClass, result.notEqual(nullHandle()), state, name, signature);
}
return result;
}
use of com.oracle.svm.agent.stackaccess.InterceptedState in project graal by oracle.
the class JniCallInterceptor method defineClass.
@CEntryPoint(name = "DefineClass")
@CEntryPointOptions(prologue = AgentIsolate.Prologue.class)
private static JNIObjectHandle defineClass(JNIEnvironment env, CCharPointer name, JNIObjectHandle loader, CCharPointer buf, int bufLen) {
InterceptedState state = initInterceptedState();
JNIObjectHandle callerClass = getCallerClass(state, env);
JNIObjectHandle result = jniFunctions().getDefineClass().invoke(env, name, loader, buf, bufLen);
if (shouldTrace()) {
traceCall(env, "DefineClass", nullHandle(), nullHandle(), callerClass, result.notEqual(nullHandle()), state, fromCString(name));
}
return result;
}
use of com.oracle.svm.agent.stackaccess.InterceptedState in project graal by oracle.
the class JniCallInterceptor method getStaticMethodID.
@CEntryPoint(name = "GetStaticMethodID")
@CEntryPointOptions(prologue = AgentIsolate.Prologue.class)
private static JNIMethodId getStaticMethodID(JNIEnvironment env, JNIObjectHandle clazz, CCharPointer name, CCharPointer signature) {
InterceptedState state = initInterceptedState();
JNIObjectHandle callerClass = getCallerClass(state, env);
JNIMethodId result = jniFunctions().getGetStaticMethodID().invoke(env, clazz, name, signature);
result.isNonNull();
if (shouldTrace()) {
traceCall(env, "GetStaticMethodID", clazz, getMethodDeclaringClass(result), callerClass, result.isNonNull(), state, fromCString(name), fromCString(signature));
}
return result;
}
Aggregations