src/hotspot/share/runtime/thread.inline.hpp
changeset 48983 df25d1a5d78a
parent 48955 e22914003cf0
child 49480 d7df2dd501ce
equal deleted inserted replaced
48948:514c88e62cd8 48983:df25d1a5d78a
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    28 #include "runtime/atomic.hpp"
    28 #include "runtime/atomic.hpp"
    29 #include "runtime/os.inline.hpp"
    29 #include "runtime/os.inline.hpp"
    30 #include "runtime/thread.hpp"
    30 #include "runtime/thread.hpp"
    31 
    31 
    32 inline void Thread::set_suspend_flag(SuspendFlags f) {
    32 inline void Thread::set_suspend_flag(SuspendFlags f) {
    33   assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
       
    34   uint32_t flags;
    33   uint32_t flags;
    35   do {
    34   do {
    36     flags = _suspend_flags;
    35     flags = _suspend_flags;
    37   }
    36   }
    38   while (Atomic::cmpxchg((jint)(flags | f),
    37   while (Atomic::cmpxchg((flags | f), &_suspend_flags, flags) != flags);
    39                          (volatile jint*)&_suspend_flags,
       
    40                          (jint)flags) != (jint)flags);
       
    41 }
    38 }
    42 inline void Thread::clear_suspend_flag(SuspendFlags f) {
    39 inline void Thread::clear_suspend_flag(SuspendFlags f) {
    43   assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
       
    44   uint32_t flags;
    40   uint32_t flags;
    45   do {
    41   do {
    46     flags = _suspend_flags;
    42     flags = _suspend_flags;
    47   }
    43   }
    48   while (Atomic::cmpxchg((jint)(flags & ~f),
    44   while (Atomic::cmpxchg((flags & ~f), &_suspend_flags, flags) != flags);
    49                          (volatile jint*)&_suspend_flags,
       
    50                          (jint)flags) != (jint)flags);
       
    51 }
    45 }
    52 
    46 
    53 inline void Thread::set_has_async_exception() {
    47 inline void Thread::set_has_async_exception() {
    54   set_suspend_flag(_has_async_exception);
    48   set_suspend_flag(_has_async_exception);
    55 }
    49 }