1 /* 2 * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_OOPS_CONSTMETHODFLAGS_HPP 26 #define SHARE_OOPS_CONSTMETHODFLAGS_HPP 27 28 #include "utilities/globalDefinitions.hpp" 29 #include "utilities/macros.hpp" 30 31 class outputStream; 32 33 // The ConstMethodFlags class contains the parse-time flags associated with 34 // a Method, and its associated accessors. 35 // These flags are JVM internal and not part of the AccessFlags classfile specification. 36 37 class ConstMethodFlags { 38 friend class VMStructs; 39 friend class JVMCIVMStructs; 40 41 #define CM_FLAGS_DO(flag) \ 42 flag(has_linenumber_table , 1 << 0) \ 43 flag(has_checked_exceptions , 1 << 1) \ 44 flag(has_localvariable_table , 1 << 2) \ 45 flag(has_exception_table , 1 << 3) \ 46 flag(has_generic_signature , 1 << 4) \ 47 flag(has_method_parameters , 1 << 5) \ 48 flag(is_overpass , 1 << 6) \ 49 flag(has_method_annotations , 1 << 7) \ 50 flag(has_parameter_annotations , 1 << 8) \ 51 flag(has_type_annotations , 1 << 9) \ 52 flag(has_default_annotations , 1 << 10) \ 53 flag(caller_sensitive , 1 << 11) \ 54 flag(is_hidden , 1 << 12) \ 55 flag(has_injected_profile , 1 << 13) \ 56 flag(intrinsic_candidate , 1 << 14) \ 57 flag(reserved_stack_access , 1 << 15) \ 58 flag(is_scoped , 1 << 16) \ 59 flag(changes_current_thread , 1 << 17) \ 60 flag(jvmti_mount_transition , 1 << 18) \ 61 flag(deprecated , 1 << 19) \ 62 flag(deprecated_for_removal , 1 << 20) \ 63 /* end of list */ 64 65 #define CM_FLAGS_ENUM_NAME(name, value) _misc_##name = value, 66 enum { 67 CM_FLAGS_DO(CM_FLAGS_ENUM_NAME) 68 }; 69 #undef CM_FLAGS_ENUM_NAME 70 71 // These flags are write-once before the class is published and then read-only so don't require atomic updates. 72 u4 _flags; 73 74 public: 75 76 ConstMethodFlags() : _flags(0) {} 77 78 // Create getters and setters for the flag values. 79 #define CM_FLAGS_GET_SET(name, ignore) \ 80 bool name() const { return (_flags & _misc_##name) != 0; } \ 81 void set_##name() { \ 82 _flags |= _misc_##name; \ 83 } 84 CM_FLAGS_DO(CM_FLAGS_GET_SET) 85 #undef CM_FLAGS_GET_SET 86 87 int as_int() const { return _flags; } 88 void print_on(outputStream* st) const; 89 }; 90 91 #endif // SHARE_OOPS_CONSTMETHODFLAGS_HPP