Skip to content

Conversation

@tmcgilchrist
Copy link
Contributor

@tmcgilchrist tmcgilchrist commented Oct 8, 2025

This PR adds support for a new name mangling scheme to OxCaml. The key advantage of this mangling scheme is that full module paths can be reconstructed by the de-mangler from the mangled name (i.e., including submodules and not just the compilation unit).

Remaining Todos:

  • adding the de-mangling code to the PR
  • debug info: adding debug information when entering anonymous modules (in a separate PR)
  • debug info: disambiguate different functor instantiations
  • debug info: revisit the debug info generation points to check that all of them are correct
  • fixing the column numbers in the debug info for anonymous functions
  • mangling for non-function symbols (e.g., module entry point, code start symbol, ...)
  • revisit the other stamp that is part of function names to see whether there are uniqueness issues here
  • analyze the interaction between zero alloc and the new mangling scheme (currently tests are disabled)
  • bike-shedding about the de-mangled printing of anonymous functions, partially applied functions, ...
  • update and re-enable several tests that are mangling sensitive: llvmize, objdumpinfo, backtraces
  • Document the mangling and demangling implementations in llvm and the compiler.

De-mangling Implementations.

@spiessimon spiessimon marked this pull request as draft October 8, 2025 10:10
@spiessimon spiessimon changed the title Work in Progress: Different Name Mangling Scheme Different Name Mangling Scheme Oct 8, 2025
@mshinwell-js mshinwell-js changed the title Different Name Mangling Scheme New, reversible name mangling scheme Oct 10, 2025
shym and others added 13 commits November 5, 2025 14:00
Since the test outputs depend on the name-mangling scheme, enable those
tests only when the new scheme is enabled
Note that references to anonymous functions (in `.data`) are abbreviated
to `fn` now, instead of having a file path and a location
Also note that some stamps were not, and still are not, hidden as
intended
On lines with multiple identifiers appearing, the `(.*)` can match, not
only the body of one identifier but everything from the start of the
body of the first identifier to the end of the body of the last
identifier of a line
Enable the new scheme on zero-alloc tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants