stack frame analysis for small programs

Source: Internet
Author: User


A function call another word denotes a process. A procedure call involves passing data and control from one part of the code to another. In addition, it must allocate space for local variables of the process at the time of entry and release the space when it is launched. While data passing, the allocation and release of local variables are implemented by manipulating the program stack.

A stack frame is also called a process activity record, which is a data structure used by the compiler to implement a procedure function call.

The following code, in the main function, does not call the function that causes the virtual machine to restart, but why does the virtual machine restart?

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/82/95/wKioL1dcGBCwhCUDAABO_E6JQVY563.jpg-wh_500x0-wm_3 -wmp_4-s_3338931795.jpg "title=" 36020160611214902752.jpg "alt=" Wkiol1dcgbcwhcudaabo_e6jqvy563.jpg-wh_50 "/>

This reason is related to the stack frame, the following diagram is the resolution of this program

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/82/96/wKiom1dcHDmCQ6gIAAEYouHTt5A551.png-wh_500x0-wm_3 -wmp_4-s_1368994945.png "title=" Untitled. png "alt=" wkiom1dchdmcq6giaaeyouhtt5a551.png-wh_50 "/>

with the knowledge of the stack frame, you can also use B, but you can change the value of the B variable.

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/82/95/wKioL1dcJYDCaZq8AAAwPlaoCqo236.jpg-wh_500x0-wm_3 -wmp_4-s_3250514553.jpg "title=" 36020160611224739637.jpg "alt=" Wkiol1dcjydcazq8aaawplaocqo236.jpg-wh_50 "/>

Here are the results:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/82/95/wKioL1dcJn_yon1eAAAN_Kx3QYo171.jpg "title=" 36020160611225036008.jpg "alt=" Wkiol1dcjn_yon1eaaan_kx3qyo171.jpg "/>

stack frame analysis for small programs

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.