This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
Add platform-specific entrypoint codegen #81
Open
Description
rbpf-tests contains this comment
match result {
Ok(0) => {}
Ok(_) => {
// fixme rbpf expects a function that returns a status code, but we
// currently emit a main function that returns void, so this value
// is seemingly whatever happens to be in the return register.
}
Main functions in move (scripts) have no return value, but rbpf expects a status code return value. At the moment we emit the Move main function as the entrypoint, with no wrapper. We need to instead emit some platform-specific entry-point glue to encapsulate the Move main function.
Here's a possible way to do it in the short-term:
- if the module is a script, before translating functions, call a method to emit a platform-specific entrypoint function with a known platform-specific symbol name (I think that name is currently "main")
- that calls the "real" main function with a known name like "__move_main".
- always return 0 (errors in move scripts manifest as abort syscalls).
- when translating functions, when we see the Move main function, give it the name "__move_main". the move model gives this function a placeholder name like "<SCRIPT>", and today we rename it "main"; instead rename it "__move_main".
- change rbpf-tests to treat a return value of
Ok(x) if x > 0
as an unexpected failure.
Activity