You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vera Petrashkova (JIRA)" <ji...@apache.org> on 2007/05/30 15:55:16 UTC

[jira] Updated: (HARMONY-3999) drlvm][jit][jvmti] Jitrino does not send ExceptionCatch event

     [ https://issues.apache.org/jira/browse/HARMONY-3999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vera Petrashkova updated HARMONY-3999:
--------------------------------------

    Attachment: ExcpCatch.zip

Source code, class file and library

> drlvm][jit][jvmti] Jitrino does not send ExceptionCatch event
> -------------------------------------------------------------
>
>                 Key: HARMONY-3999
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3999
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: ExcpCatch.zip
>
>
> According to J2SE JVMTI specification
> Exception catch events are generated whenever a thrown exception is caught. 
> If the exception is caught in a Java programming language method, 
> the event is generated when the catch clause is reached.
> But VM does not send Exception catch event in jit mode.
> The following test demonstrates this issue.
> It passes on RI and on DRLVM interpreter, but it fails on Jitrino.
> --------------------EC.java----------------------
> public class EC {
>     public static void main(String args[]) {
>         String s = null;
>         try {
>             System.err.println(s.length());
>         } catch (NullPointerException e ) {
>             System.err.println("catch: " + e);
>             e.printStackTrace(System.err);
>         }
>     }
> }
> -------------------EC.cpp---------------------------
> #include "evnts_.h"
> #include "utils.h"
> static bool test = false;
> static long counter = 0;
> void EC()
> {
> }
> JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
> {
>     Callbacks CB;
>     cb_exccatch;
>     cb_death;
>     AGENT_FOR_EVENTS_TESTS_PART_I; /* evnts_.h */
>     jvmtiEvent events[] = { JVMTI_EVENT_EXCEPTION_CATCH, JVMTI_EVENT_VM_DEATH };
>     AGENT_FOR_EVENTS_TESTS_PART_II;
>     fprintf(stderr, "\n-------------test EC is started\n{\n");
>     fflush(stderr);
>     return JNI_OK;
> }
> void JNICALL callbackExceptionCatch(prms_EXCPT_CATCH)
> {
>     char* name = NULL;
>     char* signature = NULL;
>     char* generic = NULL;
>     jvmtiError result;
>     result = jvmti_env->GetMethodName(method, &name, &signature, &generic);
>     if (result != JVMTI_ERROR_NONE) return;
>     counter++;
> 	fprintf(stderr,"\tMethod name: %s  counter: %d\n", name, counter);
> 	if (strcmp(name, "main")) return;	
>     fprintf(stderr, "\tException (prms) jvmti_env      is %p\n", jvmti_env);
>     fprintf(stderr, "\tException (prms) jni_env        is %p\n", jni_env);
>     fprintf(stderr, "\tException (prms) thread         is %p\n", thread);
>     fprintf(stderr, "\tException (prms) method         is %p\n", method);
>     fprintf(stderr, "\tException (prms) location       is %lld\n", location);
>     fprintf(stderr, "\tException (prms) exception      is %p\n", exception);
>     fflush(stderr);
>     test = true;
> }
> void JNICALL callbackVMDeath(prms_VMDEATH)
> {
>     fprintf(stderr, "\n\tTest of event ExceptionCatch   : ");
>     if ((counter > 0) && (test))
>         fprintf(stderr, " passed %d %d \n", counter, test);
>     else
>         fprintf(stderr, " failed %d %d \n", counter, test);
>     fprintf(stderr, "\n} --------------test EC is finished\n");
>     fflush(stderr);
> }
> --------------------------------------
> Additional source files and library are in attachment.
> Run test
> java -showversion -cp . -agentlib:EC EC
> and
> java -showversion -Xint -cp . -agentlib:EC EC
> Output on RI
> =============
> -------------test EC is started
> {
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
>         Method name: loadClass  counter: 1
>         Method name: findClass  counter: 2
>         Method name: loadClass  counter: 3
>         Method name: main  counter: 4
>         Exception (prms) jvmti_env      is 00036EE0
>         Exception (prms) jni_env        is 00037A20
>         Exception (prms) thread         is 00A877E0
>         Exception (prms) method         is 00034969
>         Exception (prms) location       is 15
>         Exception (prms) exception      is 00A877E4
> catch: java.lang.NullPointerException
> java.lang.NullPointerException
>         at EC.main(EC.java:6)
>         Test of event ExceptionCatch   :  passed 4 1
> } --------------test EC is finished
> Ouput on DRLVM interpreter
> =====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r542118, (May 28 2007), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> -------------test EC is started
> {
>         Method name: main  counter: 1
>         Exception (prms) jvmti_env      is 011A4B98
>         Exception (prms) jni_env        is 011A2D60
>         Exception (prms) thread         is 01D22768
>         Exception (prms) method         is 01D67944
>         Exception (prms) location       is 15
>         Exception (prms) exception      is 01D22764
> catch: java.lang.NullPointerException
> java.lang.NullPointerException
>         at EC.main(EC.java:6)
>         Test of event ExceptionCatch   :  passed 1 1
> } --------------test EC is finished
> Ouput on DRLVM jitrino
> ===================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r542118, (May 28 2007), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> -------------test EC is started
> {
> catch: java.lang.NullPointerException
> java.lang.NullPointerException
>         at EC.main(EC.java:6)
>         Test of event ExceptionCatch   :  failed 0 0
> } --------------test EC is finished
> This bug causes the failure of the test
> vm.jvmti.events.ExceptionCatch.ExceptionCatch0101.ExceptionCatch0101
> from  DRLVM Validation Test suite (http://issues.apache.org/jira/browse/HARMONY-3206)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.