Mercurial > hg > graal-jvmci-8
annotate src/share/vm/runtime/unhandledOops.cpp @ 18929:8f2fb6bec986
removed GPU code
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 23 Jan 2015 10:54:21 +0100 |
parents | 78bbf4d43a14 |
children |
rev | line source |
---|---|
0 | 1 /* |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17876
diff
changeset
|
2 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "gc_interface/collectedHeap.hpp" | |
27 #include "memory/gcLocker.inline.hpp" | |
28 #include "memory/universe.hpp" | |
29 #include "oops/oop.inline.hpp" | |
30 #include "runtime/thread.hpp" | |
31 #include "runtime/unhandledOops.hpp" | |
32 #include "utilities/globalDefinitions.hpp" | |
0 | 33 |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17876
diff
changeset
|
34 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17876
diff
changeset
|
35 |
0 | 36 #ifdef CHECK_UNHANDLED_OOPS |
37 const int free_list_size = 256; | |
38 | |
39 | |
40 UnhandledOops::UnhandledOops(Thread* thread) { | |
41 _thread = thread; | |
6197 | 42 _oop_list = new (ResourceObj::C_HEAP, mtInternal) |
0 | 43 GrowableArray<UnhandledOopEntry>(free_list_size, true); |
44 _level = 0; | |
45 } | |
46 | |
47 UnhandledOops::~UnhandledOops() { | |
48 delete _oop_list; | |
49 } | |
50 | |
51 | |
52 void UnhandledOops::dump_oops(UnhandledOops *list) { | |
53 for (int k = 0; k < list->_oop_list->length(); k++) { | |
54 UnhandledOopEntry entry = list->_oop_list->at(k); | |
55 tty->print(" " INTPTR_FORMAT, entry._oop_ptr); | |
56 } | |
57 tty->cr(); | |
58 } | |
59 | |
60 // For debugging unhandled oop detector _in the debugger_ | |
61 // You don't want to turn it on in compiled code here. | |
62 static bool unhandled_oop_print=0; | |
63 | |
64 void UnhandledOops::register_unhandled_oop(oop* op, address pc) { | |
65 if (!_thread->is_in_stack((address)op)) | |
66 return; | |
67 | |
68 _level ++; | |
69 if (unhandled_oop_print) { | |
70 for (int i=0; i<_level; i++) tty->print(" "); | |
71 tty->print_cr("r " INTPTR_FORMAT, op); | |
72 } | |
73 UnhandledOopEntry entry(op, pc); | |
74 _oop_list->push(entry); | |
75 } | |
76 | |
77 | |
78 bool match_oop_entry(void *op, UnhandledOopEntry e) { | |
79 return (e.oop_ptr() == op); | |
80 } | |
81 | |
82 // Mark unhandled oop as okay for GC - the containing struct has an oops_do and | |
83 // for some reason the oop has to be on the stack. | |
84 // May not be called for the current thread, as in the case of | |
85 // VM_GetOrSetLocal in jvmti. | |
86 void UnhandledOops::allow_unhandled_oop(oop* op) { | |
87 assert (CheckUnhandledOops, "should only be called with checking option"); | |
88 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
89 int i = _oop_list->find_from_end(op, match_oop_entry); |
0 | 90 assert(i!=-1, "safe for gc oop not in unhandled_oop_list"); |
91 | |
92 UnhandledOopEntry entry = _oop_list->at(i); | |
93 assert(!entry._ok_for_gc, "duplicate entry"); | |
94 entry._ok_for_gc = true; | |
95 _oop_list->at_put(i, entry); | |
96 } | |
97 | |
98 | |
99 // Called by the oop destructor to remove unhandled oop from the thread's | |
100 // oop list. All oops given are assumed to be on the list. If not, | |
101 // there's a bug in the unhandled oop detector. | |
102 void UnhandledOops::unregister_unhandled_oop(oop* op) { | |
103 if (!_thread->is_in_stack((address)op)) return; | |
104 | |
105 _level --; | |
106 if (unhandled_oop_print) { | |
107 for (int i=0; i<_level; i++) tty->print(" "); | |
108 tty->print_cr("u "INTPTR_FORMAT, op); | |
109 } | |
110 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
111 int i = _oop_list->find_from_end(op, match_oop_entry); |
0 | 112 assert(i!=-1, "oop not in unhandled_oop_list"); |
113 _oop_list->remove_at(i); | |
114 } | |
115 | |
116 void UnhandledOops::clear_unhandled_oops() { | |
117 assert (CheckUnhandledOops, "should only be called with checking option"); | |
17876
9c3dc501b5eb
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
6725
diff
changeset
|
118 |
0 | 119 for (int k = 0; k < _oop_list->length(); k++) { |
120 UnhandledOopEntry entry = _oop_list->at(k); | |
121 // If an entry is on the unhandled oop list but isn't on the stack | |
122 // anymore, it must not have gotten unregistered properly and it's a bug | |
123 // in the unhandled oop generator. | |
124 if(!_thread->is_in_stack((address)entry._oop_ptr)) { | |
125 tty->print_cr("oop_ptr is " INTPTR_FORMAT, (address)entry._oop_ptr); | |
126 tty->print_cr("thread is " INTPTR_FORMAT " from pc " INTPTR_FORMAT, | |
127 (address)_thread, (address)entry._pc); | |
128 assert(false, "heap is corrupted by the unhandled oop detector"); | |
129 } | |
130 // Set unhandled oops to a pattern that will crash distinctively | |
131 if (!entry._ok_for_gc) *(intptr_t*)(entry._oop_ptr) = BAD_OOP_ADDR; | |
132 } | |
133 } | |
134 #endif // CHECK_UNHANDLED_OOPS |