* src/vm/access.cpp,
authorAndreas HUBERT <andreas.hubert@gmx.at>
Thu, 16 Oct 2008 06:56:29 +0000 (08:56 +0200)
committerAndreas HUBERT <andreas.hubert@gmx.at>
Thu, 16 Oct 2008 06:56:29 +0000 (08:56 +0200)
  src/vm/access.hpp: Moved to C++.

--HG--
rename : src/vm/access.c => src/vm/access.cpp
rename : src/vm/access.h => src/vm/access.hpp

14 files changed:
src/native/vm/gnuclasspath/java_lang_reflect_VMField.cpp
src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp
src/native/vm/reflection.cpp
src/vm/Makefile.am
src/vm/access.c [deleted file]
src/vm/access.cpp [new file with mode: 0644]
src/vm/access.h [deleted file]
src/vm/access.hpp [new file with mode: 0644]
src/vm/javaobjects.cpp
src/vm/jit/verify/typecheck-typeinferer.cpp
src/vm/jit/verify/typecheck.cpp
src/vm/linker.c
src/vm/resolve.cpp
src/vm/vm.cpp

index 4d2edb56b0bd4048f68e627f0d289b02612d8800..c39f05866aefa52573980a0917b8e11c6de2c1ee 100644 (file)
@@ -41,7 +41,7 @@
 # include "native/vm/reflection.hpp"
 #endif
 
-#include "vm/access.h"
+#include "vm/access.hpp"
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
index 7d345caa655a4173d9f7ae04df31418159c8d718..e4cbf89a2e4cb5049fa8a01ec32cbdd717885e57 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "native/vm/reflection.hpp"
 
-#include "vm/access.h"
+#include "vm/access.hpp"
 #include "vm/jit/builtin.hpp"
 #include "vm/class.hpp"
 #include "vm/exceptions.hpp"
index a26a50c4a300044e39992c83eef1c6b5a9bee74a..73a8545b8afef1b164d7e7987378f5782e0b7db4 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "native/vm/reflection.hpp"
 
-#include "vm/access.h"
+#include "vm/access.hpp"
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
index 829fed607d0331a7b25074685fc27001f03cb8b7..8234f5a2c879b2bd7e23696f2fbc4a1019ae4570 100644 (file)
@@ -77,8 +77,8 @@ noinst_LTLIBRARIES = \
        libvm.la
 
 libvm_la_SOURCES = \
-       access.c \
-       access.h \
+       access.cpp \
+       access.hpp \
        $(ANNOTATION_SOURCES) \
        array.cpp \
        array.hpp \
