You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Gregory Shimansky (JIRA)" <ji...@apache.org> on 2006/12/12 17:41:23 UTC

[jira] Resolved: (HARMONY-2200) [drlvm][jvmti] VM crashes running classes instrumented by JVMTI profiler

     [ http://issues.apache.org/jira/browse/HARMONY-2200?page=all ]

Gregory Shimansky resolved HARMONY-2200.
----------------------------------------

    Resolution: Fixed

It looks like the test now produces VerifyError. It may be related to the recent changes in class loader, so I decided to commit the patch since it is likely a separate problem, not related to registering natives.

Uncaught exception in main:
java.lang.VerifyError: (class: mytests/HelloWorld, method: <init>()V) Uninitialized reference usage
        at java.lang.VMClassRegistry.defineClass(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:70)
        at java.net.URLClassLoader.findClassImpl(URLClassLoader.java:1137)
        at java.net.URLClassLoader$4.run(URLClassLoader.java:619)
        at java.net.URLClassLoader$4.run(URLClassLoader.java)
        at java.security.AccessController.doPrivilegedImpl(Unknown Source)
        at java.security.AccessController.doPrivileged(Unknown Source)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:617)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader$SystemClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)

Patch applied 486222. Please check that it was applied as expected, I had to do some merging with the current code.

> [drlvm][jvmti] VM crashes running classes instrumented by JVMTI profiler
> ------------------------------------------------------------------------
>
>                 Key: HARMONY-2200
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2200
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM, App-Oriented Bug Reports
>         Environment: Windows/ia32, Linux ia/32
>            Reporter: Ivan Popov
>         Assigned To: Gregory Shimansky
>         Attachments: H-2200-RegisterNatives-partial-fix.patch, ThreadEventsTest.zip
>
>
> TPTP profiler cannot profile Java applications running on DRLVM in JIT mode (r474672+ HARMONY-2172). VM is crashed while executing dynamically instrumented class. Here is typical stack trace of the crash on Windows:
> 	0001f8a4()	
>  	ntdll.dll!7c91056d() 	
> >	harmonyvm.dll!free(void * pBlock=0x025ba3f0)  Line 103	C
>  	harmonyvm.dll!GcFrame::~GcFrame()  Line 98 + 0x6	C++
>  	harmonyvm.dll!compile_jit_a_method(Method * method=0x20770fd0)  Line 854 + 0x11	C++
>  	harmonyvm.dll!vm_invoke_native_array_stub(unsigned int * args=, int sz=, void * f=)  Line 77	C++
> If VM is started in -Xint mode with profiling agent, then it successfully run instrumented class. Also, if statically instrumented class is loaded into VM in JIT mode without profiling agent, it works fine. With RI this also works fine in all modes. The crash occurs only in DRLVM in JIT mode if class is dynamically instrumented by JVMTI agent in CLASS_FILE_LOAD_HOOK.
> Here is test output:
> =========================================================================================
> 1. run initial class
> HELLO.world
> =========================================================================================
> 2. run instrumented class
> HELLO.world
> DLL MethodEnterHandler: Invoked=0, id=70057
> DLL MethodEnterHandler: Invoked=0, id=70056
> DLL MethodLeaveHandler: id=70056
> DLL MethodEnterHandler: Invoked=0, id=70058
> DLL MethodLeaveHandler: id=70058
> DLL MethodLeaveHandler: id=70057
> =========================================================================================
> 3. run initial class WITH agent in -Xint mode
> HELLO.world
> Agent_OnLoad: proxy
> RegisterNativeCallbacks done
> Replacing class: mytests/HelloWorld
> Loaded class from file: 1075
> MethodEnterHandler: Invoked=0, id=70057
> MethodEnterHandler: Invoked=0, id=70056
> MethodLeaveHandler: id=70056
> MethodEnterHandler: Invoked=0, id=70058
> MethodLeaveHandler: id=70058
> MethodLeaveHandler: id=70057
> =========================================================================================
> 4. run initial class WITH agent
> Agent_OnLoad: proxy
> RegisterNativeCallbacks done
> Replacing class: mytests/HelloWorld
> Loaded class from file: 1075
> MethodEnterHandler: Invoked=184, id=0
> MethodEnterHandler: Invoked=72, id=1308544
> MethodLeaveHandler: id=544673756
> An unhandled error (4) has occurred.
> HyGeneric_Signal_Number=00000004
> ExceptionCode=c0000005
> ExceptionAddress=0001F8A4
> ContextFlags=0001003f
> Handler1=00401010
> Handler2=11105CE0
> InaccessibleAddress=0001F8A4
> EDI=0013F99C
> ESI=00000000
> EAX=00000021
> EBX=00000056
> ECX=01F91695
> EDX=01F9BD48
> EIP=0001F8A4
> ESP=0013F894
> EBP=03DB0000
> Module=
> Module_base_address=00010000
> Offset_in_DLL=0000f8a4
> =========================================================================================
> While instrumenting class profiler adds static fields to this class and calls to native methods of the proxy class which gathers statistics. I included disassembled (javap) sources to test archive to see the difference. Here is typical instrumentation of each method entry:
>    0:	getstatic	#41; //Field sm_bAlreadyInvoked70056:Z
>    3:	ldc_w	#62; //int 70056
>    6:	invokestatic	#53; //Method org/eclipse/tptp/martini/CGProxy.MethodEnter:(ZI)V
> Instrumented class invokes proxy method MethodEnter:() passing value of a static boolean field and integer constant, which is used as method ID for this method. Test output shows that in JIT+agent mode these arguments are passed incorrectly:
> JIT mode (no agent):
> DLL MethodEnterHandler: Invoked=0, id=70057
> DLL MethodEnterHandler: Invoked=0, id=70056
> DLL MethodLeaveHandler: id=70056
> -Xint+agent mode:
> MethodEnterHandler: Invoked=0, id=70057
> MethodEnterHandler: Invoked=0, id=70056
> MethodLeaveHandler: id=70056
> JIT+agent mode:
> MethodEnterHandler: Invoked=184, id=0
> MethodEnterHandler: Invoked=72, id=1308544
> MethodLeaveHandler: id=544673756
> It looks like M2N frame is formed incorrectly. This may be root cause of the crash.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira