Stream: cranelift

Topic: Understanding `colocated`


view this post on Zulip McCoy (Jun 19 2022 at 03:09):

I'm trying to understand some syntax in *.clif files:

function u0:0() -> i32 system_v {
    sig0 = () -> i64 system_v
    fn0 = colocated u0:2 sig0

here, what does colocated u0:2 sig0 mean -- specifically, the u0:2 symbol. I read about colocation on the cranelift docs, but I don't fully understand what this statement means (including the u0:2).

view this post on Zulip Chris Fallin (Jun 19 2022 at 05:33):

hi @McCoy -- colocated means that the reference is to a function that is "close" in the address space. On x86-64 this means +/- 2GiB; on aarch64, +/- 128MiB. In practice this should only be used for same-module calls. The u0:2 is a symbol reference to an embedder-defined symbol index

view this post on Zulip McCoy (Jun 19 2022 at 12:26):

thank you @Chris Fallin !


Last updated: Nov 22 2024 at 16:03 UTC