[4098dc]: tools / bootImageRunner / org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline.c Maximize Restore History

Download this file

org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline.c    50 lines (43 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* This file is part of the Jikes RVM project (http://jikesrvm.org).
*
* This file is licensed to You under the Eclipse Public License (EPL);
* You may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.opensource.org/licenses/eclipse-1.0.php
*
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership.
*/
/*****************************************************************
* JNI functions to support OnLoad
*/
// Java includes
#include <jni.h>
// generated class header
#include "org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline.h"
extern struct JavaVM_ sysJavaVM;
typedef jint (*Agent_OnLoad)(JavaVM_ *vm, const char *options, void *reserved);
/*
* Class: org_jikesrvm_runtime_JVMTIAgent
* Method: runAgent_OnLoad
* Signature: (Lorg/vmmagic/unboxed/Address;)I
*/
extern "C" JNIEXPORT jint JNICALL
Java_org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline_Agent_1OnLoad (JNIEnv *env,
jclass clazz,
jobject JAgent_OnLoadAddress,
jobject JVMTIEnvAddress,
jstring options) {
// TODO: Ugly since this is all done in the VM boot sequence. We should
// probably do this conversion in Java and pass the pointer in here.
// DANGER: this is a C++ call, not straight C.
//printf("JNI env at %p, JVMTI env at %p\n", (void *)env, (void *)JVMTIEnvAddress);
sysJavaVM.reserved0 = (void *)JVMTIEnvAddress;
const char *optsString = env->GetStringUTFChars(options, 0);
jint ret = ((Agent_OnLoad)JAgent_OnLoadAddress)(&sysJavaVM, optsString, NULL);
sysJavaVM.reserved0 = NULL;
env->ReleaseStringUTFChars(options, optsString);
return ret;
}