我是靠谱客的博主 花痴曲奇,最近开发中收集的这篇文章主要介绍java asm methodvisitor 定义局部变量,ASM字节码工程库中MethodVisitor类的visitLocalVariable()方法有什么作用?...,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

I am using ASM (for the first time) in an application to create Java class files. This is for the backend of a compiler I am writing.

I read the relevant parts of the ASM documentation and have a question about stack map frames. ASM says it can automatically compute those frames if the class writer is initialized with the appropriate flags. My question is, does that mean I will not ever have to call the visitLocalVariable() method on the method visitors myself? I am not sure what that method does. The documentation does say that I do not need to call the visitFrame() method if frames are computed automatically, but it is silent on the visitLocalVariable() method.

解决方案

visitLocalVariable() describes or defines the debug information as stored in the LocalVariableTable and LocalVariableTypeTable attributes of a Code attribute. They are not required for normal operation and distinct from the information stored in a StackMapTable.

In other words, unless you want to provide debug information, you never need to call visitLocalVariable(), regardless of whether stack map frames are automatically computed or not.

Note the differences of the information stored within these attributes. LocalVariable[Type]Table stores names and [generic] types of local variables and their scope regarding the source level language. StackMapTable stores type information for local variables and operand stack entries regarding the JVM type system for the byte code verifier.

最后

以上就是花痴曲奇为你收集整理的java asm methodvisitor 定义局部变量,ASM字节码工程库中MethodVisitor类的visitLocalVariable()方法有什么作用?...的全部内容,希望文章能够帮你解决java asm methodvisitor 定义局部变量,ASM字节码工程库中MethodVisitor类的visitLocalVariable()方法有什么作用?...所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部