1 /*
2 * Copyright (c) 1999, 2025, 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 #include "ci/ciFlags.hpp"
26
27 // ciFlags
28 //
29 // This class represents klass or method flags
30
31 // ------------------------------------------------------------------
32 // ciFlags::print_klass_flags
33 void ciFlags::print_klass_flags(outputStream* st) {
34 if (is_public()) {
35 st->print("public");
36 } else {
37 st->print("DEFAULT_ACCESS");
38 }
39
40 if (is_final()) {
41 st->print(",final");
42 }
43 if (is_super()) {
44 st->print(",super");
45 }
46 if (is_interface()) {
47 st->print(",interface");
48 }
49 if (is_abstract()) {
50 st->print(",abstract");
51 }
52 }
53
54 // ------------------------------------------------------------------
55 // ciFlags::print_member_flags
56 void ciFlags::print_member_flags(outputStream* st) {
57 if (is_public()) {
58 st->print("public");
59 } else if (is_private()) {
60 st->print("private");
61 } else if (is_protected()) {
62 st->print("protected");
63 } else {
64 st->print("DEFAULT_ACCESS");
65 }
66
67 if (is_static()) {
68 st->print(",static");
69 }
70 if (is_final()) {
71 st->print(",final");
72 }
73 if (is_synchronized()) {
74 st->print(",synchronized");
75 }
76 if (is_volatile()) {
77 st->print(",volatile");
78 }
79 if (is_transient()) {
80 st->print(",transient");
81 }
82 if (is_native()) {
83 st->print(",native");
84 }
85 if (is_abstract()) {
86 st->print(",abstract");
87 }
88
89 }
90
91 // ------------------------------------------------------------------
92 // ciFlags::print
93 void ciFlags::print(outputStream* st) {
94 st->print(" flags=%x", _flags.as_unsigned_short());
95 }