Tue, 20 Jul 2010 08:41:42 -0700
6964170: Verifier crashes
Summary: Check if klassOop != NULL rather than klass_part != NULL
Reviewed-by: kamg, never
duke@435 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 2000, 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 | |
duke@435 | 25 | class JavaAssertions: AllStatic { |
duke@435 | 26 | public: |
duke@435 | 27 | static inline bool userClassDefault(); |
duke@435 | 28 | static inline void setUserClassDefault(bool enabled); |
duke@435 | 29 | static inline bool systemClassDefault(); |
duke@435 | 30 | static inline void setSystemClassDefault(bool enabled); |
duke@435 | 31 | |
duke@435 | 32 | // Add a command-line option. A name ending in "..." applies to a package and |
duke@435 | 33 | // any subpackages; other names apply to a single class. |
duke@435 | 34 | static void addOption(const char* name, bool enable); |
duke@435 | 35 | |
duke@435 | 36 | // Return true if command-line options have enabled assertions for the named |
duke@435 | 37 | // class. Should be called only after all command-line options have been |
duke@435 | 38 | // processed. Note: this only consults command-line options and does not |
duke@435 | 39 | // account for any dynamic changes to assertion status. |
duke@435 | 40 | static bool enabled(const char* classname, bool systemClass); |
duke@435 | 41 | |
duke@435 | 42 | // Create an instance of java.lang.AssertionStatusDirectives and fill in the |
duke@435 | 43 | // fields based on the command-line assertion options. |
duke@435 | 44 | static oop createAssertionStatusDirectives(TRAPS); |
duke@435 | 45 | |
duke@435 | 46 | private: |
duke@435 | 47 | class OptionList; |
duke@435 | 48 | static void fillJavaArrays(const OptionList* p, int len, objArrayHandle names, |
duke@435 | 49 | typeArrayHandle status, TRAPS); |
duke@435 | 50 | |
duke@435 | 51 | static inline void trace(const char* name, const char* typefound, |
duke@435 | 52 | const char* namefound, bool enabled); |
duke@435 | 53 | |
duke@435 | 54 | static inline OptionList* match_class(const char* classname); |
duke@435 | 55 | static OptionList* match_package(const char* classname); |
duke@435 | 56 | |
duke@435 | 57 | static bool _userDefault; // User class default (-ea/-da). |
duke@435 | 58 | static bool _sysDefault; // System class default (-esa/-dsa). |
duke@435 | 59 | static OptionList* _classes; // Options for classes. |
duke@435 | 60 | static OptionList* _packages; // Options for package trees. |
duke@435 | 61 | }; |
duke@435 | 62 | |
duke@435 | 63 | class JavaAssertions::OptionList: public CHeapObj { |
duke@435 | 64 | public: |
duke@435 | 65 | inline OptionList(const char* name, bool enable, OptionList* next); |
duke@435 | 66 | |
duke@435 | 67 | inline const char* name() const { return _name; } |
duke@435 | 68 | inline bool enabled() const { return _enabled; } |
duke@435 | 69 | inline OptionList* next() const { return _next; } |
duke@435 | 70 | |
duke@435 | 71 | static int count(OptionList* p); |
duke@435 | 72 | |
duke@435 | 73 | private: |
duke@435 | 74 | const char* _name; |
duke@435 | 75 | OptionList* _next; |
duke@435 | 76 | bool _enabled; |
duke@435 | 77 | }; |
duke@435 | 78 | |
duke@435 | 79 | inline bool JavaAssertions::userClassDefault() { |
duke@435 | 80 | return _userDefault; |
duke@435 | 81 | } |
duke@435 | 82 | |
duke@435 | 83 | inline void JavaAssertions::setUserClassDefault(bool enabled) { |
duke@435 | 84 | if (TraceJavaAssertions) |
duke@435 | 85 | tty->print_cr("JavaAssertions::setUserClassDefault(%d)", enabled); |
duke@435 | 86 | _userDefault = enabled; |
duke@435 | 87 | } |
duke@435 | 88 | |
duke@435 | 89 | inline bool JavaAssertions::systemClassDefault() { |
duke@435 | 90 | return _sysDefault; |
duke@435 | 91 | } |
duke@435 | 92 | |
duke@435 | 93 | inline void JavaAssertions::setSystemClassDefault(bool enabled) { |
duke@435 | 94 | if (TraceJavaAssertions) |
duke@435 | 95 | tty->print_cr("JavaAssertions::setSystemClassDefault(%d)", enabled); |
duke@435 | 96 | _sysDefault = enabled; |
duke@435 | 97 | } |