accessFlags.cpp revision 2796
98N/A/*
943N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
98N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
98N/A *
919N/A * This code is free software; you can redistribute it and/or modify it
919N/A * under the terms of the GNU General Public License version 2 only, as
919N/A * published by the Free Software Foundation.
919N/A *
919N/A * This code is distributed in the hope that it will be useful, but WITHOUT
919N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
919N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
919N/A * version 2 for more details (a copy is included in the LICENSE file that
919N/A * accompanied this code).
919N/A *
919N/A * You should have received a copy of the GNU General Public License version
919N/A * 2 along with this work; if not, write to the Free Software Foundation,
919N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
919N/A *
919N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
919N/A * or visit www.oracle.com if you need additional information or have any
919N/A * questions.
98N/A *
98N/A */
98N/A
98N/A#include "precompiled.hpp"
493N/A#include "oops/oop.inline.hpp"
98N/A#include "utilities/accessFlags.hpp"
970N/A#ifdef TARGET_OS_FAMILY_linux
970N/A# include "os_linux.inline.hpp"
970N/A#endif
970N/A#ifdef TARGET_OS_FAMILY_solaris
970N/A# include "os_solaris.inline.hpp"
98N/A#endif
814N/A#ifdef TARGET_OS_FAMILY_windows
98N/A# include "os_windows.inline.hpp"
911N/A#endif
911N/A#ifdef TARGET_OS_FAMILY_bsd
911N/A# include "os_bsd.inline.hpp"
911N/A#endif
98N/A
98N/A
98N/Avoid AccessFlags::atomic_set_bits(jint bits) {
98N/A // Atomically update the flags with the bits given
98N/A jint old_flags, new_flags, f;
156N/A do {
493N/A old_flags = _flags;
493N/A new_flags = old_flags | bits;
98N/A f = Atomic::cmpxchg(new_flags, &_flags, old_flags);
98N/A } while(f != old_flags);
705N/A}
705N/A
720N/Avoid AccessFlags::atomic_clear_bits(jint bits) {
720N/A // Atomically update the flags with the bits given
98N/A jint old_flags, new_flags, f;
606N/A do {
606N/A old_flags = _flags;
606N/A new_flags = old_flags & ~bits;
493N/A f = Atomic::cmpxchg(new_flags, &_flags, old_flags);
493N/A } while(f != old_flags);
493N/A}
493N/A
98N/A#ifndef PRODUCT
493N/A
705N/Avoid AccessFlags::print_on(outputStream* st) const {
98N/A if (is_public ()) st->print("public " );
98N/A if (is_private ()) st->print("private " );
493N/A if (is_protected ()) st->print("protected " );
98N/A if (is_static ()) st->print("static " );
493N/A if (is_final ()) st->print("final " );
if (is_synchronized()) st->print("synchronized ");
if (is_volatile ()) st->print("volatile " );
if (is_transient ()) st->print("transient " );
if (is_native ()) st->print("native " );
if (is_interface ()) st->print("interface " );
if (is_abstract ()) st->print("abstract " );
if (is_strict ()) st->print("strict " );
if (is_synthetic ()) st->print("synthetic " );
if (is_old ()) st->print("{old} " );
if (is_obsolete ()) st->print("{obsolete} " );
}
#endif
void accessFlags_init() {
assert(sizeof(AccessFlags) == sizeof(jint), "just checking size of flags");
}