[Bug 92] threading is broken (most visible on SMP)

[email protected]
Newsgroups gmane.comp.java.vm.sablevm.bugs
Message-ID <[email protected]>
http://sablevm.org/bugs/show_bug.cgi?id=92





------- Additional Comments From [email protected]  2005-01-29 01:10 -------
Interesting!  You found a bug.

This should probably look like (note: no SMP support here):

          /* notify owning thread that inflation is requested */
          _svmm_mutex_lock (owner->contention.owner.mutex);

          old_flag = owner->contention.owner.flag;

          owner->contention.owner.flag = 1;

/** MODIFICATION HERE **/
          /* re-read the instance's lockword, now that the thread
             has been notified */
          old_lockword = instance->lockword;
          
          if (_svmf_lockword_is_thin (old_lockword) &&
              _svmf_lockword_get_thinlock_id (old_lockword) ==
              owner->thread.thinlock_id)
/** END OF MODIFICATION **/
            {
              /* the thinlock owner is still the same and has been notified */

              notified = JNI_TRUE;

              /* add this thread into the lock owner's wait_list */
              env->contention.requester.wait_list_next =
                owner->contention.owner.wait_list;
              owner->contention.owner.wait_list = env;

              *(env->contention.requester.jobject) = instance;
            }
          else
            {
/** MODIFICATION HERE **/
              /* either the owner has changed or the lock is not thin anymore,
                 so restore the contention flag to its original value */
/** END OF MODIFICATION **/

              notified = JNI_FALSE;

              owner->contention.owner.flag = old_flag;
            }

          _svmm_mutex_unlock ();


I guess all of the code of monitor_enter/exit should be audited to find other
similar errors, if any.




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are the QA contact for the bug, or are watching the QA contact.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.