< prev index next >

src/hotspot/share/interpreter/interpreterRuntime.cpp

Print this page




1465 
1466   if (JvmtiExport::should_post_single_step()) {
1467     // We are called during regular safepoints and when the VM is
1468     // single stepping. If any thread is marked for single stepping,
1469     // then we may have JVMTI work to do.
1470     LastFrameAccessor last_frame(thread);
1471     JvmtiExport::at_single_stepping_point(thread, last_frame.method(), last_frame.bcp());
1472   }
1473 JRT_END
1474 
1475 JRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj,
1476 ConstantPoolCacheEntry *cp_entry))
1477 
1478   // check the access_flags for the field in the klass
1479 
1480   InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass());
1481   int index = cp_entry->field_index();
1482   if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return;
1483 
1484   bool is_static = (obj == NULL);

1485   HandleMark hm(thread);
1486 
1487   Handle h_obj;
1488   if (!is_static) {
1489     // non-static field accessors have an object, but we need a handle
1490     h_obj = Handle(thread, obj);
1491   }
1492   InstanceKlass* cp_entry_f1 = InstanceKlass::cast(cp_entry->f1_as_klass());
1493   jfieldID fid = jfieldIDWorkaround::to_jfieldID(cp_entry_f1, cp_entry->f2_as_index(), is_static);
1494   LastFrameAccessor last_frame(thread);
1495   JvmtiExport::post_field_access(thread, last_frame.method(), last_frame.bcp(), cp_entry_f1, h_obj, fid);
1496 JRT_END
1497 
1498 JRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
1499   oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
1500 
1501   Klass* k = cp_entry->f1_as_klass();
1502 
1503   // check the access_flags for the field in the klass
1504   InstanceKlass* ik = InstanceKlass::cast(k);
1505   int index = cp_entry->field_index();
1506   // bail out if field modifications are not watched
1507   if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return;
1508 
1509   char sig_type = '\0';
1510 
1511   switch(cp_entry->flag_state()) {
1512     case btos: sig_type = 'B'; break;
1513     case ztos: sig_type = 'Z'; break;
1514     case ctos: sig_type = 'C'; break;
1515     case stos: sig_type = 'S'; break;
1516     case itos: sig_type = 'I'; break;
1517     case ftos: sig_type = 'F'; break;
1518     case atos: sig_type = 'L'; break;
1519     case ltos: sig_type = 'J'; break;
1520     case dtos: sig_type = 'D'; break;
1521     default:  ShouldNotReachHere(); return;
1522   }
1523 
1524   // Both Q-signatures and L-signatures are mapped to atos
1525   if (cp_entry->flag_state() == atos && ik->field_signature(index)->is_Q_signature()) {
1526     sig_type = 'Q';
1527   }
1528 
1529   bool is_static = (obj == NULL);

