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 to understand pme in the Analysis of clingrootsys principle

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

How to understand the pme in the analysis of the principle of clingrootsys? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Dynamically typed languages in dynamic languages

It is generally mistaken for that a dynamic language is an interpretive language. Because the interpretation system can execute code dynamically also means that it is classified as a dynamic language. But in fact, the most common technical form of dynamic language now is a dynamic language called "dynamic type", which tends to rely on the front end rather than the back end. The result is that static language systems and classic compile-> run systems can also produce "dynamic languages". For example, in the compiler implementation, the type system can actually propose meta-types, encapsulate the basic information of the types, and then feed the back-end in the form of a meta-type / object-generated subtype / sub-object tree-a data structure that is a little more complex than the original, and then other processes remain unchanged and fed to the backend. The type information of the runtime can still be retained or even dynamically evolved during the runtime. Isn't this a dynamic language? (this logic can also work at the library level and tool chain level, that is, outside the language system implementation, such as pme, which can be implemented as long as binding-while binding is actually a front-end translation in the sense of another compiler, and it is ready-made at execution time, such as the dictionary generated by qtmoc for the qtcpp source pattern, which is why binding can also generate a dynamic language system, and the back-end execution can be static. But it is mainly fed to the already included type system-meta-type system such as PEM, which will keep the type system until run time.) you may be confused about all these aspects of the compilation process, but in fact all the technology in it is the same as the traditional static compilation language system-the simplest compilation principle you have ever learned. And compile front end, explain front end, binding, these three words all include translation. The object code can be either a platform code or an intermediate code for operation. None of this can change that all language systems implemented with compilation principles share the same product appearance (all have their own parts, but in different forms). Go back to the words at the beginning of the first article in the series and use them to read through the characterization of all complex language systems so that you don't get confused.

Pme simulates dynamic language features for static languages

Pme, poperty,method,event, is an implementation of the reflection mechanism, which actually adds a new language on top of the static type, and the library-level runtime can query the entire active object tree, and the scene diagram and member attributes of each class at runtime. PME is a general implementation of components. Moreover, this pme mechanism with object io features makes it possible for the runtime to change the program logic of objectlvl through an external editor. Persist member attributes to carriers such as XML with the help of the union persistence of PME components. You can load it next time you need it (only member data in the code). Only in the environment of cling/rootsys, when pme cooperates with JIT, can this dynamics be brought into full play, and DLL loading finally becomes a function of the language system through JIT. Instead of staying as a mechanism of the operating system, the pme module can be loaded dynamically, which is reflected in the development that the logic in the pme DLL body is fixed. The changeable program logic is the part outside the DLL. The custom script part and your APP logic part can be JIT CPP source code (here, except for the member data in the code supported by PME, the whole code is durable, The interpreted and JITted C++ shares the same virtual memory space as the app itsel. ). Does it feel like a script? Until now, cling/rootsys began to have the ability to simulate both scripting language interpretation and dynamic loading, which is amazing.

Pme Dictionary Generation in Cling/rootsys

If cling call into raw dll relies on symbols and is supported by JIT and operating system DLL mechanisms, while call into PME modules rely on dictionary information without symbols, dynamically loading pme components and discovering OBJ trees in components requires PME support, so it needs to be self-implemented. Why is that? in fact, the most important thing is that jit call into native libs just makes the compliance visible. Loading resources in DLL is a normal native langsys function, so llvm can also be used as a pass from the execution engine to OS. But the pme of its rootsys libs is library-level, and cling code can be call into native libs directly, but not call into rootsys libs, because they have pme dicts as bindings (they cannot be made visible by loading directly and must be rootcling by encapsulation of cling). Therefore, in addition to jit and pme, cling needs a manual or automatic addition of dictionary binding information to make pme module the same as normal raw c dll (the kind of module that has been parsed into simple symbols and can be loaded directly). Such as a manual / automatic DICT generator. Generate it to raw cpp code and pass it to LLVM backend. With these ideas in mind, let's move on to the counterpart in cling/rootsys, its support for the pme module-aclic. ACliC is just a tool for forming pme modules into dll with pme dictionaries. Cling is faster building compiled code, but ACLiC can reuse it. Cling generating JIT code is a class interpreter effect produced by high-speed compilers, while aclic can take advantage of it at the library-level reflection level. As mentioned earlier, to transform raw cpp into a new language system similar to qtcpp, all modules must be encapsulated in a dictionary, a process also known as binding. Rootsys is such a new language system. In implementation, aliac is added to rootcling in the form of patch cling. Therefore, the .L + + way to generate so files is only used to generate dict modules for pme modules and link them well.

Attachment: for qtcling, there is mocng, which is a qt moc.exe reimplementation based on clang, which can also be added to qtcling as a patch component of cling, similar to aliac, so that it has the function of automatically generating dict modules when finding pme logic in the source code. To give it the ability to produce "automic dict generator for qt extending cpp syntaxs" completes the recompilation and encapsulation of the entire qt libs from the source code level, and finally completes the construction of the entire qtcling language system.

This is the answer to the question about how to understand the pme in the analysis of the principle of clingrootsys. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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: 227

*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

Internet Technology

Wechat

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

12
Report