src/share/vm/classfile/javaAssertions.hpp

Tue, 23 Nov 2010 13:22:55 -0800

author
stefank
date
Tue, 23 Nov 2010 13:22:55 -0800
changeset 2314
f95d63e2154a
parent 1907
c18cbe5936b8
child 3900
d2a62e0f25eb
permissions
-rw-r--r--

6989984: Use standard include model for Hospot
Summary: Replaced MakeDeps and the includeDB files with more standardized solutions.
Reviewed-by: coleenp, kvn, kamg

duke@435 1 /*
stefank@2314 2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_CLASSFILE_JAVAASSERTIONS_HPP
stefank@2314 26 #define SHARE_VM_CLASSFILE_JAVAASSERTIONS_HPP
stefank@2314 27
stefank@2314 28 #include "oops/objArrayOop.hpp"
stefank@2314 29 #include "oops/typeArrayOop.hpp"
stefank@2314 30 #include "utilities/exceptions.hpp"
stefank@2314 31 #include "utilities/ostream.hpp"
stefank@2314 32
duke@435 33 class JavaAssertions: AllStatic {
duke@435 34 public:
duke@435 35 static inline bool userClassDefault();
duke@435 36 static inline void setUserClassDefault(bool enabled);
duke@435 37 static inline bool systemClassDefault();
duke@435 38 static inline void setSystemClassDefault(bool enabled);
duke@435 39
duke@435 40 // Add a command-line option. A name ending in "..." applies to a package and
duke@435 41 // any subpackages; other names apply to a single class.
duke@435 42 static void addOption(const char* name, bool enable);
duke@435 43
duke@435 44 // Return true if command-line options have enabled assertions for the named
duke@435 45 // class. Should be called only after all command-line options have been
duke@435 46 // processed. Note: this only consults command-line options and does not
duke@435 47 // account for any dynamic changes to assertion status.
duke@435 48 static bool enabled(const char* classname, bool systemClass);
duke@435 49
duke@435 50 // Create an instance of java.lang.AssertionStatusDirectives and fill in the
duke@435 51 // fields based on the command-line assertion options.
duke@435 52 static oop createAssertionStatusDirectives(TRAPS);
duke@435 53
duke@435 54 private:
duke@435 55 class OptionList;
duke@435 56 static void fillJavaArrays(const OptionList* p, int len, objArrayHandle names,
duke@435 57 typeArrayHandle status, TRAPS);
duke@435 58
duke@435 59 static inline void trace(const char* name, const char* typefound,
duke@435 60 const char* namefound, bool enabled);
duke@435 61
duke@435 62 static inline OptionList* match_class(const char* classname);
duke@435 63 static OptionList* match_package(const char* classname);
duke@435 64
duke@435 65 static bool _userDefault; // User class default (-ea/-da).
duke@435 66 static bool _sysDefault; // System class default (-esa/-dsa).
duke@435 67 static OptionList* _classes; // Options for classes.
duke@435 68 static OptionList* _packages; // Options for package trees.
duke@435 69 };
duke@435 70
duke@435 71 class JavaAssertions::OptionList: public CHeapObj {
duke@435 72 public:
duke@435 73 inline OptionList(const char* name, bool enable, OptionList* next);
duke@435 74
duke@435 75 inline const char* name() const { return _name; }
duke@435 76 inline bool enabled() const { return _enabled; }
duke@435 77 inline OptionList* next() const { return _next; }
duke@435 78
duke@435 79 static int count(OptionList* p);
duke@435 80
duke@435 81 private:
duke@435 82 const char* _name;
duke@435 83 OptionList* _next;
duke@435 84 bool _enabled;
duke@435 85 };
duke@435 86
duke@435 87 inline bool JavaAssertions::userClassDefault() {
duke@435 88 return _userDefault;
duke@435 89 }
duke@435 90
duke@435 91 inline void JavaAssertions::setUserClassDefault(bool enabled) {
duke@435 92 if (TraceJavaAssertions)
duke@435 93 tty->print_cr("JavaAssertions::setUserClassDefault(%d)", enabled);
duke@435 94 _userDefault = enabled;
duke@435 95 }
duke@435 96
duke@435 97 inline bool JavaAssertions::systemClassDefault() {
duke@435 98 return _sysDefault;
duke@435 99 }
duke@435 100
duke@435 101 inline void JavaAssertions::setSystemClassDefault(bool enabled) {
duke@435 102 if (TraceJavaAssertions)
duke@435 103 tty->print_cr("JavaAssertions::setSystemClassDefault(%d)", enabled);
duke@435 104 _sysDefault = enabled;
duke@435 105 }
stefank@2314 106
stefank@2314 107 #endif // SHARE_VM_CLASSFILE_JAVAASSERTIONS_HPP

mercurial