1530 
1531   HandleMark hm(thread);
1532   jfieldID fid = jfieldIDWorkaround::to_jfieldID(ik, cp_entry->f2_as_index(), is_static);
1533   jvalue fvalue;
1534 #ifdef _LP64
1535   fvalue = *value;
1536 #else
1537   // Long/double values are stored unaligned and also noncontiguously with
1538   // tagged stacks.  We can't just do a simple assignment even in the non-
1539   // J/D cases because a C++ compiler is allowed to assume that a jvalue is
1540   // 8-byte aligned, and interpreter stack slots are only 4-byte aligned.
1541   // We assume that the two halves of longs/doubles are stored in interpreter
1542   // stack slots in platform-endian order.
1543   jlong_accessor u;
1544   jint* newval = (jint*)value;
1545   u.words[0] = newval[0];
1546   u.words[1] = newval[Interpreter::stackElementWords]; // skip if tag
1547   fvalue.j = u.long_value;
1548 #endif // _LP64
1549 
1550   Handle h_obj;
1551   if (!is_static) {
1552     // non-static field accessors have an object, but we need a handle




1465 
1466   if (JvmtiExport::should_post_single_step()) {
1467     // We are called during regular safepoints and when the VM is
1468     // single stepping. If any thread is marked for single stepping,
1469     // then we may have JVMTI work to do.
1470     LastFrameAccessor last_frame(thread);
1471     JvmtiExport::at_single_stepping_point(thread, last_frame.method(), last_frame.bcp());
1472   }
1473 JRT_END
1474 
1475 JRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj,
1476 ConstantPoolCacheEntry *cp_entry))
1477 
1478   // check the access_flags for the field in the klass
1479 
1480   InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass());
1481   int index = cp_entry->field_index();
1482   if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return;
1483 
1484   bool is_static = (obj == NULL);
1485   bool is_flattened = cp_entry->is_flattened();
1486   HandleMark hm(thread);
1487 
1488   Handle h_obj;
1489   if (!is_static) {
1490     // non-static field accessors have an object, but we need a handle
1491     h_obj = Handle(thread, obj);
1492   }
1493   InstanceKlass* cp_entry_f1 = InstanceKlass::cast(cp_entry->f1_as_klass());
1494   jfieldID fid = jfieldIDWorkaround::to_jfieldID(cp_entry_f1, cp_entry->f2_as_index(), is_static, is_flattened);
1495   LastFrameAccessor last_frame(thread);
1496   JvmtiExport::post_field_access(thread, last_frame.method(), last_frame.bcp(), cp_entry_f1, h_obj, fid);
1497 JRT_END
1498 
1499 JRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
1500   oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
1501 
1502   Klass* k = cp_entry->f1_as_klass();
1503 
1504   // check the access_flags for the field in the klass
1505   InstanceKlass* ik = InstanceKlass::cast(k);
1506   int index = cp_entry->field_index();
1507   // bail out if field modifications are not watched
1508   if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return;
1509 
1510   char sig_type = '\0';
1511 
1512   switch(cp_entry->flag_state()) {
1513     case btos: sig_type = 'B'; break;
1514     case ztos: sig_type = 'Z'; break;
1515     case ctos: sig_type = 'C'; break;
1516     case stos: sig_type = 'S'; break;
1517     case itos: sig_type = 'I'; break;
1518     case ftos: sig_type = 'F'; break;
1519     case atos: sig_type = 'L'; break;
1520     case ltos: sig_type = 'J'; break;
1521     case dtos: sig_type = 'D'; break;
1522     default:  ShouldNotReachHere(); return;
1523   }
1524 
1525   // Both Q-signatures and L-signatures are mapped to atos
1526   if (cp_entry->flag_state() == atos && ik->field_signature(index)->is_Q_signature()) {
1527     sig_type = 'Q';
1528   }
1529 
1530   bool is_static = (obj == NULL);
1531   bool is_flattened = cp_entry->is_flattened();
1532 
1533   HandleMark hm(thread);
1534   jfieldID fid = jfieldIDWorkaround::to_jfieldID(ik, cp_entry->f2_as_index(), is_static, is_flattened);
1535   jvalue fvalue;
1536 #ifdef _LP64
1537   fvalue = *value;
1538 #else
1539   // Long/double values are stored unaligned and also noncontiguously with
1540   // tagged stacks.  We can't just do a simple assignment even in the non-
1541   // J/D cases because a C++ compiler is allowed to assume that a jvalue is
1542   // 8-byte aligned, and interpreter stack slots are only 4-byte aligned.
1543   // We assume that the two halves of longs/doubles are stored in interpreter
1544   // stack slots in platform-endian order.
1545   jlong_accessor u;
1546   jint* newval = (jint*)value;
1547   u.words[0] = newval[0];
1548   u.words[1] = newval[Interpreter::stackElementWords]; // skip if tag
1549   fvalue.j = u.long_value;
1550 #endif // _LP64
1551 
1552   Handle h_obj;
1553   if (!is_static) {
1554     // non-static field accessors have an object, but we need a handle


< prev index next >