Java objects designed as Oop-klass__java

Source: Internet
Author: User

Hotspot in the source code why the Java object is designed to oop-klass this structure. Just to avoid the creation of a virtual function table for each Java object.

Http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/oops/klass.hpp

VTBL is the main feature of polymorphism, if all instances of a class are common to one vtbl? The polymorphism of this implementation will not be problematic
An instance of an object does not have a virtual function table, and the Klass object to which the instance belongs has a virtual function table
The Oop-klass model is designed to reduce the consumption of a virtual function table for each object https://code.google.com/archive/p/strongtalk/wikis/ Vmtypesforsmalltalkobjects.wiki hotspot is using this design method here is the history of this model
This is the Java design concept, where polymorphism relies on dynamic binding, while distribution is static. So Java generates bytecode invokevirtual is very common. Public VTBL should be more profitable.
So ultimately, the call to the method, the traditional stack structure and Java based on the operand stack structure, are all for the function call service. There's no function call, everything's not working.


Learn the JVM good URL: http://www.open-open.com/lib/view/open1352431526366.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.