[GoLLVM/gofrontend] Different itab implementation?

90 views
Skip to first unread message

Lanzhiguan Huang

unread,
Apr 20, 2022, 9:31:22 AM4/20/22
to golang-nuts
Hi,
  In gc's implementation, the itab struct has an interface type and an object type field and a method table, while in the GoLLVM's implementation, the type descriptor was moved to the first field of the method table. I think they just maintain the same information but do not understand the purposes of the design. Currently the difference may cause incompatibility between the two compilers.

Ian Lance Taylor

unread,
Apr 20, 2022, 6:37:10 PM4/20/22
to Lanzhiguan Huang, golang-nuts
On Wed, Apr 20, 2022 at 6:31 AM Lanzhiguan Huang
<huangla...@gmail.com> wrote:
>
> In gc's implementation, the itab struct has an interface type and an object type field and a method table, while in the GoLLVM's implementation, the type descriptor was moved to the first field of the method table. I think they just maintain the same information but do not understand the purposes of the design. Currently the difference may cause incompatibility between the two compilers.

There is no safe way for Go code to ever see these structures, so the
difference should not matter to any ordinary Go programs.

At this point I don't think there is any deep reason for the slightly
different design. Historically it was because the gc implementation
used a runtime cache, but these days the gofrontend implementation
used by GoLLVM also uses a runtime cache.

Ian

Lanzhiguan Huang

unread,
Apr 20, 2022, 10:46:03 PM4/20/22
to golang-nuts
Thanks
Reply all
Reply to author
Forward
0 new messages