@@ -1279,7 +1279,8 @@ private Object executeBodyFromBCI(VirtualFrame frame, int startBCI, int startTop
12791279 }
12801280 Object returnValue = getReturnValueAsObject (frame , top );
12811281 if (instrument != null ) {
1282- instrument .exitAt (frame , statementIndex , returnValue );
1282+ instrument .notifyExit (frame , this , returnValue );
1283+ instrument .notifyStatementExit (frame , statementIndex , returnValue );
12831284 }
12841285
12851286 // This branch must not be a loop exit.
@@ -2739,64 +2740,64 @@ private int putField(VirtualFrame frame, int top, Field field, int curBCI, int o
27392740 case 'Z' :
27402741 boolean booleanValue = stackIntToBoolean (popInt (frame , top - 1 ));
27412742 if (instrumentation != null ) {
2742- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , booleanValue );
2743+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , booleanValue );
27432744 }
27442745 InterpreterToVM .setFieldBoolean (booleanValue , receiver , field );
27452746 break ;
27462747 case 'B' :
27472748 byte byteValue = (byte ) popInt (frame , top - 1 );
27482749 if (instrumentation != null ) {
2749- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , byteValue );
2750+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , byteValue );
27502751 }
27512752 InterpreterToVM .setFieldByte (byteValue , receiver , field );
27522753 break ;
27532754 case 'C' :
27542755 char charValue = (char ) popInt (frame , top - 1 );
27552756 if (instrumentation != null ) {
2756- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , charValue );
2757+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , charValue );
27572758 }
27582759 InterpreterToVM .setFieldChar (charValue , receiver , field );
27592760 break ;
27602761 case 'S' :
27612762 short shortValue = (short ) popInt (frame , top - 1 );
27622763 if (instrumentation != null ) {
2763- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , shortValue );
2764+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , shortValue );
27642765 }
27652766 InterpreterToVM .setFieldShort (shortValue , receiver , field );
27662767 break ;
27672768 case 'I' :
27682769 int intValue = popInt (frame , top - 1 );
27692770 if (instrumentation != null ) {
2770- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , intValue );
2771+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , intValue );
27712772 }
27722773 InterpreterToVM .setFieldInt (intValue , receiver , field );
27732774 break ;
27742775 case 'D' :
27752776 double doubleValue = popDouble (frame , top - 1 );
27762777 if (instrumentation != null ) {
2777- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , doubleValue );
2778+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , doubleValue );
27782779 }
27792780 InterpreterToVM .setFieldDouble (doubleValue , receiver , field );
27802781 break ;
27812782 case 'F' :
27822783 float floatValue = popFloat (frame , top - 1 );
27832784 if (instrumentation != null ) {
2784- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , floatValue );
2785+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , floatValue );
27852786 }
27862787 InterpreterToVM .setFieldFloat (floatValue , receiver , field );
27872788 break ;
27882789 case 'J' :
27892790 long longValue = popLong (frame , top - 1 );
27902791 if (instrumentation != null ) {
2791- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , longValue );
2792+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , longValue );
27922793 }
27932794 InterpreterToVM .setFieldLong (longValue , receiver , field );
27942795 break ;
27952796 case '[' : // fall through
27962797 case 'L' :
27972798 StaticObject value = popObject (frame , top - 1 );
27982799 if (instrumentation != null ) {
2799- instrumentation .notifyFieldModification (frame , statementIndex , field , receiver , value );
2800+ instrumentation .notifyFieldModification (frame , statementIndex , field , this , receiver , value );
28002801 }
28012802 InterpreterToVM .setFieldObject (value , receiver , field );
28022803 break ;
@@ -2847,7 +2848,7 @@ private int getField(VirtualFrame frame, int top, Field field, int curBCI, int o
28472848 }
28482849
28492850 if (instrumentation != null ) {
2850- instrumentation .notifyFieldAccess (frame , statementIndex , field , receiver );
2851+ instrumentation .notifyFieldAccess (frame , statementIndex , field , this , receiver );
28512852 }
28522853
28532854 int resultAt = mode .isStatic () ? top : (top - 1 );
@@ -2901,14 +2902,14 @@ public String toString() {
29012902 public void notifyFieldModification (VirtualFrame frame , int index , Field field , StaticObject receiver , Object value ) {
29022903 // Notifications are only for Espresso objects
29032904 if (instrumentation != null && (noForeignObjects .isValid () || receiver .isEspressoObject ())) {
2904- instrumentation .notifyFieldModification (frame , index , field , receiver , value );
2905+ instrumentation .notifyFieldModification (frame , index , field , this , receiver , value );
29052906 }
29062907 }
29072908
29082909 public void notifyFieldAccess (VirtualFrame frame , int index , Field field , StaticObject receiver ) {
29092910 // Notifications are only for Espresso objects
29102911 if (instrumentation != null && (noForeignObjects .isValid () || receiver .isEspressoObject ())) {
2911- instrumentation .notifyFieldAccess (frame , index , field , receiver );
2912+ instrumentation .notifyFieldAccess (frame , index , field , this , receiver );
29122913 }
29132914 }
29142915
@@ -2980,7 +2981,7 @@ private static boolean assertionsEnabled() {
29802981 */
29812982 void notifyStatementChange (VirtualFrame frame , int statementIndex , int nextStatementIndex , int targetBci ) {
29822983 assert statementIndex != nextStatementIndex ;
2983- notifyStatementExit (frame , statementIndex );
2984+ notifyStatementExit (frame , statementIndex , StaticObject . NULL );
29842985 setBCI (frame , targetBci );
29852986 notifyStatementEnter (frame , nextStatementIndex );
29862987 }
@@ -2995,20 +2996,26 @@ void notifyStatementResume(VirtualFrame frame, int statementIndex) {
29952996 resumeAt (frame , statementIndex );
29962997 }
29972998
2998- void notifyStatementExit (VirtualFrame frame , int statementIndex ) {
2999+ void notifyStatementExit (VirtualFrame frame , int statementIndex , Object returnValue ) {
29993000 CompilerAsserts .partialEvaluationConstant (statementIndex );
3000- exitAt (frame , statementIndex , StaticObject . NULL );
3001+ exitAt (frame , statementIndex , returnValue );
30013002 }
30023003
30033004 public void notifyEntry (VirtualFrame frame , AbstractInstrumentableBytecodeNode instrumentableNode ) {
30043005 if (context .shouldReportVMEvents () && method .getMethod ().hasActiveHook ()) {
3005- context .reportOnMethodEntry (method , instrumentableNode .getScope (frame , true ));
3006+ context .reportOnMethodEntry (method , instrumentableNode , instrumentableNode .getScope (frame , true ));
30063007 }
30073008 }
30083009
30093010 public void notifyResume (VirtualFrame frame , AbstractInstrumentableBytecodeNode instrumentableNode ) {
30103011 if (context .shouldReportVMEvents () && method .getMethod ().hasActiveHook ()) {
3011- context .reportOnMethodEntry (method , instrumentableNode .getScope (frame , true ));
3012+ context .reportOnMethodEntry (method , instrumentableNode , instrumentableNode .getScope (frame , true ));
3013+ }
3014+ }
3015+
3016+ public void notifyExit (@ SuppressWarnings ("unused" ) VirtualFrame frame , AbstractInstrumentableBytecodeNode instrumentableNode , Object returnValue ) {
3017+ if (context .shouldReportVMEvents () && method .getMethod ().hasActiveHook ()) {
3018+ context .reportOnMethodReturn (method , instrumentableNode , returnValue );
30123019 }
30133020 }
30143021
@@ -3028,17 +3035,17 @@ void notifyYieldAt(VirtualFrame frame, Object o, int statementIndex) {
30283035 probeNode .onYield (frame , o );
30293036 }
30303037
3031- public void notifyFieldModification (VirtualFrame frame , int index , Field field , StaticObject receiver , Object value ) {
3038+ public void notifyFieldModification (VirtualFrame frame , int index , Field field , AbstractInstrumentableBytecodeNode instrumentableNode , StaticObject receiver , Object value ) {
30323039 if (context .shouldReportVMEvents () && field .hasActiveBreakpoint ()) {
3033- if (context .reportOnFieldModification (field , receiver , value )) {
3040+ if (context .reportOnFieldModification (field , instrumentableNode , receiver , value )) {
30343041 enterAt (frame , index );
30353042 }
30363043 }
30373044 }
30383045
3039- public void notifyFieldAccess (VirtualFrame frame , int index , Field field , StaticObject receiver ) {
3046+ public void notifyFieldAccess (VirtualFrame frame , int index , Field field , AbstractInstrumentableBytecodeNode instrumentableNode , StaticObject receiver ) {
30403047 if (context .shouldReportVMEvents () && field .hasActiveBreakpoint ()) {
3041- if (context .reportOnFieldAccess (field , receiver )) {
3048+ if (context .reportOnFieldAccess (field , instrumentableNode , receiver )) {
30423049 enterAt (frame , index );
30433050 }
30443051 }
0 commit comments