* libgcj.ver: Add __gcj_personality_sj0.
* testsuite/libjava.jvmti/jvmti-interp.exp: Likewise.
* testsuite/libjava.jni/jni.exp: Use -fdollars-in-identifiers.
* testsuite/libjava.jni/cni.exp: Use -fdollars-in-identifiers.
* testsuite/libjava.jvmti/jvmti.exp (gcj_jvmti_compile_cxx_to_o): Likewise.
* gnu/classpath/natVMStackWalker.cc (getCallingClassLoader): Check
klass is non-null.
* java/lang/reflect/natField.cc (getAddr): Call
_Jv_StackTrace::GetCallingClass only if CALLER is non-null.
* java/lang/reflect/natVMProxy.cc (run_proxy): Use
_Jv_getFieldInternal to get field proxyClass.m.
(_Jv_getFieldInternal): New function.
2007-07-11 Andrew Haley <aph@redhat.com>
* configure.host (arm*-linux-gnu): New.
* sysdep/arm/locks.h: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126622
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-07-13 Andrew Haley <aph@redhat.com>
+
+ * libgcj.ver: Add __gcj_personality_sj0.
+
+ * testsuite/libjava.jvmti/jvmti-interp.exp: Likewise.
+ * testsuite/libjava.jni/jni.exp: Use -fdollars-in-identifiers.
+ * testsuite/libjava.jni/cni.exp: Use -fdollars-in-identifiers.
+ * testsuite/libjava.jvmti/jvmti.exp (gcj_jvmti_compile_cxx_to_o): Likewise.
+
+ * gnu/classpath/natVMStackWalker.cc (getCallingClassLoader): Check
+ klass is non-null.
+ * java/lang/reflect/natField.cc (getAddr): Call
+ _Jv_StackTrace::GetCallingClass only if CALLER is non-null.
+ * java/lang/reflect/natVMProxy.cc (run_proxy): Use
+ _Jv_getFieldInternal to get field proxyClass.m.
+ (_Jv_getFieldInternal): New function.
+
+2007-07-11 Andrew Haley <aph@redhat.com>
+
+ * configure.host (arm*-linux-gnu): New.
+ * sysdep/arm/locks.h: New.
+
2007-07-13 Roger Sayle <roger@eyesopen.com>
* java/lang/natPosixProcess.cc: Include <sys/time.h> before
enable_getenv_properties_default=no
enable_main_args_default=no
;;
+ arm*-linux-gnu)
+ libgcj_interpreter=yes
+ sysdeps_dir=arm
+ ;;
mips-tx39-*|mipstx39-unknown-*)
libgcj_flags="${libgcj_flags} -G 0"
LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
gnu::classpath::VMStackWalker::getCallingClassLoader(void)
{
_Jv_InitClass (&::gnu::classpath::VMStackWalker::class$);
- return
- _Jv_StackTrace::GetStackWalkerCallingClass ()->getClassLoaderInternal ();
+ jclass klass = _Jv_StackTrace::GetStackWalkerCallingClass ();
+ if (klass)
+ return klass->getClassLoaderInternal ();
+ else
+ return NULL;
}
::java::lang::ClassLoader *
gnu::classpath::VMStackWalker::getCallingClassLoader(::gnu::gcj::RawData *pc)
{
_Jv_InitClass (&::gnu::classpath::VMStackWalker::class$);
- return GET_CALLING_CLASS(pc)->getClassLoaderInternal ();
+ jclass klass = GET_CALLING_CLASS(pc);
+ if (klass)
+ return klass->getClassLoaderInternal ();
+ else
+ return NULL;
}
::java::lang::ClassLoader *
class java/lang/reflect/Field
prepend jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *);
prepend jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv*, jclass, jfieldID, jboolean);
+prepend jobject _Jv_getFieldInternal (java::lang::reflect::Field f, jclass c, jobject o);
friend jfieldID (::_Jv_FromReflectedField) (java::lang::reflect::Field *);
friend jobject (::_Jv_JNI_ToReflectedField) (_Jv_JNIEnv*, jclass, jfieldID, jboolean);
friend class java::lang::Class;
+friend jobject (::_Jv_getFieldInternal) (java::lang::reflect::Field f, jclass c, jobject o);
class java/lang/reflect/Method
prepend jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);
jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *);
jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv*, jclass, jfieldID, jboolean);
+jobject _Jv_getFieldInternal (java::lang::reflect::Field *f, jclass c, jobject o);
class java::lang::reflect::Field : public ::java::lang::reflect::AccessibleObject
{
friend jfieldID (::_Jv_FromReflectedField) (java::lang::reflect::Field *);
friend jobject (::_Jv_JNI_ToReflectedField) (_Jv_JNIEnv*, jclass, jfieldID, jboolean);
friend class java::lang::Class;
+ friend jobject (::_Jv_getFieldInternal) (java::lang::reflect::Field *f, jclass c, jobject o);
};
#endif // __java_lang_reflect_Field__
getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj,
jboolean checkFinal)
{
- // FIXME: we know CALLER is NULL here. At one point we planned to
- // have the compiler insert the caller as a hidden argument in some
- // calls. However, we never implemented that, so we have to find
- // the caller by hand instead.
-
using namespace java::lang::reflect;
jfieldID fld = _Jv_FromReflectedField (field);
// Check accessibility, if required.
if (! (Modifier::isPublic (flags) || field->isAccessible()))
{
- caller = _Jv_StackTrace::GetCallingClass (&Field::class$);
+ if (! caller)
+ caller = _Jv_StackTrace::GetCallingClass (&Field::class$);
if (! _Jv_CheckAccess (caller, field->getDeclaringClass(), flags))
throw new java::lang::IllegalAccessException;
}
JvFail ("Bad ffi type in proxy");
}
+// _Jv_getFieldInternal is declared as a friend of reflect.Field in
+// libjava/headers.txt. This gives us a way to call the private
+// method Field.get (Class caller, Object obj).
+extern inline jobject
+_Jv_getFieldInternal (java::lang::reflect::Field *f, jclass c, jobject o)
+{
+ return f->get(c, o);
+}
+
// run_proxy is the entry point for all proxy methods. It boxes up
// all the arguments and then invokes the invocation handler's invoke()
// method. Exceptions are caught and propagated.
// difference. We'd still have to save the method array because
// ncode structs are not scanned by the gc.
Field *f = proxyClass->getDeclaredField (JvNewStringLatin1 ("m"));
- JArray<Method*> *methods = (JArray<Method*>*)f->get (NULL);
+ JArray<Method*> *methods
+ = (JArray<Method*>*)_Jv_getFieldInternal (f, proxyClass, NULL);
Method *meth = elements(methods)[self->method_index];
JArray<jclass> *parameter_types = meth->internalGetParameterTypes ();
# symbols in libgcj.so.
{
- global: Jv*; _Jv_*; __gcj_personality_v0; _Z*;
+ global: Jv*; _Jv_*; __gcj_personality_v0; __gcj_personality_sj0; _Z*;
local: *;
};
--- /dev/null
+// locks.h - Thread synchronization primitives. ARM implementation.
+
+/* Copyright (C) 2007 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. */
+
+#ifndef __SYSDEP_LOCKS_H__
+#define __SYSDEP_LOCKS_H__
+
+typedef size_t obj_addr_t; /* Integer type big enough for object */
+ /* address. */
+
+/* Atomic compare and exchange. These sequences are not actually
+ atomic; there is a race if *ADDR != OLD_VAL and we are preempted
+ between the two swaps. However, they are very close to atomic, and
+ are the best that a pre-ARMv6 implementation can do without
+ operating system support. LinuxThreads has been using these
+ sequences for many years. */
+
+inline static bool
+compare_and_swap(volatile obj_addr_t *addr,
+ obj_addr_t old_val,
+ obj_addr_t new_val)
+{
+ volatile obj_addr_t result, tmp;
+ __asm__ ("\n"
+ "0: ldr %[tmp],[%[addr]]\n"
+ " cmp %[tmp],%[old_val]\n"
+ " movne %[result],#0\n"
+ " bne 1f\n"
+ " swp %[result],%[new_val],[%[addr]]\n"
+ " cmp %[tmp],%[result]\n"
+ " swpne %[tmp],%[result],[%[addr]]\n"
+ " bne 0b\n"
+ " mov %[result],#1\n"
+ "1:"
+ : [result] "=&r" (result), [tmp] "=&r" (tmp)
+ : [addr] "r" (addr), [new_val] "r" (new_val), [old_val] "r" (old_val)
+ : "cc", "memory");
+
+ return result;
+}
+
+inline static void
+release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
+{
+ __asm__ __volatile__("" : : : "memory");
+ *(addr) = new_val;
+}
+
+inline static bool
+compare_and_swap_release(volatile obj_addr_t *addr,
+ obj_addr_t old,
+ obj_addr_t new_val)
+{
+ return compare_and_swap(addr, old, new_val);
+}
+
+// Ensure that subsequent instructions do not execute on stale
+// data that was loaded from memory before the barrier.
+inline static void
+read_barrier()
+{
+ __asm__ __volatile__("" : : : "memory");
+}
+
+// Ensure that prior stores to memory are completed with respect to other
+// processors.
+inline static void
+write_barrier()
+{
+ __asm__ __volatile__("" : : : "memory");
+}
+
+#endif
set oname ${name}.o
# Find the generated header.
- lappend options "additional_flags=-I. -I.. -I$srcdir/$subdir"
+ lappend options "additional_flags=-I. -I.. -I$srcdir/$subdir -fdollars-in-identifiers"
# Find libgcj headers.
lappend options "additional_flags=-I$srcdir/.."
lappend options "additional_flags=${so_flag} -fPIC"
# Find the generated header.
- lappend options "additional_flags=-I. -I.. -I$srcdir/$subdir"
+ lappend options "additional_flags=-I. -I.. -I$srcdir/$subdir -fdollars-in-identifiers"
# Ensure that the generated header has correct prototypes.
set cfile [file rootname $file].c
lappend options "additional_flags=-I. -I.. -I$srcdir/$subdir"
# Find jni.h and jni_md.h.
- lappend options "additional_flags=-I$srcdir/../include -I$srcdir/../classpath/include"
+ lappend options "additional_flags=-I$srcdir/../include -I$srcdir/../classpath/include -fdollars-in-identifiers"
# Append C++ options
lappend options "additional_flags=$options_cxx"
# Find jni.h and jni_md.h.
lappend options "additional_flags=-I$srcdir/../include \
- -I$srcdir/../classpath/include"
+ -I$srcdir/../classpath/include -fdollars-in-identifiers"
# Append C++ options
lappend options "additional_flags=$options_cxx"
set oname ${name}.o
# Find the generated header.
- lappend options "additional_flags=-g -I. -I.."
+ lappend options "additional_flags=-g -I. -I.. -fdollars-in-identifiers"
# Find libgcj headers.
lappend options "additional_flags=-I$srcdir/.."
# Find jvmti.h, jvmti_md.h, jvmti-int.h, jvm.h requirements
- lappend options "additional_flags=-I$srcdir/../include -I$srcdir/../classpath/include -I$objdir/../include -I$objdir/../../boehm-gc/include"
+ lappend options "additional_flags=-I$srcdir/../include -I$srcdir/../classpath/include -I$objdir/../include -I$objdir/../../boehm-gc/include "
set x [libjava_prune_warnings \
[target_compile $file $oname object $options]]