1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
214 ciEnv::~ciEnv() {
215 GUARDED_VM_ENTRY(
216 CompilerThread* current_thread = CompilerThread::current();
217 _factory->remove_symbols();
218 // Need safepoint to clear the env on the thread. RedefineClasses might
219 // be reading it.
220 current_thread->set_env(NULL);
221 )
222 }
223
224 // ------------------------------------------------------------------
225 // Cache Jvmti state
226 void ciEnv::cache_jvmti_state() {
227 VM_ENTRY_MARK;
228 // Get Jvmti capabilities under lock to get consistant values.
229 MutexLocker mu(JvmtiThreadState_lock);
230 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
231 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables();
232 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
233 _jvmti_can_pop_frame = JvmtiExport::can_pop_frame();
234 }
235
236 bool ciEnv::should_retain_local_variables() const {
237 return _jvmti_can_access_local_variables || _jvmti_can_pop_frame;
238 }
239
240 bool ciEnv::jvmti_state_changed() const {
241 if (!_jvmti_can_access_local_variables &&
242 JvmtiExport::can_access_local_variables()) {
243 return true;
244 }
245 if (!_jvmti_can_hotswap_or_post_breakpoint &&
246 JvmtiExport::can_hotswap_or_post_breakpoint()) {
247 return true;
248 }
249 if (!_jvmti_can_post_on_exceptions &&
250 JvmtiExport::can_post_on_exceptions()) {
251 return true;
252 }
253 if (!_jvmti_can_pop_frame &&
254 JvmtiExport::can_pop_frame()) {
255 return true;
256 }
257 return false;
|
1 /*
2 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
214 ciEnv::~ciEnv() {
215 GUARDED_VM_ENTRY(
216 CompilerThread* current_thread = CompilerThread::current();
217 _factory->remove_symbols();
218 // Need safepoint to clear the env on the thread. RedefineClasses might
219 // be reading it.
220 current_thread->set_env(NULL);
221 )
222 }
223
224 // ------------------------------------------------------------------
225 // Cache Jvmti state
226 void ciEnv::cache_jvmti_state() {
227 VM_ENTRY_MARK;
228 // Get Jvmti capabilities under lock to get consistant values.
229 MutexLocker mu(JvmtiThreadState_lock);
230 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
231 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables();
232 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
233 _jvmti_can_pop_frame = JvmtiExport::can_pop_frame();
234 }
235
236 bool ciEnv::jvmti_state_changed() const {
237 if (!_jvmti_can_access_local_variables &&
238 JvmtiExport::can_access_local_variables()) {
239 return true;
240 }
241 if (!_jvmti_can_hotswap_or_post_breakpoint &&
242 JvmtiExport::can_hotswap_or_post_breakpoint()) {
243 return true;
244 }
245 if (!_jvmti_can_post_on_exceptions &&
246 JvmtiExport::can_post_on_exceptions()) {
247 return true;
248 }
249 if (!_jvmti_can_pop_frame &&
250 JvmtiExport::can_pop_frame()) {
251 return true;
252 }
253 return false;
|