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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "interpreter/interpreter.hpp"
27 #include "jvmtifiles/jvmtiEnv.hpp"
28 #include "logging/log.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "prims/jvmtiEventController.hpp"
31 #include "prims/jvmtiEventController.inline.hpp"
32 #include "prims/jvmtiExport.hpp"
33 #include "prims/jvmtiImpl.hpp"
34 #include "prims/jvmtiThreadState.inline.hpp"
35 #include "runtime/frame.hpp"
36 #include "runtime/thread.inline.hpp"
37 #include "runtime/threadSMR.hpp"
38 #include "runtime/vframe.hpp"
39 #include "runtime/vframe_hp.hpp"
40 #include "runtime/vmThread.hpp"
41 #include "runtime/vmOperations.hpp"
42
43 #ifdef JVMTI_TRACE
44 #define EC_TRACE(out) do { \
45 if (JvmtiTrace::trace_event_controller()) { \
46 SafeResourceMark rm; \
47 log_trace(jvmti) out; \
48 } \
49 } while (0)
50 #else
51 #define EC_TRACE(out)
52 #endif /*JVMTI_TRACE */
53
54 // bits for standard events
222 _state->enter_interp_only_mode();
223
224 JavaThread *thread = _state->get_thread();
225 if (thread->has_last_Java_frame()) {
226 // If running in fullspeed mode, single stepping is implemented
227 // as follows: first, the interpreter does not dispatch to
228 // compiled code for threads that have single stepping enabled;
229 // second, we deoptimize all methods on the thread's stack when
230 // interpreted-only mode is enabled the first time for a given
231 // thread (nothing to do if no Java frames yet).
232 int num_marked = 0;
233 ResourceMark resMark;
234 RegisterMap rm(thread, false);
235 for (vframe* vf = thread->last_java_vframe(&rm); vf; vf = vf->sender()) {
236 if (can_be_deoptimized(vf)) {
237 ((compiledVFrame*) vf)->code()->mark_for_deoptimization();
238 ++num_marked;
239 }
240 }
241 if (num_marked > 0) {
242 VM_Deoptimize op;
243 VMThread::execute(&op);
244 }
245 }
246 }
247
248
249 ///////////////////////////////////////////////////////////////
250 //
251 // VM_ChangeSingleStep
252 //
253
254 class VM_ChangeSingleStep : public VM_Operation {
255 private:
256 bool _on;
257
258 public:
259 VM_ChangeSingleStep(bool on);
260 VMOp_Type type() const { return VMOp_ChangeSingleStep; }
261 bool allow_nested_vm_operations() const { return true; }
262 void doit(); // method definition is after definition of JvmtiEventControllerPrivate because of scoping
263 };
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "interpreter/interpreter.hpp"
27 #include "jvmtifiles/jvmtiEnv.hpp"
28 #include "logging/log.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "prims/jvmtiEventController.hpp"
31 #include "prims/jvmtiEventController.inline.hpp"
32 #include "prims/jvmtiExport.hpp"
33 #include "prims/jvmtiImpl.hpp"
34 #include "prims/jvmtiThreadState.inline.hpp"
35 #include "runtime/deoptimization.hpp"
36 #include "runtime/frame.hpp"
37 #include "runtime/thread.inline.hpp"
38 #include "runtime/threadSMR.hpp"
39 #include "runtime/vframe.hpp"
40 #include "runtime/vframe_hp.hpp"
41 #include "runtime/vmThread.hpp"
42 #include "runtime/vmOperations.hpp"
43
44 #ifdef JVMTI_TRACE
45 #define EC_TRACE(out) do { \
46 if (JvmtiTrace::trace_event_controller()) { \
47 SafeResourceMark rm; \
48 log_trace(jvmti) out; \
49 } \
50 } while (0)
51 #else
52 #define EC_TRACE(out)
53 #endif /*JVMTI_TRACE */
54
55 // bits for standard events
223 _state->enter_interp_only_mode();
224
225 JavaThread *thread = _state->get_thread();
226 if (thread->has_last_Java_frame()) {
227 // If running in fullspeed mode, single stepping is implemented
228 // as follows: first, the interpreter does not dispatch to
229 // compiled code for threads that have single stepping enabled;
230 // second, we deoptimize all methods on the thread's stack when
231 // interpreted-only mode is enabled the first time for a given
232 // thread (nothing to do if no Java frames yet).
233 int num_marked = 0;
234 ResourceMark resMark;
235 RegisterMap rm(thread, false);
236 for (vframe* vf = thread->last_java_vframe(&rm); vf; vf = vf->sender()) {
237 if (can_be_deoptimized(vf)) {
238 ((compiledVFrame*) vf)->code()->mark_for_deoptimization();
239 ++num_marked;
240 }
241 }
242 if (num_marked > 0) {
243 Deoptimization::deoptimize_all_marked();
244 }
245 }
246 }
247
248
249 ///////////////////////////////////////////////////////////////
250 //
251 // VM_ChangeSingleStep
252 //
253
254 class VM_ChangeSingleStep : public VM_Operation {
255 private:
256 bool _on;
257
258 public:
259 VM_ChangeSingleStep(bool on);
260 VMOp_Type type() const { return VMOp_ChangeSingleStep; }
261 bool allow_nested_vm_operations() const { return true; }
262 void doit(); // method definition is after definition of JvmtiEventControllerPrivate because of scoping
263 };
|