From f0580031a7919f8e1401db1c2e6515e1682eaaa7 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Tue, 23 Sep 2008 13:51:58 +0000 Subject: re PR libgcj/8995 (race cases in interpreter) 2008-09-17 Andrew Haley PR libgcj/8995: * defineclass.cc (_Jv_ClassReader::handleCodeAttribute): Initialize thread_count. * include/java-interp.h (_Jv_InterpMethod::thread_count): New field. (_Jv_InterpMethod::rewrite_insn_mutex): New mutex. (_Jv_InterpFrame:: _Jv_InterpFrame): Pass frame_type. * interpret.cc (ThreadCountAdjuster): New class. (_Jv_InterpMethod::thread_count): New field. (_Jv_InitInterpreter): Initialize rewrite_insn_mutex. Increment and decrement thread_count field in methods. * interpret-run.cc (REWRITE_INSN): Check thread_count <= 1. (REWRITE_INSN): Likewise. Declare a ThreadCountAdjuster. * java/lang/reflect/natVMProxy.cc (run_proxy): Initialize frame type as frame_proxy. From-SVN: r140593 --- libjava/interpret.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libjava/interpret.cc') diff --git a/libjava/interpret.cc b/libjava/interpret.cc index 6153c54..dc1114f 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -78,10 +78,15 @@ static void find_catch_location (jthrowable, jthread, jmethodID *, jlong *); // the Class monitor as user code in another thread could hold it. static _Jv_Mutex_t compile_mutex; +// See class ThreadCountAdjuster and REWRITE_INSN for how this is +// used. +_Jv_Mutex_t _Jv_InterpMethod::rewrite_insn_mutex; + void _Jv_InitInterpreter() { _Jv_MutexInit (&compile_mutex); + _Jv_MutexInit (&_Jv_InterpMethod::rewrite_insn_mutex); } #else void _Jv_InitInterpreter() {} -- cgit v1.1