[ https://issues.apache.org/jira/browse/HARMONY-3755?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gregory Shimansky updated HARMONY-3755:
---------------------------------------
Summary: [drlvm][verifier] VM allows to use jsr instruction to call subroutine recursively
(was: [drlvm] VM allows to use jsr instruction to call subroutine recursively)
> [drlvm][verifier] VM allows to use jsr instruction to call subroutine recursively
> ---------------------------------------------------------------------------------
>
> Key: HARMONY-3755
> URL: https://issues.apache.org/jira/browse/HARMONY-3755
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Environment: Windows and Linux
> Reporter: Vera Petrashkova
> Attachments: jsrTest.zip
>
>
> According to J2SE VM specification
> no jsr and jsr_w instruction may be used recursively to call subroutine.
> But VM does not reject class which calls subroutine recursively.
> To reproduce this bug run the following test. It uses synthetic classes subroutineTest
and finallyTest created from jasmin source code
> -------------jsrTest.java------------------------
> public class jsrTest {
> public static void main(String[] args) {
> try {
> Class.forName("finallyTest");
> System.out.println("finallyTest failed: expected VerifyError was not thrown");
> } catch (VerifyError e) {
> System.out.println("finallyTest passed: " + e);
> } catch (Throwable e) {
> System.out.println("finallyTest failed: unexpected error " + e);
> }
> try {
> Class.forName("subroutineTest");
> System.out.println("subroutineTest failed: expected VerifyError was not thrown");
> } catch (VerifyError e) {
> System.out.println("subroutineTest passed: " + e);
> } catch (Throwable e) {
> System.out.println("subroutineTest failed: unexpected error " + e);
> }
> }
> }
> ------------finallyTest.jj-------------------
> .class public finallyTest
> .super java/lang/Object
> ;
> ; standard initializer
> .method public <init>()V
> aload_0
> invokespecial java/lang/Object/<init>()V
> return
> .end method
> ;
> ; test method
> .method public static test()V
> .limit stack 2
> .limit locals 2
> jsr First
> return
> First:
> astore_1
> sipush 111
> sipush 111
> if_icmpeq Second
> ret 1
> Second:
> jsr First ; recursively call a subroutine
> return
> .end method
> ------------------subroutineTest.jj--------------------
> .class public subroutineTest
> .super java/lang/Object
> ;
> ; standard initializer
> .method public <init>()V
> aload_0
> invokespecial java/lang/Object/<init>()V
> return
> .end method
> ;
> ; test method
> .method test()V
> .limit locals 3
> .limit stack 2
> jsr First
> return
> First:
> astore_2
> jsr First ; recursively call a subroutine
> ret 2
> .end method
> --------------------------------------------------------------
> Create subroutineTest and finallyTest classes using jasmin.jar or use classes from attachment
> java -jar jasmin.jar finallyTest.jj
> java -jar jasmin.jar subroutineTest.jj
> Run jsrTest
> Java
> Output on RI is:
> ----------------------
> 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)
> finallyTest passed: java.lang.VerifyError: (class: finallyTest, method: test signature:
()V) Recursive call to jsr entry
> subroutineTest passed: java.lang.VerifyError: (class: subroutineTest, method: test signature:
()V) Recursive call to jsr entry
> Output on Harmony is:
> --------------------------------
> 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 = r531681, (Apr 24 2007), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> finallyTest failed: expected VerifyError was not thrown
> subroutineTest failed: expected VerifyError was not thrown
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|