In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to understand the JIT in the analysis of the principle of clingrootsys. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
All high-level language technologies are realized by front-end translation, source code understanding, and back-end running technology and semantics: the standard process of compile-link-run loop (really understand this three-stage process, no matter how complex or complex the language system is, it will no longer be difficult to characterize it), and its compiler implementation is based on static procedures and functions at the beginning. They are all C language and standard compilation principles tutorials. In both high-level and complex language implementations, process elements are first implemented, and then syntax enhancements are implemented at the front end of the compiler, or encapsulated into class and library-level enhancements. (and really distinguish this, you can sort out a lot of complicated compilation process step by step. Especially the qualitative and implementation principles of complex language systems such as cling. Including its implementation, such as JIT and library-level pme, are very helpful.
What is an interpretation system?
The biggest difference between the interpretation system and the compiler system is that it cooperates with the loop in front and back end (compile-link-run in the principle of standard compilation, in fact, the compile here is more suitable to be called translate so that it can share the same compilation subprocess with other languages without ambiguity). It only takes one piece of code at a time (the unit that generates and executes the code) to run. And rely solely on the back end of the language system itself, often a software system to run, often without link, because it is run-time to complete query, similar components (the third part of this article will talk about the magic of this component). The software system running facilities here are often responsible for other aspects of work-for example, what a virtual machine needs to accomplish may not be as complex as a virtual machine, which is a simple if-case process (this is the prototype of the original scripting language), which is part of the entire language system, so it is interpreted online. Because it is completed in real time at run time in the process of translation and linking, the runtime big VM naturally maintains a favorite environment for all the facilities needed by the software from translation to operation-it is that the entire softwareized language system is hosted by the software, so it is not time-consuming (compared to the compiler system) at the front end, but the runtime code efficiency. On the other hand, the compilation system translates the whole application in advance (it takes a lot of time here), links each module (here it takes a lot of time), relies on the back end-often a thin layer of support only plays the role of hand-passing-and passes it to the machine offline to run, so it's not about the language system. Since the efficiency of machine code execution is 2 to the 8th power (this number is still growing), it is naturally fast. The essence of explaining that the system executes only one code at a time can be achieved by providing an execframe object at the back end in the compiler implementation, so that the language system has the ability to generate a dynamic minimum executable unit, such as a function stack in the call path, and then feed its representative ast node to the back-end execution-that execframe is fine. The most distinct technical feature of the interpretation language is this dynamic execution back-end. It can be seen that it has nothing to do with whether there must be a virtual machine, whether it must generate intermediate code or platform code, or run with it as the ultimate goal. It is an ordinary back-end will "emit function- > feed it to execframe" thing, compiler-free link-free, the back-end directly run the code (usually run the back-end can directly identify the intermediate code) things. We call the above interpretation system the general interpretation system. What fascinates us is often the JIT-style interpretation system. In fact, it is the interpretation system of the ordinary interpretation system after adding "taking the platform code as the translation target and running target". Here is a detailed description:
Jit, what is it?
What's so special about JIT? you still have to relate to the standard three-stage compilation process, that is, translate- > link- > run, jit is also known as jitcompiler, jit interpter, then jit, as the name suggests, jitcompiler=jit translator, is a language, so this is not its feature, and we immediately found that it has jit interpter, if we have mentioned the interpretation so far. The compiler system and the three major JIT language systems, the name of this new thing proves that it belongs to a similar interpretation system. Maybe you can add another item to the name, jit=jit to native. The above explains the principle of ordinary interpter, while jit-based interpter, in addition to simulating the minimum unit compilation and execution mechanism at the back end of an ordinary interpretation system (or it is similar to the TCC compilation process and looks like an interpreter), it is also a little special, that is, it can implement compile and connect without time for platform code, whether it is RAW CPP source code or binary DLL symbols. And runtime find symbols directly, both of which are why jit behaves like an interpreter. It can be seen that JIT does not bring anything new, in principle, Jit just turns on something that is generated to native code and decodes and executes the code for the target at the same time, and nothing else. It is the juxtaposition of the traditional interpretation set. In fact, it does not destroy the appearance of the compilation principle. It is still a complete language system, but in flow it can be juxtaposed with the interpreted language, switching to the JIT suite by turning on JIT (again, jit represents the entire JIT language system, including both front and back ends, and needs to be understood in a three-stage environment).
Jit in Cling
Cling is based on clang+llvm, and its main meaning is its jit interpter mechanism, that is, the interpretation language + aims at platform code platform symbols and exists as a "special" interpreter: that is, the back end of Cling jit can be jit to native,emit native function, and its AST can be fed to the operator by NODE. In fact, JIT is not limited to this function, cling depends on jit can call into native libs without binding, is the function of JIT itself (of course, this needs to be compiled into binary in advance to retain the symbols needed by JIT, rdynamic causes symbols to be exported even though this is not a lib, it Keep symbols for JIT resolution these DLL are symbol resolution-level dynamic loadable components, supported by the operating system DLL implementation). This component is exempt from link. Because components are link at run time. By getting symbols from DLL, you can eliminate the need for compile- > tranlate. So this does not deviate from the product appearance scope of cling jit as an interpretation system. So, this DLL-oriented feature, in a sense, cling jit regards DLL as a raw cpp code component (for the time being, you can think of this and the next component as something like a script source file to understand) and "source code" (while the ordinary interpreter faces the interpretation unit, interpretation module, is the real visual source component, JIT only works in the binary export symbol layer and can do CPP source and binary mixed programming). Because it regards the platform DLL as a component, it can dynamically and continuously load symbols and run from the "DLL source code" (DLL where the source code is not actually visible, here is where the symbol is similar to the "source code" in the eyes of llvm jit, it is regarded as a component). In this sense, generally speaking, JIT is just a more advanced "DLL" mechanism, so that it can also directly treat the library as a developer with component features. This is later on for more components that will be covered in part 3.
The above content is how to understand JIT in the analysis of clingrootsys principles. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.