当前位置:网站首页>Object creation process and object layout
Object creation process and object layout
2022-07-27 22:54:00 【A dream without trace BZY】
One 、 Object creation process
1、 Object to create the underlying source code

The assembly code here is jvm Recognizable bytecode
- 0: Open up a space in the stacking area , Attach the default value of the corresponding type to each member variable ( Semi initialized state )
- 4: Modulation construction method , Assign real values to each member variable
- 7: Bind the object to the reference of the stack
Be careful : Instruction reordering may occur during the execution of the above assembly code ( Disorderly execution ). If it is executed in the final lazy mode of multithreading , This is likely to happen : The first thread obtains the lock , Go to new Object but 4 and 7 Disorderly execution , That is, the object has no real assignment , Then the second thread comes , It is found that the object pointed to by the reference is not empty , Then take this object directly and leave , There's a problem . So it must be added volatile, To prevent disorder in the process of creating objects . This is also DCL( The sluggard model ) Must be added volatile Why . The code is as follows :

边栏推荐
猜你喜欢
随机推荐
Memoirs of three years in junior high school
US officials suggested trump prevent Infineon from acquiring cypress
Another fire broke out in Samsung storage factory!
OPPO Find X2系列发布:3K+120Hz曲面屏,DXO评分第一,顶配版6999元!
NOI 2018 简要题解
Shandong football match
cron 表达式
Quartus:Instantiation of ‘sdram_model_plus‘ failed. The design unit was not found.
PyQt5快速开发与实战 4.10 窗口绘图类控件
Possible causes of index failure
MySQL的B+Tree索引到底是咋回事?聚簇索引到底是如何长高的?
Data warehouse project is never a technical project
Can uniswap integrate sudoswap to open a new prelude to NFT liquidity?
It is said that Intel will adopt TSMC 6nm EUV process next year
格力口罩来了!KN95口罩只要5.5元一个!
PX4模块设计之十三:WorkQueue设计
C language explanation series -- understanding of functions (5) function recursion and iteration
三星存储工厂又发生火灾!
Cy3荧光标记抗体/蛋白试剂盒 (10~100mg标记量)
云计算服务主要安全风险及应对措施








