Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp @ 4132:6d7d0790074d
7119584: UseParallelGC barrier task can be overwritten.
Summary: Provoke a GC for a metadata allocation failure.
Reviewed-by: johnc, iveresov
author | jmasa |
---|---|
date | Fri, 09 Dec 2011 19:28:34 -0800 |
parents | bca17e38de00 |
children | d2a62e0f25eb |
comparison
equal
deleted
inserted
replaced
4131:e9b91fd07263 | 4132:6d7d0790074d |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. | 3 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 5 * |
6 * This code is free software; you can redistribute it and/or modify it | 6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as | 7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. | 8 * published by the Free Software Foundation. |
127 HandleMark hm_inner; | 127 HandleMark hm_inner; |
128 ResourceMark rm_inner; | 128 ResourceMark rm_inner; |
129 for (; /* break */; ) { | 129 for (; /* break */; ) { |
130 // This will block until there is a task to be gotten. | 130 // This will block until there is a task to be gotten. |
131 GCTask* task = manager()->get_task(which()); | 131 GCTask* task = manager()->get_task(which()); |
132 // Record if this is an idle task for later use. | |
133 bool is_idle_task = task->is_idle_task(); | |
132 // In case the update is costly | 134 // In case the update is costly |
133 if (PrintGCTaskTimeStamps) { | 135 if (PrintGCTaskTimeStamps) { |
134 timer.update(); | 136 timer.update(); |
135 } | 137 } |
136 | 138 |
137 jlong entry_time = timer.ticks(); | 139 jlong entry_time = timer.ticks(); |
138 char* name = task->name(); | 140 char* name = task->name(); |
139 | 141 |
142 // If this is the barrier task, it can be destroyed | |
143 // by the GC task manager once the do_it() executes. | |
140 task->do_it(manager(), which()); | 144 task->do_it(manager(), which()); |
141 | 145 |
142 if (!task->is_idle_task()) { | 146 // Use the saved value of is_idle_task because references |
147 // using "task" are not reliable for the barrier task. | |
148 if (!is_idle_task) { | |
143 manager()->note_completion(which()); | 149 manager()->note_completion(which()); |
144 | 150 |
145 if (PrintGCTaskTimeStamps) { | 151 if (PrintGCTaskTimeStamps) { |
146 assert(_time_stamps != NULL, | 152 assert(_time_stamps != NULL, |
147 "Sanity (PrintGCTaskTimeStamps set late?)"); | 153 "Sanity (PrintGCTaskTimeStamps set late?)"); |