diff --git a/src/vm/access.c b/src/vm/access.c
deleted file mode 100644 (file)
index 218cff6..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-/* src/vm/access.c - checking access rights
-
-   Copyright (C) 1996-2005, 2006, 2007, 2008
-   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
-
-   This file is part of CACAO.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-*/
-
-
-#include "config.h"
-
-#include <assert.h>
-#include <string.h>
-
-#include "vm/types.h"
-
-#include "mm/memory.h"
-
-#include "native/llni.h"
-
-#include "vm/access.h"
-#include "vm/jit/builtin.hpp"
-#include "vm/class.hpp"
-#include "vm/exceptions.hpp"
-#include "vm/field.hpp"
-#include "vm/globals.hpp"
-#include "vm/method.hpp"
-
-#include "vm/jit/stacktrace.hpp"
-
-
-/* access_is_accessible_class **************************************************
-   Check if a class is accessible from another class
-  
-   IN:
-       referer..........the class containing the reference
-       cls..............the result of resolving the reference
-  
-   RETURN VALUE:
-       true.............access permitted
-       false............access denied
-   
-   NOTE:
-       This function performs the checks listed in section 5.4.4.
-          "Access Control" of "The Java(TM) Virtual Machine Specification,
-          Second Edition".
-
-*******************************************************************************/
-
-bool access_is_accessible_class(classinfo *referer, classinfo *cls)
-{
-       assert(referer);
-       assert(cls);
-
-       /* Public classes are always accessible. */
-
-       if (cls->flags & ACC_PUBLIC)
-               return true;
-
-       /* A class in the same package is always accessible. */
-
-       if (SAME_PACKAGE(referer, cls))
-               return true;
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-       /* Code for Sun's OpenJDK (see
-          hotspot/src/share/vm/runtime/reflection.cpp
-          (Reflection::verify_class_access)): Allow all accesses from
-          sun/reflect/MagicAccessorImpl subclasses to succeed
-          trivially. */
-
-       /* NOTE: This check must be before checks that could return
-          false. */
-
-       if (class_issubclass(referer, class_sun_reflect_MagicAccessorImpl))
-               return true;
-#endif
-
-       /* A non-public class in another package is not accessible. */
-
-       return false;
-}
-
-
-/* access_is_accessible_member *************************************************
-   Check if a field or method is accessible from a given class
-  
-   IN:
-       referer..........the class containing the reference
-       declarer.........the class declaring the member
-       memberflags......the access flags of the member
-  
-   RETURN VALUE:
-       true.............access permitted
-       false............access denied
-
-   NOTE:
-       This function only performs the checks listed in section 5.4.4.
-          "Access Control" of "The Java(TM) Virtual Machine Specification,
-          Second Edition".
-
-          In particular a special condition for protected access with is
-          part of the verification process according to the spec is not
-          checked in this function.
-   
-*******************************************************************************/
-
-bool access_is_accessible_member(classinfo *referer, classinfo *declarer,
-                                                                s4 memberflags)
-{
-       assert(referer);
-       assert(declarer);
-
-       /* Public members are accessible. */
-
-       if (memberflags & ACC_PUBLIC)
-               return true;
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-       /* Code for Sun's OpenJDK (see
-          hotspot/src/share/vm/runtime/reflection.cpp
-          (Reflection::verify_class_access)): Allow all accesses from
-          sun/reflect/MagicAccessorImpl subclasses to succeed
-          trivially. */
-
-       /* NOTE: This check must be before checks that could return
-          false. */
-
-       if (class_issubclass(referer, class_sun_reflect_MagicAccessorImpl))
-               return true;
-#endif
-
-       /* {declarer is not an interface} */
-
-       /* private members are only accessible by the class itself */
-
-       if (memberflags & ACC_PRIVATE)
-               return (referer == declarer);
-
-       /* {the member is protected or package private} */
-
-       /* protected and package private members are accessible in the
-          same package */
-
-       if (SAME_PACKAGE(referer, declarer))
-               return true;
-
-       /* package private members are not accessible outside the package */
-
-       if (!(memberflags & ACC_PROTECTED))
-               return false;
-
-       /* {the member is protected and declarer is in another package} */
-
-       /* a necessary condition for access is that referer is a subclass
-          of declarer */
-
-       assert((referer->state & CLASS_LINKED) && (declarer->state & CLASS_LINKED));
-
-       if (class_isanysubclass(referer, declarer))
-               return true;
-
-       return false;
-}
-
-
-/* access_check_field **********************************************************
-   Check if the (indirect) caller has access rights to the specified
-   field.
-  
-   IN:
-       f................the field to check
-          callerdepth......number of callers to ignore
-                           For example if the stacktrace looks like this:
-
-                                  [0] java.lang.reflect.Method.invokeNative (Native Method)
-                                  [1] java.lang.reflect.Method.invoke
-                                  [2] <caller>
-
-                                       you must specify 2 so the access rights of <caller> 
-                                               are checked.
-  
-   RETURN VALUE:
-       true.............access permitted
-       false............access denied, an exception has been thrown
-   
-*******************************************************************************/
-
-#if defined(ENABLE_JAVASE)
-bool access_check_field(fieldinfo *f, int callerdepth)
-{
-       classinfo *callerclass;
-       char      *msg;
-       int        msglen;
-       utf       *u;
-
-       /* If everything is public, there is nothing to check. */
-
-       if ((f->clazz->flags & ACC_PUBLIC) && (f->flags & ACC_PUBLIC))
-               return true;
-
-       /* Get the caller's class. */
-
-       callerclass = stacktrace_get_caller_class(callerdepth);
-
-       if (callerclass == NULL)
-               return false;
-
-       /* Check access rights. */
-
-       if (!access_is_accessible_member(callerclass, f->clazz, f->flags)) {
-               msglen =
-                       utf_bytes(f->clazz->name) +
-                       strlen(".") +
-                       utf_bytes(f->name) +
-                       strlen(" not accessible from ") +
-                       utf_bytes(callerclass->name) +
-                       strlen("0");
-
-               msg = MNEW(char, msglen);
-
-               utf_copy_classname(msg, f->clazz->name);
-               strcat(msg, ".");
-               utf_cat_classname(msg, f->name);
-               strcat(msg, " not accessible from ");
-               utf_cat_classname(msg, callerclass->name);
-
-               u = utf_new_char(msg);
-
-               MFREE(msg, char, msglen);
-               
-               exceptions_throw_illegalaccessexception(u);
-
-               return false;
-       }
-
-       /* access granted */
-
-       return true;
-}
-#endif
-
-
-/* access_check_method *********************************************************
-   Check if the (indirect) caller has access rights to the specified
-   method.
-  
-   IN:
-       m................the method to check
-          callerdepth......number of callers to ignore
-                           For example if the stacktrace looks like this:
-
-                                  [1] java.lang.reflect.Method.invokeNative (Native Method)
-                                  [1] java.lang.reflect.Method.invoke
-                                  [2] <caller>
-
-                                       you must specify 2 so the access rights of <caller> 
-                                               are checked.
-  
-   RETURN VALUE:
-       true.............access permitted
-       false............access denied, an exception has been thrown
-   
-*******************************************************************************/
-
-#if defined(ENABLE_JAVASE)
-bool access_check_method(methodinfo *m, int callerdepth)
-{
-       classinfo *callerclass;
-       char      *msg;
-       int        msglen;
-       utf       *u;
-
-       /* If everything is public, there is nothing to check. */
-
-       if ((m->clazz->flags & ACC_PUBLIC) && (m->flags & ACC_PUBLIC))
-               return true;
-
-       /* Get the caller's class. */
-
-       callerclass = stacktrace_get_caller_class(callerdepth);
-
-       if (callerclass == NULL)
-               return false;
-
-       /* Check access rights. */
-
-       if (!access_is_accessible_member(callerclass, m->clazz, m->flags)) {
-               msglen =
-                       utf_bytes(m->clazz->name) +
-                       strlen(".") +
-                       utf_bytes(m->name) +
-                       utf_bytes(m->descriptor) +
-                       strlen(" not accessible from ") +
-                       utf_bytes(callerclass->name) +
-                       strlen("0");
-
-               msg = MNEW(char, msglen);
-
-               utf_copy_classname(msg, m->clazz->name);
-               strcat(msg, ".");
-               utf_cat_classname(msg, m->name);
-               utf_cat_classname(msg, m->descriptor);
-               strcat(msg, " not accessible from ");
-               utf_cat_classname(msg, callerclass->name);
-
-               u = utf_new_char(msg);
-
-               MFREE(msg, char, msglen);
-               
-               exceptions_throw_illegalaccessexception(u);
-
-               return false;
-       }
-
-       /* access granted */
-
-       return true;
-}
-#endif
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim:noexpandtab:sw=4:ts=4:
- */
-
diff --git a/src/vm/access.cpp b/src/vm/access.cpp
new file mode 100644 (file)
index 0000000..a0abbc1
--- /dev/null
@@ -0,0 +1,364 @@
+/* src/vm/access.c - checking access rights
+
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+#include <string.h>
+
+#include "vm/types.h"
+
+#include "mm/memory.h"
+
+#include "native/llni.h"
+
+#include "vm/access.hpp"
+#include "vm/jit/builtin.hpp"
+#include "vm/class.hpp"
+#include "vm/exceptions.hpp"
+#include "vm/field.hpp"
+#include "vm/globals.hpp"
+#include "vm/method.hpp"
+
+#include "vm/jit/stacktrace.hpp"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* access_is_accessible_class **************************************************
+   Check if a class is accessible from another class
+  
+   IN:
+       referer..........the class containing the reference
+       cls..............the result of resolving the reference
+  
+   RETURN VALUE:
+       true.............access permitted
+       false............access denied
+   
+   NOTE:
+       This function performs the checks listed in section 5.4.4.
+          "Access Control" of "The Java(TM) Virtual Machine Specification,
+          Second Edition".
+
+*******************************************************************************/
+
+bool access_is_accessible_class(classinfo *referer, classinfo *cls)
+{
+       assert(referer);
+       assert(cls);
+
+       /* Public classes are always accessible. */
+
+       if (cls->flags & ACC_PUBLIC)
+               return true;
+
+       /* A class in the same package is always accessible. */
+
+       if (SAME_PACKAGE(referer, cls))
+               return true;
+
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+       /* Code for Sun's OpenJDK (see
+          hotspot/src/share/vm/runtime/reflection.cpp
+          (Reflection::verify_class_access)): Allow all accesses from
+          sun/reflect/MagicAccessorImpl subclasses to succeed
+          trivially. */
+
+       /* NOTE: This check must be before checks that could return
+          false. */
+
+       if (class_issubclass(referer, class_sun_reflect_MagicAccessorImpl))
+               return true;
+#endif
+
+       /* A non-public class in another package is not accessible. */
+
+       return false;
+}
+
+
+/* access_is_accessible_member *************************************************
+   Check if a field or method is accessible from a given class
+  
+   IN:
+       referer..........the class containing the reference
+       declarer.........the class declaring the member
+       memberflags......the access flags of the member
+  
+   RETURN VALUE:
+       true.............access permitted
+       false............access denied
+
+   NOTE:
+       This function only performs the checks listed in section 5.4.4.
+          "Access Control" of "The Java(TM) Virtual Machine Specification,
+          Second Edition".
+
+          In particular a special condition for protected access with is
+          part of the verification process according to the spec is not
+          checked in this function.
+   
+*******************************************************************************/
+
+bool access_is_accessible_member(classinfo *referer, classinfo *declarer,
+                                                                s4 memberflags)
+{
+       assert(referer);
+       assert(declarer);
+
+       /* Public members are accessible. */
+
+       if (memberflags & ACC_PUBLIC)
+               return true;
+
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+       /* Code for Sun's OpenJDK (see
+          hotspot/src/share/vm/runtime/reflection.cpp
+          (Reflection::verify_class_access)): Allow all accesses from
+          sun/reflect/MagicAccessorImpl subclasses to succeed
+          trivially. */
+
+       /* NOTE: This check must be before checks that could return
+          false. */
+
+       if (class_issubclass(referer, class_sun_reflect_MagicAccessorImpl))
+               return true;
+#endif
+
+       /* {declarer is not an interface} */
+
+       /* private members are only accessible by the class itself */
+
+       if (memberflags & ACC_PRIVATE)
+               return (referer == declarer);
+
+       /* {the member is protected or package private} */
+
+       /* protected and package private members are accessible in the
+          same package */
+
+       if (SAME_PACKAGE(referer, declarer))
+               return true;
+
+       /* package private members are not accessible outside the package */
+
+       if (!(memberflags & ACC_PROTECTED))
+               return false;
+
+       /* {the member is protected and declarer is in another package} */
+
+       /* a necessary condition for access is that referer is a subclass
+          of declarer */
+
+       assert((referer->state & CLASS_LINKED) && (declarer->state & CLASS_LINKED));
+
+       if (class_isanysubclass(referer, declarer))
+               return true;
+
+       return false;
+}
+
+
+/* access_check_field **********************************************************
+   Check if the (indirect) caller has access rights to the specified
+   field.
+  
+   IN:
+       f................the field to check
+          callerdepth......number of callers to ignore
+                           For example if the stacktrace looks like this:
+
+                                  [0] java.lang.reflect.Method.invokeNative (Native Method)
+                                  [1] java.lang.reflect.Method.invoke
+                                  [2] <caller>
+
+                                       you must specify 2 so the access rights of <caller> 
+                                               are checked.
+  
+   RETURN VALUE:
+       true.............access permitted
+       false............access denied, an exception has been thrown
+   
+*******************************************************************************/
+
+#if defined(ENABLE_JAVASE)
+bool access_check_field(fieldinfo *f, int callerdepth)
+{
+       classinfo *callerclass;
+       char      *msg;
+       int        msglen;
+       utf       *u;
+
+       /* If everything is public, there is nothing to check. */
+
+       if ((f->clazz->flags & ACC_PUBLIC) && (f->flags & ACC_PUBLIC))
+               return true;
+
+       /* Get the caller's class. */
+
+       callerclass = stacktrace_get_caller_class(callerdepth);
+
+       if (callerclass == NULL)
+               return false;
+
+       /* Check access rights. */
+
+       if (!access_is_accessible_member(callerclass, f->clazz, f->flags)) {
+               msglen =
+                       utf_bytes(f->clazz->name) +
+                       strlen(".") +
+                       utf_bytes(f->name) +
+                       strlen(" not accessible from ") +
+                       utf_bytes(callerclass->name) +
+                       strlen("0");
+
+               msg = MNEW(char, msglen);
+
+               utf_copy_classname(msg, f->clazz->name);
+               strcat(msg, ".");
+               utf_cat_classname(msg, f->name);
+               strcat(msg, " not accessible from ");
+               utf_cat_classname(msg, callerclass->name);
+
+               u = utf_new_char(msg);
+
+               MFREE(msg, char, msglen);
+               
+               exceptions_throw_illegalaccessexception(u);
+
+               return false;
+       }
+
+       /* access granted */
+
+       return true;
+}
+#endif
+
+
+/* access_check_method *********************************************************
+   Check if the (indirect) caller has access rights to the specified
+   method.
+  
+   IN:
+       m................the method to check
+          callerdepth......number of callers to ignore
+                           For example if the stacktrace looks like this:
+
+                                  [1] java.lang.reflect.Method.invokeNative (Native Method)
+                                  [1] java.lang.reflect.Method.invoke
+                                  [2] <caller>
+
+                                       you must specify 2 so the access rights of <caller> 
+                                               are checked.
+  
+   RETURN VALUE:
+       true.............access permitted
+       false............access denied, an exception has been thrown
+   
+*******************************************************************************/
+
+#if defined(ENABLE_JAVASE)
+bool access_check_method(methodinfo *m, int callerdepth)
+{
+       classinfo *callerclass;
+       char      *msg;
+       int        msglen;
+       utf       *u;
+
+       /* If everything is public, there is nothing to check. */
+
+       if ((m->clazz->flags & ACC_PUBLIC) && (m->flags & ACC_PUBLIC))
+               return true;
+
+       /* Get the caller's class. */
+
+       callerclass = stacktrace_get_caller_class(callerdepth);
+
+       if (callerclass == NULL)
+               return false;
+
+       /* Check access rights. */
+
+       if (!access_is_accessible_member(callerclass, m->clazz, m->flags)) {
+               msglen =
+                       utf_bytes(m->clazz->name) +
+                       strlen(".") +
+                       utf_bytes(m->name) +
+                       utf_bytes(m->descriptor) +
+                       strlen(" not accessible from ") +
+                       utf_bytes(callerclass->name) +
+                       strlen("0");
+
+               msg = MNEW(char, msglen);
+
+               utf_copy_classname(msg, m->clazz->name);
+               strcat(msg, ".");
+               utf_cat_classname(msg, m->name);
+               utf_cat_classname(msg, m->descriptor);
+               strcat(msg, " not accessible from ");
+               utf_cat_classname(msg, callerclass->name);
+
+               u = utf_new_char(msg);
+
+               MFREE(msg, char, msglen);
+               
+               exceptions_throw_illegalaccessexception(u);
+
+               return false;
+       }
+
+       /* access granted */
+
+       return true;
+}
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
+
diff --git a/src/vm/access.h b/src/vm/access.h
deleted file mode 100644 (file)
index d1a51f8..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/* src/vm/access.h - checking access rights
-
-   Copyright (C) 1996-2005, 2006, 2007, 2008
-   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
-
-   This file is part of CACAO.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-*/
-
-
-#ifndef _ACCESS_H
-#define _ACCESS_H
-
-#include "config.h"
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "vm/class.hpp"
-#include "vm/field.hpp"
-#include "vm/global.h"
-#include "vm/method.hpp"
-
-
-/* macros *********************************************************************/
-
-#define SAME_PACKAGE(a,b)                                  \
-                       ((a)->classloader == (b)->classloader &&       \
-                        (a)->packagename == (b)->packagename)
-
-
-/* function prototypes ********************************************************/
-
-bool access_is_accessible_class(classinfo *referer, classinfo *cls);
-
-bool access_is_accessible_member(classinfo *referer, classinfo *declarer,
-                                                                int32_t memberflags);
-
-#if defined(ENABLE_JAVASE)
-bool access_check_field(fieldinfo *f, int callerdepth);
-bool access_check_method(methodinfo *m, int callerdepth);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ACCESS_H */
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim:noexpandtab:sw=4:ts=4:
- */
-
diff --git a/src/vm/access.hpp b/src/vm/access.hpp
new file mode 100644 (file)
index 0000000..9ec44c9
--- /dev/null
@@ -0,0 +1,82 @@
+/* src/vm/access.h - checking access rights
+
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _ACCESS_H
+#define _ACCESS_H
+
+#include "config.h"
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "vm/class.hpp"
+#include "vm/field.hpp"
+#include "vm/global.h"
+#include "vm/method.hpp"
+
+
+/* macros *********************************************************************/
+
+#define SAME_PACKAGE(a,b)                                  \
+                       ((a)->classloader == (b)->classloader &&       \
+                        (a)->packagename == (b)->packagename)
+
+
+/* function prototypes ********************************************************/
+
+bool access_is_accessible_class(classinfo *referer, classinfo *cls);
+
+bool access_is_accessible_member(classinfo *referer, classinfo *declarer,
+                                                                int32_t memberflags);
+
+#if defined(ENABLE_JAVASE)
+bool access_check_field(fieldinfo *f, int callerdepth);
+bool access_check_method(methodinfo *m, int callerdepth);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ACCESS_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
+
index 6858eb6e006ad430e980071ace9abacbfd7b247f..b8a0d601326b5b830b68e14a474d44ca009341df 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "native/vm/reflection.hpp"
 
