1 /* |
1 /* |
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
148 // maintain the current JVMTI location on a per-thread per-env basis |
148 // maintain the current JVMTI location on a per-thread per-env basis |
149 // and use it to filter out duplicate events: |
149 // and use it to filter out duplicate events: |
150 // - instruction rewrites |
150 // - instruction rewrites |
151 // - breakpoint followed by single step |
151 // - breakpoint followed by single step |
152 // - single step at a breakpoint |
152 // - single step at a breakpoint |
153 void JvmtiEnvThreadState::compare_and_set_current_location(methodOop new_method, |
153 void JvmtiEnvThreadState::compare_and_set_current_location(Method* new_method, |
154 address new_location, jvmtiEvent event) { |
154 address new_location, jvmtiEvent event) { |
155 |
155 |
156 int new_bci = new_location - new_method->code_base(); |
156 int new_bci = new_location - new_method->code_base(); |
157 |
157 |
158 // The method is identified and stored as a jmethodID which is safe in this |
158 // The method is identified and stored as a jmethodID which is safe in this |
269 void doit() { |
269 void doit() { |
270 ResourceMark rmark; // _thread != Thread::current() |
270 ResourceMark rmark; // _thread != Thread::current() |
271 RegisterMap rm(_thread, false); |
271 RegisterMap rm(_thread, false); |
272 javaVFrame* vf = _thread->last_java_vframe(&rm); |
272 javaVFrame* vf = _thread->last_java_vframe(&rm); |
273 assert(vf != NULL, "must have last java frame"); |
273 assert(vf != NULL, "must have last java frame"); |
274 methodOop method = vf->method(); |
274 Method* method = vf->method(); |
275 _method_id = method->jmethod_id(); |
275 _method_id = method->jmethod_id(); |
276 _bci = vf->bci(); |
276 _bci = vf->bci(); |
277 } |
277 } |
278 void get_current_location(jmethodID *method_id, int *bci) { |
278 void get_current_location(jmethodID *method_id, int *bci) { |
279 *method_id = _method_id; |
279 *method_id = _method_id; |