1 /* src/native/vm/VMStackWalker.c - gnu/classpath/VMStackWalker
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 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., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Thalinger
31 $Id: VMStackWalker.c 4180 2006-01-12 23:07:23Z twisti $
38 #include "native/jni.h"
39 #include "native/native.h"
40 #include "native/include/java_lang_Class.h"
41 #include "native/include/java_lang_ClassLoader.h"
42 #include "vm/builtin.h"
44 #include "vm/global.h"
45 #include "vm/options.h"
49 * Class: gnu/classpath/VMStackWalker
50 * Method: getClassContext
51 * Signature: ()[Ljava/lang/Class;
53 JNIEXPORT java_objectarray* JNICALL Java_gnu_classpath_VMStackWalker_getClassContext(JNIEnv *env, jclass clazz)
55 /* if (cacao_initializing) */
58 #if defined(__ALPHA__) || defined(__ARM__) || defined(__I386__) || defined(__MIPS__) || defined(__POWERPC__) || defined(__X86_64__)
59 /* these JITs support stacktraces, and so does the interpreter */
61 return cacao_createClassContextArray();
64 # if defined(ENABLE_INTRP)
65 /* the interpreter supports stacktraces, even if the JIT does not */
68 return cacao_createClassContextArray();
73 return builtin_anewarray(0, class_java_lang_Class);
80 * Class: gnu/classpath/VMStackWalker
81 * Method: getCallingClass
82 * Signature: ()Ljava/lang/Class;
84 JNIEXPORT java_lang_Class* JNICALL Java_gnu_classpath_VMStackWalker_getCallingClass(JNIEnv *env, jclass clazz)
86 #if defined(__ALPHA__) || defined(__ARM__) || defined(__I386__) || defined(__MIPS__) || defined(__POWERPC__) || defined(__X86_64__)
87 /* these JITs support stacktraces, and so does the interpreter */
91 oa = cacao_createClassContextArray();
93 if (oa->header.size < 2)
96 return (java_lang_Class *) oa->data[1];
99 # if defined(ENABLE_INTRP)
100 /* the interpreter supports stacktraces, even if the JIT does not */
103 java_objectarray *oa;
105 oa = cacao_createClassContextArray();
107 if (oa->header.size < 2)
110 return (java_lang_Class *) oa->data[1];
122 * Class: gnu/classpath/VMStackWalker
123 * Method: getCallingClassLoader
124 * Signature: ()Ljava/lang/ClassLoader;
126 JNIEXPORT java_lang_ClassLoader* JNICALL Java_gnu_classpath_VMStackWalker_getCallingClassLoader(JNIEnv *env, jclass clazz)
128 #if defined(__ALPHA__) || defined(__ARM__) || defined(__I386__) || defined(__MIPS__) || defined(__POWERPC__) || defined(__X86_64__)
129 /* these JITs support stacktraces, and so does the interpreter */
131 java_objectarray *oa;
134 oa = cacao_createClassContextArray();
136 if (oa->header.size < 2)
139 c = (classinfo *) oa->data[1];
141 return (java_lang_ClassLoader *) c->classloader;
144 # if defined(ENABLE_INTRP)
145 /* the interpreter supports stacktraces, even if the JIT does not */
148 java_objectarray *oa;
151 oa = cacao_createClassContextArray();
153 if (oa->header.size < 2)
156 c = (classinfo *) oa->data[1];
158 return (java_lang_ClassLoader *) c->classloader;
170 * These are local overrides for various environment variables in Emacs.
171 * Please do not remove this and leave it at the end of the file, where
172 * Emacs will automagically detect them.
173 * ---------------------------------------------------------------------
176 * indent-tabs-mode: t