This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ecj] Implement java.util.concurrent support


A few minor changes.  util.concurrent didn't properly check field
access, because sun.reflect.Reflection.getCallerClass(int) was
disabled.  This enables it.

Also, a few checks had been disabled in the various FieldUpdater
classes.  This patch restores them.

Andrew.


2006-09-13  Andrew Haley  <aph@redhat.com>

	* Makefile.am: Add sun/reflect/natReflection.cc.
	* Makefile.in: Rebuild.
	* sun/reflect/natReflection.cc: New file.
	* sun/reflect/Reflection.java (getCallerClass): Now native.
	* stacktrace.cc (GetClassContext): Don't check the class if
	checkClass is NULL.
	
2006-09-13  Andrew Haley  <aph@redhat.com>

	* external/jsr166/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java:
	Revert previous gcj-specific disabling of checks.
	* external/jsr166/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java:
	Likewise.
	* classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java:
	Likewise.

Index: stacktrace.cc
===================================================================
--- stacktrace.cc	(revision 116678)
+++ stacktrace.cc	(working copy)
@@ -464,7 +464,7 @@
 
   // Count the number of Java frames on the stack.
   int jframe_count = 0;
-  bool seen_checkClass = false;
+  bool seen_checkClass = checkClass == NULL;
   int start_pos = -1;
   for (int i = 0; i < state.pos; i++)
     {
Index: sun/reflect/Reflection.java
===================================================================
--- sun/reflect/Reflection.java	(revision 116678)
+++ sun/reflect/Reflection.java	(working copy)
@@ -45,10 +45,6 @@
   /**
    * A stack-walking wrapper method used by the JSR 166 RI. 
    */
-  public static Class getCallerClass(int depth)
-  {
-    // GCJ LOCAL - We don't have VMStackWalker yet.
-    // return VMStackWalker.getClassContext()[depth];
-    return null;
-  }
+  public static native Class getCallerClass(int depth);
 }
+
Index: sun/reflect/natReflection.cc
===================================================================
--- sun/reflect/natReflection.cc	(revision 0)
+++ sun/reflect/natReflection.cc	(revision 0)
@@ -0,0 +1,28 @@
+// natReflection.cc
+
+/* Copyright (C) 2006
+   Free Software Foundation
+
+   This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
+details.  */
+
+#include <sun/reflect/Reflection.h>
+#include <java/lang/Thread.h>
+
+#include <java-interp.h>
+#include <java-stack.h>
+#include <execution.h>
+
+jclass
+sun::reflect::Reflection::getCallerClass (jint n)
+{
+  // FIXME: grossly inefficient.  What we really need is
+  // _Jv_StackTrace::GetCallerClass(int), so we don't end up tracing
+  // the entire stack.
+
+  JArray<jclass> *result = _Jv_StackTrace::GetClassContext (NULL);
+  return elements (result)[n-1];
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]