Guess about the implementation of the Java runtime

xiaoxiao2021-03-06  92

Today, when I saw Mr. Zheng Zhiyuan, "Java runtime, the implementation of the polymorphism", suddenly there is an idea, I guess the JVM when instanting a class, is not in an instance to record this object with a string variable similar to String. Class name, or use a pointer to reference this class in the stack. This way, when you locate a method, it can find this class through this variable or reference, and then find this method via REFLECTION. If it does not find it, it will continue to find the base class of this class. This interpretation method and the polymorphism of the interface are ok, but it is specifically implemented, but also to see the implementation details of JVM. I haven't studied JVM yet, and I have a guess. Haha.

转载请注明原文地址:https://www.9cbs.com/read-105469.html

New Post(0)