Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How are statements in high-level languages implemented in assembly

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how the sentences in the high-level language are realized in the assembly". In the daily operation, I believe that many people have doubts about how the statements in the high-level language are realized in the assembly. The editor consulted all kinds of materials and sorted out the simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about how the statements in the high-level language are realized in the assembly. Next, please follow the editor to study!

Assembly language

Assembly language consists of statements written with mnemonics such as ADD, MOV, SUB, and CALL. The relationship between assembly language and machine language is one to one (one-to-one): each assembly language instruction corresponds to one machine language instruction.

Because assembly language and machine language are bound, and different machine languages are different, assembly language is not portable, while high-level language is portable, which is one reason why people use more high-level languages to develop applications.

Jump instruction

Jump instruction can be said to be the core of the realization of high-level language conditions, because all condition judgments or loop statements are realized through jump instructions at the bottom.

In assembly language, we can jump sentences by setting labels, such as if judgment in high-level language. In assembly language, we can do this.

In fact, the same is true for loop statements, which are also implemented through jump instructions.

Inside the loop, EAX is a proxy (substitute) for val1, and references to val1 must go through EAX. The use of JNL means that val1 and val2 are signed integers.

The realization of logical judgment is also realized through jump instructions, as follows.

From the above example, we can see that no matter how complex the logic is, whether it is loop or conditional judgment, in the underlying assembly layer, it is actually achieved through jump instructions.

Register

We all know that cpu itself is only used for computing, it does not save data, but because cpu operation speed is too fast, higher than memory reading speed, so cpu designed registers to save temporary data, and read them very efficiently, greatly improving the processing speed of cpu.

When our high-level language is converted into assembly language, one statement may become multiple statements, so we often say that the statement of c language is not atomic, because it may correspond to multiple statements at the assembly level. when multiple statements are parallel, there will be the problem of execution order, which is also the reason for concurrency.

Summary

Both instructions and data are stored and read through registers. It is with registers that we can easily accumulate data, change addresses, and search data.

We often say that computers can only recognize 01 binary numbers, which means that cpu stores and converts binary codes, and when it comes to a specific binary, it corresponds to a specific operation.

At this point, the study of "how the statements in the high-level language are implemented in the assembly" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report