1 /* native/vm/VMSecurityManager.c - java/lang/VMSecurityManager
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: Roman Obermaiser
29 Changes: Joseph Wenninger
31 $Id: VMSecurityManager.c 1735 2004-12-07 14:33:27Z twisti $
36 #include "native/jni.h"
37 #include "native/native.h"
38 #include "native/include/java_lang_ClassLoader.h"
39 #include "toolbox/logging.h"
40 #include "vm/builtin.h"
41 #include "vm/tables.h"
42 #include "vm/jit/stacktrace.h"
46 * Class: java/lang/VMSecurityManager
47 * Method: currentClassLoader
48 * Signature: ()Ljava/lang/ClassLoader;
50 JNIEXPORT java_lang_ClassLoader* JNICALL Java_java_lang_VMSecurityManager_currentClassLoader(JNIEnv *env, jclass clazz)
52 log_text("Java_java_lang_VMSecurityManager_currentClassLoader");
54 if (cacao_initializing)
57 #if defined(__I386__) || defined(__ALPHA__)
58 return (java_lang_ClassLoader *) cacao_currentClassLoader();
61 /* XXX TWISTI: only a quick hack */
62 init_systemclassloader();
63 return SystemClassLoader;
69 * Class: java/lang/VMSecurityManager
70 * Method: getClassContext
71 * Signature: ()[Ljava/lang/Class;
73 JNIEXPORT java_objectarray* JNICALL Java_java_lang_VMSecurityManager_getClassContext(JNIEnv *env, jclass clazz)
75 log_text("Java_java_lang_VMSecurityManager_getClassContext called");
76 if (cacao_initializing) return 0;
77 #if defined(__I386__) || defined(__ALPHA__)
78 return cacao_createClassContextArray();
82 /* XXX TWISTI: only a quick hack */
83 return (java_objectarray *) builtin_newarray(0, class_array_of(class_java_lang_Class)->vftbl);
87 java_objectarray* temporaryGetClassContextHelper(methodinfo *m) {
92 if (!(m->name)) log_text("method or block has no name");
96 if (!(m->class)) log_text("method or block has no class");
98 utf_display(m->class->name);
102 log_text("temporaryGetClassContextHelper called");
103 if (adr==0) log_text("NO REAL METHOD");
106 struct methodinfo *m=(struct methodinfo*)(*(adr-1));
107 if (!(m->name)) log_text("method or block has no name");
109 utf_display(m->name);
110 if (!(m->class)) log_text("method or block has no class");
112 utf_display(m->class->name);
113 printf("\nFrame size:%ld\n",(long)(*(adr-2)));
115 printf("saveint:%ld\n",(long)(*adr));
116 printf("saveflt:%ld\n",(long)(*(adr-1)));
118 log_text("temporaryGetClassContextHelper leaving");
119 return (java_objectarray *) builtin_newarray(0, class_array_of(class_java_lang_Class)->vftbl);
124 java_objectarray* temporaryGetClassContextHelper2() {
125 log_text("temporaryGetClassContextHelper2 called");
126 return (java_objectarray *) builtin_newarray(0, class_array_of(class_java_lang_Class)->vftbl);
131 * These are local overrides for various environment variables in Emacs.
132 * Please do not remove this and leave it at the end of the file, where
133 * Emacs will automagically detect them.
134 * ---------------------------------------------------------------------
137 * indent-tabs-mode: t