-#include "vm/access.h"
+#include "vm/access.hpp"
 #include "vm/jit/builtin.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
index 0d48656a3ae64a734295d30f4fc7e448aaf297f2..7626890762e3150811d039daf9e155ccc5bb11c3 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/access.h"
+#include "vm/access.hpp"
 #include "vm/array.hpp"
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index 695be019994f94bf6353abcb2648d9c9f2f30478..d63c422007abe0180f8f967c261d7f63df2d2489 100644 (file)
@@ -147,7 +147,7 @@ error reporting.
 
 #include "toolbox/logging.h"
 
-#include "vm/access.h"
+#include "vm/access.hpp"
 #include "vm/array.hpp"
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index 8ee26ca3644fba87e59f2a44b3f337c3c93efb51..4a18a273f75ad0b0da0a546f3370aad2e80be6cf 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/access.h"
+#include "vm/access.hpp"
 #include "vm/array.hpp"
 #include "vm/class.hpp"
 #include "vm/classcache.hpp"
index 5443a3a3bb8c304fc5551dd2f929fa5ef52e31c0..b7df7a40420b6c1bc580e568723d5b10340be5ec 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "mm/memory.h"
 
-#include "vm/access.h"
+#include "vm/access.hpp"
 #include "vm/classcache.hpp"
 #include "vm/descriptor.h"
 #include "vm/exceptions.hpp"
index 3cd7343b50966ba29fee481e715198c99d70141b..3ab06cddcba0c944639eafdd46bbd6a047983157 100644 (file)
@@ -685,7 +685,7 @@ VM::VM(JavaVMInitArgs* vm_args)
        _jnienv = new JNIEnv();
 
 #if defined(ENABLE_JNI)
-       _jnienv->functions = &_Jv_JNINativeInterface;
+       _jnienv->p = &_Jv_JNINativeInterface;
 #endif
 
        /* actually create the JVM */