< prev index next >

src/hotspot/share/prims/jvmtiImpl.hpp

Print this page

293   }
294 
295   VMOp_Type type() const { return VMOp_ChangeBreakpoints; }
296   void doit();
297 };
298 
299 
300 ///////////////////////////////////////////////////////////////
301 // The get/set local operations must only be done by the VM thread
302 // because the interpreter version needs to access oop maps, which can
303 // only safely be done by the VM thread
304 //
305 // I'm told that in 1.5 oop maps are now protected by a lock and
306 // we could get rid of the VM op
307 // However if the VM op is removed then the target thread must
308 // be suspended AND a lock will be needed to prevent concurrent
309 // setting of locals to the same java thread. This lock is needed
310 // to prevent compiledVFrames from trying to add deferred updates
311 // to the thread simultaneously.
312 //
313 class VM_GetOrSetLocal : public VM_Operation {
314  protected:
315   JavaThread* _thread;
316   JavaThread* _calling_thread;
317   jint        _depth;
318   jint        _index;
319   BasicType   _type;
320   jvalue      _value;
321   javaVFrame* _jvf;
322   bool        _set;
323 
324   EscapeBarrier _eb;
325 
326   // It is possible to get the receiver out of a non-static native wrapper
327   // frame.  Use VM_GetReceiver to do this.
328   virtual bool getting_receiver() const { return false; }
329 
330   jvmtiError  _result;
331 
332   vframe* get_vframe();
333   javaVFrame* get_java_vframe();
334   bool check_slot_type_lvt(javaVFrame* vf);
335   bool check_slot_type_no_lvt(javaVFrame* vf);
336 
























337 public:
338   // Constructor for non-object getter
339   VM_GetOrSetLocal(JavaThread* thread, jint depth, jint index, BasicType type);
340 
341   // Constructor for object or non-object setter
342   VM_GetOrSetLocal(JavaThread* thread, jint depth, jint index, BasicType type, jvalue value);
343 
344   // Constructor for object getter
345   VM_GetOrSetLocal(JavaThread* thread, JavaThread* calling_thread, jint depth,
346                    int index);
347 
348   VMOp_Type type() const { return VMOp_GetOrSetLocal; }
349   jvalue value()         { return _value; }
350   jvmtiError result()    { return _result; }
351 
352   bool doit_prologue();
353   void doit();
354   bool allow_nested_vm_operations() const;
355   const char* name() const                       { return "get/set locals"; }
356 
357   // Check that the klass is assignable to a type with the given signature.
358   static bool is_assignable(const char* ty_sign, Klass* klass, Thread* thread);
359 };
360 
361 class VM_GetReceiver : public VM_GetOrSetLocal {
362  protected:
363   virtual bool getting_receiver() const { return true; }
364 
365  public:
366   VM_GetReceiver(JavaThread* thread, JavaThread* calling_thread, jint depth);
367   const char* name() const                       { return "get receiver"; }
368 };
369 


































