summaryrefslogtreecommitdiff
path: root/libjava/jni.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-12 20:58:41 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-12 20:58:41 +0000
commit5cea051a4ae77392d14403081b3c66f88eefa98a (patch)
tree583afb8fe11597ee27d6684ffdba15b2342474b8 /libjava/jni.cc
parent165b785d9e3a0587b3a78b48730208231c64a7d6 (diff)
downloadgcc-5cea051a4ae77392d14403081b3c66f88eefa98a.tar.gz
* jni.cc (call): Synchronize if required.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47949 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r--libjava/jni.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc
index dbe1d1f4f29..1dd299f3aa9 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -2066,6 +2066,17 @@ _Jv_JNIMethod::call (ffi_cif *, void *ret, ffi_raw *args, void *__this)
if ((_this->self->accflags & java::lang::reflect::Modifier::STATIC))
real_args[offset++].ptr = _this->defining_class;
+ // In libgcj, the callee synchronizes.
+ jobject sync = NULL;
+ if ((_this->self->accflags & java::lang::reflect::Modifier::SYNCHRONIZED))
+ {
+ if ((_this->self->accflags & java::lang::reflect::Modifier::STATIC))
+ sync = _this->defining_class;
+ else
+ sync = (jobject) args[0].ptr;
+ _Jv_MonitorEnter (sync);
+ }
+
// Copy over passed-in arguments.
memcpy (&real_args[offset], args, _this->args_raw_size);
@@ -2073,6 +2084,9 @@ _Jv_JNIMethod::call (ffi_cif *, void *ret, ffi_raw *args, void *__this)
ffi_raw_call (&_this->jni_cif, (void (*)()) _this->function,
ret, real_args);
+ if (sync != NULL)
+ _Jv_MonitorExit (sync);
+
_Jv_JNI_PopSystemFrame (env);
}