Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于try-catch的指令优化 #113

Open
GoogleCodeExporter opened this issue Mar 15, 2015 · 0 comments
Open

关于try-catch的指令优化 #113

GoogleCodeExporter opened this issue Mar 15, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

/    0    0:aload_1         
    //    1    1:ifnull          8
    // try 4 8 handler(s) 9
    //    2    4:aload_1         
    //    3    5:invokevirtual   #237 <Method void HttpURLConnection.disconnect()>
    //    4    8:return          
    // catch Exception
    //    5    9:astore_2        
    //    6   10:aload_2         
    //    7   11:invokevirtual   #111 <Method void Exception.printStackTrace()>
    //    8   14:goto            8

优化成下面的jad就可以成功反编译了
    //    0    0:aload_1         
    //    1    1:ifnonnull       16
    // try 4 8 handler(s) 11
    //    2    4:aload_1         
    //    3    5:invokevirtual   #16  <Method void HttpURLConnection.disconnect()>
    //    4    8:goto            16
    // catch Exception
    //    5   11:astore_2        
    //    6   12:aload_2         
    //    7   13:invokevirtual   #21  <Method void Exception.printStackTrace()>
    //    8   16:return   

即由原来的
try
{somecode
}
L0:
somecode
return
catch
{somecode
}
goto L0
优化成
try
{somecode
}
goto L0
catch
{somecode
}

L0:
somecode
return
也就是说try和catch是连在一起,中间没有代码

Original issue reported on code.google.com by [email protected] on 19 Mar 2012 at 6:47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant