llvm2cranelift icon indicating copy to clipboard operation
llvm2cranelift copied to clipboard

symbols: put data symbols into namespace 1 and funcs into 0

Open undingen opened this issue 5 years ago • 3 comments

Before this change we but everything into namespace 0 (so is_function() always returned true). cranelift-simplejit/src/backend.rs::get_definition: calls namespace.is_function(name) to figure out if it has to lookup a function or data definition. But cranelift-module is_function() does this by comparing the namespace with 0:

    // Return whether `name` names a function, rather than a data object.
    pub fn is_function(&self, name: &ir::ExternalName) -> bool {
        if let ir::ExternalName::User { namespace, .. } = *name {
            namespace == 0
        } else {
            panic!("unexpected ExternalName kind {}", name)
        }
    }

undingen avatar Sep 13 '19 20:09 undingen

This makes sense to me.

sunfishcode avatar Oct 02 '19 13:10 sunfishcode

rebased the PR - no other changes

undingen avatar Oct 08 '19 16:10 undingen

is there anything to do to get this merged?

undingen avatar Nov 21 '19 12:11 undingen