简体   繁体   中英

How to reference “this” object in java bytecode

I am making a class in Java bytecode. I need to know how to reference fields in this object. First I need to know how to reference the "this" object as if I were accessing this.var1 from class TestClass . I know how to access fields in other objects, but not from the same object that I am executing from.

The this pointer is implicit in every method call, as a hidden first parameter. In all non-static methods, you can push it onto the stack with aload_0 .

More details here , or as Holger points out, in the JVM spec itself .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM