United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6216027 JVMTI Spec: Support early return from methods
JDK-6216027 : JVMTI Spec: Support early return from methods

Details
Type:
Enhancement
Submit Date:
2005-01-11
Status:
Resolved
Updated Date:
2011-09-22
Project Name:
JDK
Resolved Date:
2005-05-18
Component:
hotspot
OS:
generic
Sub-Component:
jvmti
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Relates:
Relates:
Relates:

Sub Tasks

Description
We need the following function to be implemented in JVM TI to support debugger:
      jvmtiError EarlyReturnInt(jvmtiEnv* env, jthread thr, jvalue value);
Please, see the corresponding Debugger CR:
   6175634: Allow early return from methods

Short description:
  - Simulate a return from the topmost stack frame of thread's stack,
    returning 'value' if needed.
  - 'value' must be assignment compatible with the return type of the method
     for the topmost frame.
  - Locks acquired by the topmost frame are released.
  - Finally blocks are not executed.
  - The specified thread must be the current thread or must be suspended.
  - The current method must be non-native Java programming language methods
  - JVM TI events like MethodExit are generated as in usual return.
  - This function may only be called during the live phase.
  - The set of the return codes is the same as for PopFrame plus this one:
      JVMTI_ERROR_TYPE_MISMATCH - If the top-frame function return type is not
                                  an appropriate type for the function used.

###@###.### 2005-04-11 20:12:33 GMT
###@###.### 2005-04-26 07:01:51 GMT

                                    

Comments
EVALUATION

Decided to add the following ForceEarlyReturn JVMTI functions:

jvmtiError ForceEarlyReturnObject(jvmtiEnv* env, jthread thread, jobject value);
jvmtiError ForceEarlyReturnInt(jvmtiEnv* env, jthread thread, jint value);
jvmtiError ForceEarlyReturnLong(jvmtiEnv* env, jthread thread, jlong value);
jvmtiError ForceEarlyReturnFloat(jvmtiEnv* env, jthread thread, jfloat value);
jvmtiError ForceEarlyReturnDouble(jvmtiEnv* env, jthread thread, jdouble value);
jvmtiError ForceEarlyReturnVoid(jvmtiEnv* env, jthread thread);

For details, please, see the description.


###@###.### 2005-04-11 20:01:04 GMT
                                     
2005-04-11
SUGGESTED FIX

6 new functions are added to JVMTI Spec:
jvmtiError ForceEarlyReturnObject(jvmtiEnv* env, jthread thread, jobject value);
jvmtiError ForceEarlyReturnInt(jvmtiEnv* env, jthread thread, jint value);
jvmtiError ForceEarlyReturnLong(jvmtiEnv* env, jthread thread, jlong value);
jvmtiError ForceEarlyReturnFloat(jvmtiEnv* env, jthread thread, jfloat value);
jvmtiError ForceEarlyReturnDouble(jvmtiEnv* env, jthread thread, jdouble value);
jvmtiError ForceEarlyReturnVoid(jvmtiEnv* env, jthread thread);

 These functions allow an agent to force a method to return at any point during its execution. The method which will return early is referred to as the called method. The called method is the current method (as defined by the  Frames section in the Java Virtual Machine Specification) for the specified thread at the time the function is called.

The specified thread must be the current thread or must be suspended. The return occurs when the thread is resumed. Between calling one of these functions and resuming the thread, the state of the stack is undefined.

No further instructions are executed in the called method. Specifically, finally blocks are not executed. Note: this can cause inconsistent states in the application.

The JVMTI events like ExitEvent are generated as in usual return.

A lock acquired by calling the called method (if it is a synchronized method) and locks acquired by entering synchronized blocks within the called method are released. Note: this does not apply to native locks or java.util.concurrent.locks locks.

The called method must be a non-native Java programming language method. Forcing return on a thread with only one frame on the stack causes the thread to exit when resumed.
###@###.### 2005-04-11 20:08:55 GMT
###@###.### 2005-04-26 07:04:34 GMT
                                     
2005-04-11



Hardware and Software, Engineered to Work Together