370 
371 ///////////////////////////////////////////////////////////////
372 //
373 // class JvmtiSuspendControl
374 //
375 // Convenience routines for suspending and resuming threads.
376 //
377 // All attempts by JVMTI to suspend and resume threads must go through the
378 // JvmtiSuspendControl interface.
379 //
380 // methods return true if successful
381 //
382 class JvmtiSuspendControl : public AllStatic {
383 public:
384   // suspend the thread, taking it to a safepoint
385   static bool suspend(JavaThread *java_thread);
386   // resume the thread
387   static bool resume(JavaThread *java_thread);
388 
389   static void print();

293   }
294 
295   VMOp_Type type() const { return VMOp_ChangeBreakpoints; }
296   void doit();
297 };
298 
299 
300 ///////////////////////////////////////////////////////////////
301 // The get/set local operations must only be done by the VM thread
302 // because the interpreter version needs to access oop maps, which can
303 // only safely be done by the VM thread
304 //
305 // I'm told that in 1.5 oop maps are now protected by a lock and
306 // we could get rid of the VM op
307 // However if the VM op is removed then the target thread must
308 // be suspended AND a lock will be needed to prevent concurrent
309 // setting of locals to the same java thread. This lock is needed
310 // to prevent compiledVFrames from trying to add deferred updates
311 // to the thread simultaneously.
312 //
313 class VM_BaseGetOrSetLocal : public VM_Operation {
314  protected:

315   JavaThread* _calling_thread;
316   jint        _depth;
317   jint        _index;
318   BasicType   _type;
319   jvalue      _value;
320   javaVFrame* _jvf;
321   bool        _set;
322 
323   static const jvalue _DEFAULT_VALUE;
324 
325   // It is possible to get the receiver out of a non-static native wrapper
326   // frame.  Use VM_GetReceiver to do this.
327   virtual bool getting_receiver() const { return false; }
328 
329   jvmtiError  _result;
330 
331   virtual javaVFrame* get_java_vframe() = 0;

332   bool check_slot_type_lvt(javaVFrame* vf);
333   bool check_slot_type_no_lvt(javaVFrame* vf);
334 
335 public:
336   VM_BaseGetOrSetLocal(JavaThread* calling_thread, jint depth, jint index,
337                        BasicType type, jvalue value, bool set);
338 
339   jvalue value()         { return _value; }
340   jvmtiError result()    { return _result; }
341 
342   void doit();
343   bool allow_nested_vm_operations() const;
344   virtual const char* name() const = 0;
345 
346   // Check that the klass is assignable to a type with the given signature.
347   static bool is_assignable(const char* ty_sign, Klass* klass, Thread* thread);
348 };
349 
350 
351 class VM_GetOrSetLocal : public VM_BaseGetOrSetLocal {
352  protected:
353   JavaThread* _thread;
354   EscapeBarrier _eb;
355 
356   vframe* get_vframe();
357   javaVFrame* get_java_vframe();
358 
359 public:
360   // Constructor for non-object getter
361   VM_GetOrSetLocal(JavaThread* thread, jint depth, jint index, BasicType type);
362 
363   // Constructor for object or non-object setter
364   VM_GetOrSetLocal(JavaThread* thread, jint depth, jint index, BasicType type, jvalue value);
365 
366   // Constructor for object getter
367   VM_GetOrSetLocal(JavaThread* thread, JavaThread* calling_thread, jint depth,
368                    int index);
369 
370   VMOp_Type type() const { return VMOp_GetOrSetLocal; }


371 
372   bool doit_prologue();



373 
374   const char* name() const                       { return "get/set locals"; }

375 };
376 
377 class VM_GetReceiver : public VM_GetOrSetLocal {
378  protected:
379   virtual bool getting_receiver() const { return true; }
380 
381  public:
382   VM_GetReceiver(JavaThread* thread, JavaThread* calling_thread, jint depth);
383   const char* name() const                       { return "get receiver"; }
384 };
385 
386 // VM operation to get or set virtual thread local
387 class VM_VirtualThreadGetOrSetLocal : public VM_BaseGetOrSetLocal {
388  protected:
389   JvmtiEnv *_env;
390   Handle _vthread_h;
391 
392   javaVFrame* get_java_vframe();
393 
394 public:
395   // Constructor for non-object getter
396   VM_VirtualThreadGetOrSetLocal(JvmtiEnv* env, Handle vthread_h, jint depth, jint index, BasicType type);
397 
398   // Constructor for object or non-object setter
399   VM_VirtualThreadGetOrSetLocal(JvmtiEnv* env, Handle vthread_h, jint depth,
400                         jint index, BasicType type, jvalue value);
401 
402   // Constructor for object getter
403   VM_VirtualThreadGetOrSetLocal(JvmtiEnv* env, Handle vthread_h, JavaThread* calling_thread,
404                         jint depth, int index);
405 
406   VMOp_Type type() const { return VMOp_VirtualThreadGetOrSetLocal; }
407 
408   const char* name() const                       { return "virtual thread get/set locals"; }
409 };
410 
411 class VM_VirtualThreadGetReceiver : public VM_VirtualThreadGetOrSetLocal {
412  protected:
413   virtual bool getting_receiver() const { return true; }
414 
415  public:
416   VM_VirtualThreadGetReceiver(JvmtiEnv* env, Handle vthread_h, JavaThread* calling_thread, jint depth);
417   const char* name() const                       { return "virtual thread get receiver"; }
418 };
419 
420 
421 ///////////////////////////////////////////////////////////////
422 //
423 // class JvmtiSuspendControl
424 //
425 // Convenience routines for suspending and resuming threads.
426 //
427 // All attempts by JVMTI to suspend and resume threads must go through the
428 // JvmtiSuspendControl interface.
429 //
430 // methods return true if successful
431 //
432 class JvmtiSuspendControl : public AllStatic {
433 public:
434   // suspend the thread, taking it to a safepoint
435   static bool suspend(JavaThread *java_thread);
436   // resume the thread
437   static bool resume(JavaThread *java_thread);
438 
439   static void print();
< prev index next >