current position：Home>The JVM's class loading mechanism is fully analyzed, and the nginx practical core knowledge points are downloaded
The JVM's class loading mechanism is fully analyzed, and the nginx practical core knowledge points are downloaded
2021-08-26 11:12:30 【Programmer Ning】
JVM Describe the class data from Class File loaded into memory , And verify the data 、 Transform resolution and initialization , The final form can be JVM Direct use Java type , This is it. JVM Class loading mechanism of .
Class from being loaded into memory , To be unloaded out of memory , It is divided into the following steps ：
Get ready （Preparation）
The whole process of class loading , Including load 、 verification 、 Get ready 、 analysis 、 initialization Several stages .
Loading is the first stage of class loading , In this step JVM The following three things have been completed in accordance with the specification ：
Get the binary byte stream that defines a class by its fully qualified name .
The static storage structure represented by the byte stream is transformed into the runtime data structure of the method area .
Generate a representation of this class in memory java.lang.Class object .
The above requirements are not specific ,JVM The specific implementation and application of are relatively flexible . such as ： Get the binary byte stream of this class , I didn't say where to get , How to get , So there's reading from the compressed package （jar、war、ear）、 Get it from the network （Applet）、 Runtime compute generation （ A dynamic proxy ）. For class loading that is not an array , We can define our own classloader to control how the byte stream is obtained . however , It's different for array classes , Because array classes themselves are not created by class loaders , It is JVM Directly created .
This stage is to ensure Class The information contained in the byte stream of the file matches the current JVM The requirements of , And it doesn't harm JVM Own safety . It can be roughly divided into the following four stages ：
File format validation
Verify that the byte stream matches Class Specification of document format , Can it be JVM Handle . There are more verification points , such as ： Whether to count by magic 0xCAFEBABE start 、 Whether the primary and secondary version number is current JVM Within the scope of 、 Whether constant of constant pool has unsupported constant type 、CONSTANT_Utf8_info Is there any inconsistency in the constant of type UTF8 Encoded data, etc . This stage is based on the binary byte stream for verification , Only this stage of validation passed , Byte stream can enter the method area of memory to store .
This stage is mainly for semantic analysis and verification of class metadata information , Guarantee that there is no non conformity Java Metadata information of language specification . such as ： except java.lang.Object Whether there is a parent of a class other than 、 Does it inherit a class that is not allowed to be inherited 、 Whether the non abstract class implements all the methods required to be implemented in its parent class or interface 、 Whether the parent class's final Fields, etc .
This stage through data flow and control flow analysis , Make sure the program semantics are legal 、 Logical . such as ： Keep the data type consistent when placing and using the operation stack 、 Ensure that the jump instruction does not jump to the bytecode instruction outside the method body 、 To ensure that the type conversion in the method body is effective, etc .
Symbol reference check
This stage is beyond the class itself （ Various symbol references in the constant pool ） Check the match of the information , It happens in analysis In the step , Make sure analysis Can perform normally , such as ： Whether the fully qualified name described by string in symbol reference can find the corresponding class 、 Whether the accessibility of the class field method in the symbol reference can access the current class, etc .
Now is the climax of the spring move of gold, silver and four , A while ago, Xiaobian has been building his own website , And sorted out a full set of **【 First line internet factory Java Core interview question bank + analysis 】： Include Java Basics 、 abnormal 、 aggregate 、 Concurrent programming 、JVM、Spring Family bucket 、MyBatis、Redis、 database 、 middleware MQ、Dubbo、Linux、Tomcat、ZooKeeper、Netty wait **… All have been sorted and uploaded in ** On my Tencent document ： Click here to go to the portal ** And will continue to update … Sure star once .
author[Programmer Ning],Please bring the original link to reprint, thank you.
The sidebar is recommended
- Crazy blessing! Tencent boss's "million JVM learning notes", real topic of Huawei Java interview 2020-2021
- How to implement injection in vuex source code?
- JQuery operation select (value, setting, selected)
- An article disassembles the pyramid architecture behind the gamefi outbreak
- BEM - a front-end CSS naming methodology
- [vue3] encapsulate custom global plug-ins
- Error using swiper plug-in in Vue
- Another ruthless character fell by 40000, which was "more beautiful" than Passat and maiteng, and didn't lose BMW
guess what you like
Huang Lei basks in Zhang Yixing's album, and the relationship between teachers and apprentices is no less than that in the past. Netizens envy Huang Lei
He was cheated by Wang Xiaofei and Li Chengxuan successively. Is an Yixuan a blessed daughter and not a blessed home?
Zhou Shen sang the theme song of the film "summer friends and sunny days" in mainland China. Netizen: endless aftertaste
Pink is Wangyuan online! Back to the peak! The new hairstyle is creamy and sassy
Front end interview daily 3 + 1 - day 858
Spring Webflux tutorial: how to build reactive web applications
[golang] walk into go language lesson 24 TCP high-level operation
August 23, 2021 Daily: less than three years after its establishment, Google dissolved the health department
The female doctor of Southeast University is no less beautiful than the female star. She has been married four times, and her personal experience has been controversial
There are many potential safety hazards in Chinese restaurant. The top of the program recording shed collapses, and the artist will fall down if he is careless
- Anti Mafia storm: He Yun's helpless son, Sun Xing, is destined to be caught by his dry son
- Introduction to flex flexible layout in CSS -- learning notes
- CSS learning notes - Flex layout (Ruan Yifeng tutorial summary)
- Today, let's talk about the arrow function of ES6
- Some thoughts on small program development
- Talk about mobile terminal adaptation
- Unwilling to cooperate with Wang Yibo again, Zhao Liying's fans went on a collective strike and made a public apology in less than a day
- JS function scope, closure, let, const
- Zheng Shuang's 30th birthday is deserted. Chen Jia has been sending blessings for ten years. Is it really just forgetting to make friends?
- Unveil the mystery of ascension
- Asynchronous solution async await
- Analysis and expansion of Vue infinite scroll source code
- Compression webpack plugin first screen loading optimization
- Specific usage of vue3 video play plug-in
- "The story of huiyeji" -- people are always greedy, and fairies should be spotless!
- Installing Vue devtool for chrome and Firefox
- Basic usage of JS object
- Two easy-to-use animation JS that make the page move
- Front end Engineering - scaffold
- Java SQL Server intelligent fixed asset management, back end + front end + mobile end
- Array de duplication problem solution - Nan recognition problem
- New choice for app development: building mobile applications using Vue native
- New gs8 Chengdu auto show announces interior Toyota technology blessing
- Vieira officially terminated his contract and left the team. The national security club sent blessings to him
- Less than 200000 to buy a Ford RV? 2.0T gasoline / diesel power, horizontal bed / longitudinal bed layout can be selected
- How does "heart 4" come to an end? Pinhole was boycotted by the brand, Ma Dong deleted the bad comments, and no one blessed him
- We are fearless in epidemic prevention and control -- pay tribute to the front-line workers of epidemic prevention!
- Front end, netty framework tutorial
- Xiaomi 11 | miui12.5 | android11 solves the problem that the httpcanary certificate cannot be installed
- The wireless charging of SAIC Roewe rx5 plus is so easy to use!
-  typescript
- CSS transform Complete Guide (Second Edition) flight.archives 007
- Ajax foundation - HTTP foundation of interview essential knowledge
- Cloud lesson | explain in detail how Huawei cloud exclusive load balancing charges
- [JS] 10. Closure application (loop processing)
- Left hand IRR, right hand NPV, master the password of getting rich