aoqi@0: /* aoqi@0: * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #ifndef SHARE_VM_CI_CIFLAGS_HPP aoqi@0: #define SHARE_VM_CI_CIFLAGS_HPP aoqi@0: aoqi@0: #include "ci/ciClassList.hpp" aoqi@0: #include "memory/allocation.hpp" aoqi@0: #include "prims/jvm.h" aoqi@0: #include "utilities/accessFlags.hpp" aoqi@0: aoqi@0: // ciFlags aoqi@0: // aoqi@0: // This class represents klass or method flags. aoqi@0: class ciFlags VALUE_OBJ_CLASS_SPEC { aoqi@0: private: aoqi@0: friend class ciInstanceKlass; aoqi@0: friend class ciField; aoqi@0: friend class ciMethod; aoqi@0: aoqi@0: jint _flags; aoqi@0: aoqi@0: ciFlags() { _flags = 0; } aoqi@0: ciFlags(AccessFlags flags) { _flags = flags.as_int(); } aoqi@0: aoqi@0: public: aoqi@0: // Java access flags zmajo@8664: bool is_public () const { return (_flags & JVM_ACC_PUBLIC ) != 0; } zmajo@8664: bool is_private () const { return (_flags & JVM_ACC_PRIVATE ) != 0; } zmajo@8664: bool is_protected () const { return (_flags & JVM_ACC_PROTECTED ) != 0; } zmajo@8664: bool is_static () const { return (_flags & JVM_ACC_STATIC ) != 0; } zmajo@8664: bool is_final () const { return (_flags & JVM_ACC_FINAL ) != 0; } zmajo@8664: bool is_synchronized () const { return (_flags & JVM_ACC_SYNCHRONIZED ) != 0; } zmajo@8664: bool is_super () const { return (_flags & JVM_ACC_SUPER ) != 0; } zmajo@8664: bool is_volatile () const { return (_flags & JVM_ACC_VOLATILE ) != 0; } zmajo@8664: bool is_transient () const { return (_flags & JVM_ACC_TRANSIENT ) != 0; } zmajo@8664: bool is_native () const { return (_flags & JVM_ACC_NATIVE ) != 0; } zmajo@8664: bool is_interface () const { return (_flags & JVM_ACC_INTERFACE ) != 0; } zmajo@8664: bool is_abstract () const { return (_flags & JVM_ACC_ABSTRACT ) != 0; } zmajo@8664: bool is_strict () const { return (_flags & JVM_ACC_STRICT ) != 0; } zmajo@8664: bool is_stable () const { return (_flags & JVM_ACC_FIELD_STABLE ) != 0; } zmajo@8664: // In case the current object represents a field, return true if zmajo@8664: // the field is modified outside of instance initializer methods zmajo@8664: // (or class/initializer methods if the field is static) and false zmajo@8664: // otherwise. zmajo@8664: bool has_initialized_final_update() const { return (_flags & JVM_ACC_FIELD_INITIALIZED_FINAL_UPDATE) != 0; }; aoqi@0: aoqi@0: // Conversion aoqi@0: jint as_int() { return _flags; } aoqi@0: aoqi@0: void print_klass_flags(outputStream* st = tty); aoqi@0: void print_member_flags(outputStream* st = tty); aoqi@0: void print(outputStream* st = tty); aoqi@0: }; aoqi@0: aoqi@0: #endif // SHARE_VM_CI_CIFLAGS_HPP