go-llvm / llgo

LLVM-based compiler for Go
Other
1.26k stars 80 forks source link

Methods do not need descriptors #169

Closed pcc closed 10 years ago

axw commented 10 years ago

NOT LGTM

Referring to an unbound method still requires a descriptor. The following program does not link with this change:

package main

type T struct{}
func (*T) f() {
}

func main() {
    f := (*T).f
    f(nil)
}
pcc commented 10 years ago

Have you patched in https://codereview.appspot.com/93780044 ? I would expect that with that CL ssa should create a thunk which would correctly receive a descriptor.

axw commented 10 years ago

Agh, no I haven't, sorry. I came in thinking a thunk would be created, and that's what why. Works fine after clpatching. LGTM.