Search in sources :

Example 1 with InterceptedState

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;
}
Also used : InterceptedState(com.oracle.svm.agent.stackaccess.InterceptedState) JNIObjectHandle(com.oracle.svm.jni.nativeapi.JNIObjectHandle) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 2 with InterceptedState

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;
}
Also used : InterceptedState(com.oracle.svm.agent.stackaccess.InterceptedState) JNIObjectHandle(com.oracle.svm.jni.nativeapi.JNIObjectHandle) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 3 with InterceptedState

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;
}
Also used : InterceptedState(com.oracle.svm.agent.stackaccess.InterceptedState) Support.fromCString(com.oracle.svm.jvmtiagentbase.Support.fromCString) JNIObjectHandle(com.oracle.svm.jni.nativeapi.JNIObjectHandle) CCharPointerPointer(org.graalvm.nativeimage.c.type.CCharPointerPointer) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 4 with InterceptedState

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;
}
Also used : InterceptedState(com.oracle.svm.agent.stackaccess.InterceptedState) JNIObjectHandle(com.oracle.svm.jni.nativeapi.JNIObjectHandle) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 5 with InterceptedState

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;
}
Also used : InterceptedState(com.oracle.svm.agent.stackaccess.InterceptedState) JNIObjectHandle(com.oracle.svm.jni.nativeapi.JNIObjectHandle) JNIMethodId(com.oracle.svm.jni.nativeapi.JNIMethodId) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Aggregations

InterceptedState (com.oracle.svm.agent.stackaccess.InterceptedState)15 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)14 JNIObjectHandle (com.oracle.svm.jni.nativeapi.JNIObjectHandle)14 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)14 Support.fromCString (com.oracle.svm.jvmtiagentbase.Support.fromCString)5 JNIFieldId (com.oracle.svm.jni.nativeapi.JNIFieldId)3 JNIMethodId (com.oracle.svm.jni.nativeapi.JNIMethodId)3 AgentMetaInfProcessor (com.oracle.svm.agent.ignoredconfig.AgentMetaInfProcessor)1 ConfigurationWithOriginsResultWriter (com.oracle.svm.agent.predicatedconfig.ConfigurationWithOriginsResultWriter)1 MethodInfoRecordKeeper (com.oracle.svm.agent.predicatedconfig.MethodInfoRecordKeeper)1 EagerlyLoadedJavaStackAccess (com.oracle.svm.agent.stackaccess.EagerlyLoadedJavaStackAccess)1 OnDemandJavaStackAccess (com.oracle.svm.agent.stackaccess.OnDemandJavaStackAccess)1 ConfigurationResultWriter (com.oracle.svm.agent.tracing.ConfigurationResultWriter)1 TraceFileWriter (com.oracle.svm.agent.tracing.TraceFileWriter)1 Tracer (com.oracle.svm.agent.tracing.core.Tracer)1 TracingResultWriter (com.oracle.svm.agent.tracing.core.TracingResultWriter)1 ConfigurationSet (com.oracle.svm.configure.config.ConfigurationSet)1 FilterConfigurationParser (com.oracle.svm.configure.filters.FilterConfigurationParser)1 RuleNode (com.oracle.svm.configure.filters.RuleNode)1 AccessAdvisor (com.oracle.svm.configure.trace.AccessAdvisor)1