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

Source maps #41

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Source maps #41

wants to merge 9 commits into from

Conversation

i582
Copy link
Contributor

@i582 i582 commented Feb 16, 2025

Initial implementation for source map from Fift assembly file from FunC

At the time when decompiling we get function names like ?fun_HASH_0_to_16, but we would like to see the real names, like in the original FunC code.

For this we add a new function obtainSourceMap which takes the path to the original .fif file.
To get the HASH -> name mapping we run the Fift compilation passing the contents of not just a .fif file, but a special version of Asm.fif + our .fif file. With this changes in Asm.fif, Fift compiler prints the name and hash of each function to stdout during compilation, which we then transform into a source map.

This map then passed to AssemblyWriter.write() for actual use:

const program = disassembleRoot(source, {computeRefs: true})
const sourceMap = await obtainSourceMap("./Jetton_JettonMinter.code.fif") // source of info
const res = AssemblyWriter.write(program, {sourceMap})
console.log(res)

Towards #46

@i582 i582 changed the title Source map Source maps Feb 16, 2025
Comment on lines +1672 to +1674
library TonUtil // TON Blockchain Fift Library

library Lists // List utilities
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftovers from concatenating Fift libraries into this big amalgamation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's just a concatenation of some existing Fift files, let's create a script to do that concat and put all those files separately. Also, add the links to the original Fift files (including commit info), so it's reproducible

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

Successfully merging this pull request may close these issues.

3 participants