summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-21 14:50:14 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-21 14:50:14 +0000
commitd268be3507895e8a4593f668cd691b0ddf006b45 (patch)
tree21f6764f4fa3c779cf473479dd04137d8458622c
parent870fcc23335245f0bdeae25119a793ff51618015 (diff)
downloadgcc-d268be3507895e8a4593f668cd691b0ddf006b45.tar.gz
2005-03-17 Andrew Haley <aph@redhat.com>
* java/lang/natVMSecurityManager.cc (getClassContext): Add new arg: klass. Pass klass to _Jv_StackTrace::GetClassContext(). * java/lang/ClassLoader.java (getParent): Pass class to VMSecurityManager.getClassContext() (getSystemClassLoader): Likewise. * java/lang/Package.java (getPackage): Likewise. (getPackages): Likewise. * java/lang/SecurityManager.java (getClassContext): Likewise. (currentClassLoader): Likewise. * java/lang/VMSecurityManager.java: (getClassContext): Likewise. (currentClassLoader) Add new arg: caller. Pass caller to VMSecurityManager.getClassContext. * stacktrace.cc (GetClassContext): Correct calculation of jframe_count. * boehm.cc (_Jv_MarkObj): (_Jv_MarkObj): Mark im->source_file_name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96803 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/ChangeLog22
-rw-r--r--libjava/boehm.cc3
-rw-r--r--libjava/java/lang/ClassLoader.java4
-rw-r--r--libjava/java/lang/Package.java4
-rw-r--r--libjava/java/lang/SecurityManager.java4
-rw-r--r--libjava/java/lang/VMSecurityManager.java6
-rw-r--r--libjava/java/lang/natVMSecurityManager.cc4
-rw-r--r--libjava/stacktrace.cc20
8 files changed, 45 insertions, 22 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index b156e0ce28d..44447d43c68 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,25 @@
+2005-03-17 Andrew Haley <aph@redhat.com>
+
+ * java/lang/natVMSecurityManager.cc (getClassContext): Add new
+ arg: klass.
+ Pass klass to _Jv_StackTrace::GetClassContext().
+ * java/lang/ClassLoader.java (getParent): Pass class to
+ VMSecurityManager.getClassContext()
+ (getSystemClassLoader): Likewise.
+ * java/lang/Package.java (getPackage): Likewise.
+ (getPackages): Likewise.
+ * java/lang/SecurityManager.java (getClassContext): Likewise.
+ (currentClassLoader): Likewise.
+ * java/lang/VMSecurityManager.java: (getClassContext): Likewise.
+ (currentClassLoader) Add new arg: caller.
+ Pass caller to VMSecurityManager.getClassContext.
+
+ * stacktrace.cc (GetClassContext): Correct calculation of
+ jframe_count.
+
+ * boehm.cc (_Jv_MarkObj): (_Jv_MarkObj): Mark
+ im->source_file_name.
+
2005-03-16 Andrew Haley <aph@redhat.com>
* boehm.cc (_Jv_MarkObj): Mark the interpreted method line_table.
diff --git a/libjava/boehm.cc b/libjava/boehm.cc
index 45b94731d15..2e64b1ca6cc 100644
--- a/libjava/boehm.cc
+++ b/libjava/boehm.cc
@@ -248,6 +248,9 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void *env)
p = (GC_PTR) ic->interpreted_methods;
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic);
+ p = (GC_PTR) ic->source_file_name;
+ MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic);
+
for (int i = 0; i < c->method_count; i++)
{
// The interpreter installs a heap-allocated trampoline
diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java
index 2621281273f..f2beaac97f6 100644
--- a/libjava/java/lang/ClassLoader.java
+++ b/libjava/java/lang/ClassLoader.java
@@ -486,7 +486,7 @@ public abstract class ClassLoader
SecurityManager sm = System.getSecurityManager();
if (sm != null)
{
- Class c = VMSecurityManager.getClassContext()[1];
+ Class c = VMSecurityManager.getClassContext(ClassLoader.class)[1];
ClassLoader cl = c.getClassLoader();
if (cl != null && ! cl.isAncestorOf(this))
sm.checkPermission(new RuntimePermission("getClassLoader"));
@@ -729,7 +729,7 @@ public abstract class ClassLoader
SecurityManager sm = System.getSecurityManager();
if (sm != null)
{
- Class c = VMSecurityManager.getClassContext()[1];
+ Class c = VMSecurityManager.getClassContext(ClassLoader.class)[1];
ClassLoader cl = c.getClassLoader();
if (cl != null && cl != systemClassLoader)
sm.checkPermission(new RuntimePermission("getClassLoader"));
diff --git a/libjava/java/lang/Package.java b/libjava/java/lang/Package.java
index 29b42b63cf1..bddb370f1e7 100644
--- a/libjava/java/lang/Package.java
+++ b/libjava/java/lang/Package.java
@@ -273,7 +273,7 @@ public class Package
public static Package getPackage(String name)
{
// Get the caller's classloader
- ClassLoader cl = VMSecurityManager.currentClassLoader();
+ ClassLoader cl = VMSecurityManager.currentClassLoader(Package.class);
return cl != null ? cl.getPackage(name) : VMClassLoader.getPackage(name);
}
@@ -286,7 +286,7 @@ public class Package
public static Package[] getPackages()
{
// Get the caller's classloader
- Class c = VMSecurityManager.getClassContext()[1];
+ Class c = VMSecurityManager.getClassContext(Package.class)[1];
ClassLoader cl = c.getClassLoader();
return cl != null ? cl.getPackages() : VMClassLoader.getPackages();
}
diff --git a/libjava/java/lang/SecurityManager.java b/libjava/java/lang/SecurityManager.java
index c9ed4be0b3f..350439e0c3d 100644
--- a/libjava/java/lang/SecurityManager.java
+++ b/libjava/java/lang/SecurityManager.java
@@ -167,7 +167,7 @@ public class SecurityManager
*/
protected Class[] getClassContext()
{
- return VMSecurityManager.getClassContext();
+ return VMSecurityManager.getClassContext(SecurityManager.class);
}
/**
@@ -189,7 +189,7 @@ public class SecurityManager
*/
protected ClassLoader currentClassLoader()
{
- return VMSecurityManager.currentClassLoader();
+ return VMSecurityManager.currentClassLoader(SecurityManager.class);
}
/**
diff --git a/libjava/java/lang/VMSecurityManager.java b/libjava/java/lang/VMSecurityManager.java
index 604f8ecb428..f995ec89cf4 100644
--- a/libjava/java/lang/VMSecurityManager.java
+++ b/libjava/java/lang/VMSecurityManager.java
@@ -43,19 +43,19 @@ class VMSecurityManager
** @return an array containing all the methods on classes
** on the Java execution stack.
**/
- static native Class[] getClassContext();
+ static native Class[] getClassContext(Class caller);
/** Get the current ClassLoader--the one nearest to the
** top of the stack.
** @return the current ClassLoader.
**/
- static ClassLoader currentClassLoader()
+ static ClassLoader currentClassLoader(Class caller)
{
// The docs above are wrong. See the online docs.
// FIXME this implementation is a bit wrong too -- the docs say we
// must also consider ancestors of the system class loader.
ClassLoader systemClassLoader = VMClassLoader.getSystemClassLoader();
- Class[] classStack = getClassContext ();
+ Class[] classStack = getClassContext (caller);
for (int i = 0; i < classStack.length; i++)
{
ClassLoader loader = classStack[i].getClassLoader();
diff --git a/libjava/java/lang/natVMSecurityManager.cc b/libjava/java/lang/natVMSecurityManager.cc
index d55b7a54c3a..9d52c92c7c5 100644
--- a/libjava/java/lang/natVMSecurityManager.cc
+++ b/libjava/java/lang/natVMSecurityManager.cc
@@ -20,10 +20,10 @@ details. */
#include <java/lang/Class.h>
JArray<jclass> *
-java::lang::VMSecurityManager::getClassContext ()
+java::lang::VMSecurityManager::getClassContext (jclass klass)
{
JArray<jclass> *result =
- _Jv_StackTrace::GetClassContext (&SecurityManager::class$);
+ _Jv_StackTrace::GetClassContext (klass);
return result;
}
diff --git a/libjava/stacktrace.cc b/libjava/stacktrace.cc
index 6484dc6008d..583b11a796c 100644
--- a/libjava/stacktrace.cc
+++ b/libjava/stacktrace.cc
@@ -464,19 +464,17 @@ _Jv_StackTrace::GetClassContext (jclass checkClass)
_Jv_StackFrame *frame = &state.frames[i];
FillInFrameInfo (frame);
- if (seen_checkClass
- && frame->klass
- && frame->klass != checkClass)
+ if (seen_checkClass)
{
- jframe_count++;
- if (start_pos == -1)
- start_pos = i;
+ if (frame->klass)
+ {
+ jframe_count++;
+ if (start_pos == -1)
+ start_pos = i;
+ }
}
-
- if (!seen_checkClass
- && frame->klass
- && frame->klass == checkClass)
- seen_checkClass = true;
+ else
+ seen_checkClass = frame->klass == checkClass;
}
result = (JArray<jclass> *) _Jv_NewObjectArray (jframe_count, &Class::class$, NULL);
int pos = 0;