Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

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

Download this file

org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline.c    120 lines (109 with data), 5.6 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
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
* 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>
#include <jvmti.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);
typedef void (*AgentThread_Run)(jvmtiEnv *jvmti_env, JNIEnv *jni_env, void *arg);
/*
* Class: org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline
* Method: AgentThread_Run
* Signature: (Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Word;)V
*/
extern "C" JNIEXPORT void JNICALL
Java_org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline_AgentThread_1Run (JNIEnv *jni_env,
jclass clazz,
jobject proc,
jobject JVMTIEnvAddress,
jobject arg) {
((AgentThread_Run) proc)((jvmtiEnv *)JVMTIEnvAddress, jni_env, (void *)arg);
}
/*
* 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;
}
/*
* Class: org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline
* Method: VMStart
* Signature: (Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Address;)V
*/
extern "C" JNIEXPORT void JNICALL
Java_org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline_VMStart (JNIEnv *jni_env,
jclass clazz,
jobject VMStart_Address,
jobject JVMTIEnv_Address) {
((jvmtiEventVMStart) VMStart_Address)((jvmtiEnv *)JVMTIEnv_Address, jni_env);
}
/*
* Class: org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline
* Method: VMInit
* Signature: (Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Address;Ljava/lang/Thread;)V
*/
extern "C" JNIEXPORT void JNICALL
Java_org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline_VMInit (JNIEnv *jni_env,
jclass clazz,
jobject VMInit_Address,
jobject JVMTIEnv_Address,
jobject thread) {
((jvmtiEventVMInit) VMInit_Address)((jvmtiEnv *)JVMTIEnv_Address, jni_env, thread);
}
/*
* Class: org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline
* Method: ThreadStart
* Signature: (Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Address;Ljava/lang/Thread;)V
*/
extern "C" JNIEXPORT void JNICALL
Java_org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline_ThreadStart (JNIEnv *jni_env,
jclass clazz,
jobject ThreadStart_Address,
jobject JVMTIEnv_Address,
jobject thread) {
((jvmtiEventThreadStart) ThreadStart_Address)((jvmtiEnv *)JVMTIEnv_Address, jni_env, thread);
}
/*
* Class: org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline
* Method: ThreadEnd
* Signature: (Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Address;Ljava/lang/Thread;)V
*/
extern "C" JNIEXPORT void JNICALL
Java_org_jikesrvm_runtime_jvmti_JVMTIEventTrampoline_ThreadEnd (JNIEnv *jni_env,
jclass clazz,
jobject ThreadEnd_Address,
jobject JVMTIEnv_Address,
jobject thread) {
((jvmtiEventThreadEnd) ThreadEnd_Address)((jvmtiEnv *)JVMTIEnv_Address, jni_env, thread);
}