Mercurial > hg > truffle
annotate src/share/vm/runtime/vmThread.hpp @ 1721:413ad0331a0c
6977924: Changes for 6975078 produce build error with certain gcc versions
Summary: The changes introduced for 6975078 assign badHeapOopVal to the _allocation field in the ResourceObj class. In 32 bit linux builds with certain versions of gcc this assignment will be flagged as an error while compiling allocation.cpp. In 32 bit builds the constant value badHeapOopVal (which is cast to an intptr_t) is negative. The _allocation field is typed as an unsigned intptr_t and gcc catches this as an error.
Reviewed-by: jcoomes, ysr, phh
author | johnc |
---|---|
date | Wed, 18 Aug 2010 10:59:06 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1119
diff
changeset
|
2 * Copyright (c) 1998, 2006, 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:
1119
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1119
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:
1119
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 // | |
26 // Prioritized queue of VM operations. | |
27 // | |
28 // Encapsulates both queue management and | |
29 // and priority policy | |
30 // | |
31 class VMOperationQueue : public CHeapObj { | |
32 private: | |
33 enum Priorities { | |
34 SafepointPriority, // Highest priority (operation executed at a safepoint) | |
35 MediumPriority, // Medium priority | |
36 nof_priorities | |
37 }; | |
38 | |
39 // We maintain a doubled linked list, with explicit count. | |
40 int _queue_length[nof_priorities]; | |
41 int _queue_counter; | |
42 VM_Operation* _queue [nof_priorities]; | |
43 // we also allow the vmThread to register the ops it has drained so we | |
44 // can scan them from oops_do | |
45 VM_Operation* _drain_list; | |
46 | |
47 // Double-linked non-empty list insert. | |
48 void insert(VM_Operation* q,VM_Operation* n); | |
49 void unlink(VM_Operation* q); | |
50 | |
51 // Basic queue manipulation | |
52 bool queue_empty (int prio); | |
53 void queue_add_front (int prio, VM_Operation *op); | |
54 void queue_add_back (int prio, VM_Operation *op); | |
55 VM_Operation* queue_remove_front(int prio); | |
56 void queue_oops_do(int queue, OopClosure* f); | |
57 void drain_list_oops_do(OopClosure* f); | |
58 VM_Operation* queue_drain(int prio); | |
59 // lock-free query: may return the wrong answer but must not break | |
60 bool queue_peek(int prio) { return _queue_length[prio] > 0; } | |
61 | |
62 public: | |
63 VMOperationQueue(); | |
64 | |
65 // Highlevel operations. Encapsulates policy | |
66 bool add(VM_Operation *op); | |
67 VM_Operation* remove_next(); // Returns next or null | |
68 VM_Operation* remove_next_at_safepoint_priority() { return queue_remove_front(SafepointPriority); } | |
69 VM_Operation* drain_at_safepoint_priority() { return queue_drain(SafepointPriority); } | |
70 void set_drain_list(VM_Operation* list) { _drain_list = list; } | |
71 bool peek_at_safepoint_priority() { return queue_peek(SafepointPriority); } | |
72 | |
73 // GC support | |
74 void oops_do(OopClosure* f); | |
75 | |
76 void verify_queue(int prio) PRODUCT_RETURN; | |
77 }; | |
78 | |
79 | |
80 // | |
81 // A single VMThread (the primordial thread) spawns all other threads | |
82 // and is itself used by other threads to offload heavy vm operations | |
83 // like scavenge, garbage_collect etc. | |
84 // | |
85 | |
1119
547f81740344
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
989
diff
changeset
|
86 class VMThread: public NamedThread { |
0 | 87 private: |
88 static ThreadPriority _current_priority; | |
89 | |
90 static bool _should_terminate; | |
91 static bool _terminated; | |
92 static Monitor * _terminate_lock; | |
93 static PerfCounter* _perf_accumulated_vm_operation_time; | |
94 | |
95 void evaluate_operation(VM_Operation* op); | |
96 public: | |
97 // Constructor | |
98 VMThread(); | |
99 | |
100 // Tester | |
101 bool is_VM_thread() const { return true; } | |
102 bool is_GC_thread() const { return true; } | |
103 | |
104 // The ever running loop for the VMThread | |
105 void loop(); | |
106 | |
107 // Called to stop the VM thread | |
108 static void wait_for_vm_thread_exit(); | |
109 static bool should_terminate() { return _should_terminate; } | |
110 static bool is_terminated() { return _terminated == true; } | |
111 | |
112 // Execution of vm operation | |
113 static void execute(VM_Operation* op); | |
114 | |
115 // Returns the current vm operation if any. | |
116 static VM_Operation* vm_operation() { return _cur_vm_operation; } | |
117 | |
118 // Returns the single instance of VMThread. | |
119 static VMThread* vm_thread() { return _vm_thread; } | |
120 | |
121 // GC support | |
989 | 122 void oops_do(OopClosure* f, CodeBlobClosure* cf); |
0 | 123 |
124 // Debugging | |
125 void print_on(outputStream* st) const; | |
126 void print() const { print_on(tty); } | |
127 void verify(); | |
128 | |
129 // Performance measurement | |
130 static PerfCounter* perf_accumulated_vm_operation_time() { return _perf_accumulated_vm_operation_time; } | |
131 | |
132 // Entry for starting vm thread | |
133 virtual void run(); | |
134 | |
135 // Creations/Destructions | |
136 static void create(); | |
137 static void destroy(); | |
138 | |
139 private: | |
140 // VM_Operation support | |
141 static VM_Operation* _cur_vm_operation; // Current VM operation | |
142 static VMOperationQueue* _vm_queue; // Queue (w/ policy) of VM operations | |
143 | |
144 // Pointer to single-instance of VM thread | |
145 static VMThread* _vm_thread; | |
146 }; |