Path: blob/master/src/hotspot/share/ci/ciFlags.hpp
40930 views
/*1* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_CI_CIFLAGS_HPP25#define SHARE_CI_CIFLAGS_HPP2627#include "jvm_constants.h"28#include "ci/ciClassList.hpp"29#include "utilities/accessFlags.hpp"30#include "utilities/ostream.hpp"3132// ciFlags33//34// This class represents klass or method flags.35class ciFlags {36private:37friend class ciInstanceKlass;38friend class ciField;39friend class ciMethod;4041jint _flags;4243ciFlags() { _flags = 0; }44ciFlags(AccessFlags flags) { _flags = flags.as_int(); }4546public:47// Java access flags48bool is_public () const { return (_flags & JVM_ACC_PUBLIC ) != 0; }49bool is_private () const { return (_flags & JVM_ACC_PRIVATE ) != 0; }50bool is_protected () const { return (_flags & JVM_ACC_PROTECTED ) != 0; }51bool is_static () const { return (_flags & JVM_ACC_STATIC ) != 0; }52bool is_final () const { return (_flags & JVM_ACC_FINAL ) != 0; }53bool is_synchronized () const { return (_flags & JVM_ACC_SYNCHRONIZED ) != 0; }54bool is_super () const { return (_flags & JVM_ACC_SUPER ) != 0; }55bool is_volatile () const { return (_flags & JVM_ACC_VOLATILE ) != 0; }56bool is_transient () const { return (_flags & JVM_ACC_TRANSIENT ) != 0; }57bool is_native () const { return (_flags & JVM_ACC_NATIVE ) != 0; }58bool is_interface () const { return (_flags & JVM_ACC_INTERFACE ) != 0; }59bool is_abstract () const { return (_flags & JVM_ACC_ABSTRACT ) != 0; }60bool is_stable () const { return (_flags & JVM_ACC_FIELD_STABLE ) != 0; }61// In case the current object represents a field, return true if62// the field is modified outside of instance initializer methods63// (or class/initializer methods if the field is static) and false64// otherwise.65bool has_initialized_final_update() const { return (_flags & JVM_ACC_FIELD_INITIALIZED_FINAL_UPDATE) != 0; };6667// Conversion68jint as_int() { return _flags; }6970void print_klass_flags(outputStream* st = tty);71void print_member_flags(outputStream* st = tty);72void print(outputStream* st = tty);73};7475#endif // SHARE_CI_CIFLAGS_HPP767778