Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • M mu-impl-fast
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

GitLab will continue to be upgraded on 7 Feb 2023 from 2.00 pm (AEDT) to 3.00 pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

  • mumu
  • mu-impl-fast
  • Issues
  • #32
Closed
Open
Issue created Jun 06, 2017 by Isaac Gariano@igariano01Maintainer

Calling function defined in another bundle does not work

I am trying to define a function in one bundle, and call it another, and i'm getting an error:

Heres an example that will reproduce the problem:

file argc_exit.uir:

.funcsig @exit_sig = (int<32>) -> ()
.funcdef @argc.exit <@exit_sig>
{
        %entry(<int<32>>%arg):
                CCALL #DEFAULT <ufuncptr<@exit_sig> @exit_sig> <ufuncptr<@exit_sig>>EXTERN "exit"(%arg)
                RET
}

file argc_inline.uir:

.typedef %char = int<8>
.funcdef @my_main <(int<32> uptr<uptr<%char>>)->(int<32>)> VERSION @my_main_v1
{
        %entry(<int<32>>%argc <uptr<uptr<%char>>>%argv):
                CALL <(int<32>)->()> @argc.exit (%argc)
                RET <int<32>>1
}

Then using my mu-tool-compiler: ./muc -r -f my_main argc_exit.uir argc_inline.uir emit/argc (use -c if you wan't to see the API calls it uses).

thread '<unnamed>' panicked at 'Operand 1013' is neither a local var or a global var', src/vm/api/api_impl/muirbuilder.rs:1290 stack backtrace: (the symbol with Id 1013 is @argc.exit).

I tracked the error down and it appears to be comming from the function get_treenode in (src\vm\api\api_impl\muirbuilder.rs). My guess is the API implementation only looks for things defined in the current bundle and not other bundles. However from my understanding of the Mu-spec you should be able to refer to entities declared in previously loaded bundles.

A workaround is to combine both files into the same bundle such as with ./muc -r -f my_main <(cat argc_exit.uir && cat argc_inline.uir) emit/argc.

Assignee
Assign to
Time tracking