为什么 JSR/RET 不推荐使用 Java 字节码? [英] Why are JSR/RET deprecated Java bytecode?

查看:34
本文介绍了为什么 JSR/RET 不推荐使用 Java 字节码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道为什么 JSR/RET 字节码对在 Java 6 中被弃用了吗?

Does anyone know why the JSR/RET bytecode pair is deprecated in Java 6?

我在网上找到的唯一有意义的解释是,它们使运行时的代码分析变得越来越难执行.有人知道其他原因吗?

The only meaningful explanation I found on the net was that they made code analysis by the runtime harder and slower to perform. Does anyone know another reason?

推荐答案

JSR 和 RET 使字节码验证比其他方式更困难,因为放宽了一些正常的字节码约束(例如在JSR 的入口).好处非常小(在某些情况下可能会使用更小的方法),并且验证器在处理奇怪的 JSR/RET 模式(以及潜在的安全漏洞,以及与完整验证相关的运行时成本)方面的持续困难使其成为一个无用的功能继续拥有.

JSR and RET make bytecode verification a lot more difficult than it might otherwise be due to the relaxation of some normal bytecode constraints (such as having a consistent stack shape on entry to a JSR). The upside is very minor (potentially slightly smaller methods in some cases) and the continuing difficulties in the verifier dealing with odd JSR/RET patterns (and potential security vulnerabilities, and the associated runtime cost of full verification) make it a non-useful feature to continue having.

堆栈映射和由于数据而启用的轻量级验证器在类加载期间实现了巨大的性能提升,同时又不牺牲安全性.

Stack maps and the lighter-weight verifier that is enabled as a result of the data are a big performance win during class loading for no sacrifice in safety.

这篇关于为什么 JSR/RET 不推荐使用 Java 字节码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