1 /* src/native/vm/gnu/gnu_classpath_VMStackWalker.c
3 Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 $Id: gnu_classpath_VMStackWalker.c 7246 2007-01-29 18:49:05Z twisti $
32 #include "native/jni.h"
33 #include "native/native.h"
34 #include "native/include/java_lang_Class.h"
35 #include "native/include/java_lang_ClassLoader.h"
37 #include "vm/builtin.h"
38 #include "vm/global.h"
40 #include "vm/jit/stacktrace.h"
42 #include "vmcore/class.h"
43 #include "vmcore/options.h"
47 * Class: gnu/classpath/VMStackWalker
48 * Method: getClassContext
49 * Signature: ()[Ljava/lang/Class;
51 JNIEXPORT java_objectarray* JNICALL Java_gnu_classpath_VMStackWalker_getClassContext(JNIEnv *env, jclass clazz)
55 oa = stacktrace_getClassContext();
62 * Class: gnu/classpath/VMStackWalker
63 * Method: getCallingClass
64 * Signature: ()Ljava/lang/Class;
66 JNIEXPORT java_lang_Class* JNICALL Java_gnu_classpath_VMStackWalker_getCallingClass(JNIEnv *env, jclass clazz)
70 oa = stacktrace_getClassContext();
75 if (oa->header.size < 2)
78 return (java_lang_Class *) oa->data[1];
83 * Class: gnu/classpath/VMStackWalker
84 * Method: getCallingClassLoader
85 * Signature: ()Ljava/lang/ClassLoader;
87 JNIEXPORT java_lang_ClassLoader* JNICALL Java_gnu_classpath_VMStackWalker_getCallingClassLoader(JNIEnv *env, jclass clazz)
91 java_objectheader *cl;
93 oa = stacktrace_getClassContext();
98 if (oa->header.size < 2)
101 c = (classinfo *) oa->data[1];
104 return (java_lang_ClassLoader *) cl;
109 * Class: gnu/classpath/VMStackWalker
110 * Method: firstNonNullClassLoader
111 * Signature: ()Ljava/lang/ClassLoader;
113 JNIEXPORT java_lang_ClassLoader* JNICALL Java_gnu_classpath_VMStackWalker_firstNonNullClassLoader(JNIEnv *env, jclass clazz)
115 java_objectarray *oa;
117 java_objectheader *cl;
120 oa = stacktrace_getClassContext();
125 for (i = 0; i < oa->header.size; i++) {
126 c = (classinfo *) oa->data[i];
130 return (java_lang_ClassLoader *) cl;
138 * These are local overrides for various environment variables in Emacs.
139 * Please do not remove this and leave it at the end of the file, where
140 * Emacs will automagically detect them.
141 * ---------------------------------------------------------------------
144 * indent-tabs-mode: t
148 * vim:noexpandtab:sw=4:ts=4: