Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whether the contents of the compiler or function node can be cached in the local file #396

Closed
w4454962 opened this issue Feb 3, 2023 · 6 comments

Comments

@w4454962
Copy link

w4454962 commented Feb 3, 2023

Like the status of the intermediate code of the llvm, it can be saved and reloaded, and I don't have to deal with the relocation problem myself. Because I want to implement an offline compiler, I need to separate the compiler from the runtime, and I like the asmjit method, but I don't seem to see the corresponding solution at present.

@w4454962
Copy link
Author

w4454962 commented Feb 3, 2023

If the compiler saves the string assembly and uses asmjit+asmtk to compile and load the string assembly into memory in real time at runtime, this idea can be realized. However, the compilation speed seems to be slow, and some implementations in function nodes cannot be used.

@w4454962
Copy link
Author

w4454962 commented Feb 8, 2023

When using "logger" and asmtk, there is no way to convert the address back to the original string symbol and compile the result generated by the logger

@ZehMatt
Copy link
Contributor

ZehMatt commented Feb 8, 2023

You can already do this yourself if you are using the Builder, you can just traverse all nodes and save them to disk and when you load the file you just create the nodes again.

@kobalicek
Copy link
Member

True, the only way is to serialize and deserialize the content yourself. The reason is that I would like to not deal with compatibility of the serialized content (versions, new features, etc...), so this is supposed to be done by users. I think that maybe caching the content of your upper layer that generates the code would be much better / easier than caching the nodes - depends on the number of nodes, but I don't really see a big overhead here - you can create the nodes at a lighting speed, and even if you load them from a file, you have to create them anyway.

BTW logger is not a proper tool for serializing the content - it's purpose is to log something, but not immediately log it in a format that is then parseable by asmtk or other assemblers.

@paule32
Copy link

paule32 commented Feb 8, 2023 via email

@w4454962
Copy link
Author

w4454962 commented Feb 9, 2023

In other words, I need to implement a compilation process similar to the generation and parsing of "llvm IR" intermediate bytecode, and input the intermediate code to the asmjit compiler to finally generate the machine code.

Well, I can't think of any more scientific way.

@w4454962 w4454962 closed this as completed Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants