Re: [gofrontend-dev] Go patch committed: Implement method values in reflect package
Ian Lance Taylor i...@google.com writes: This patch to the Go frontend and libgo implements method values in the reflect package. Working with method values and reflect now works correctly, at least on x86. Can you give me a test case? I can try it on a few other architectures tomorrow. Cheers, mwh This changes the type signature for type methods in the reflect package to match the gc compiler. That in turn required changing the reflect package to mark method values with a new flag, as previously they were detected by the type signature. The MakeFunc support needed to create a function that takes a value and passes a pointer to the method, since all methods take pointers. It also needed to create a function that holds a receiver value. And the recover code needed to handle these new cases. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.8 branch. Ian
Re: [gofrontend-dev] Go patch committed: Implement method values in reflect package
On Thu, Dec 12, 2013 at 12:21 AM, Michael Hudson-Doyle michael.hud...@linaro.org wrote: Ian Lance Taylor i...@google.com writes: This patch to the Go frontend and libgo implements method values in the reflect package. Working with method values and reflect now works correctly, at least on x86. Can you give me a test case? I can try it on a few other architectures tomorrow. The test case is test/recover.go in the master Go sources. But I know that that test won't work on other architectures, because currently reflect.MakeFunc is only implemented for 386 and amd64. It should be possible to implement reflect.MakeFunc for all architectures in a somewhat inefficient manner by using libffi's closure API. I have not tried that. It is also of course possible to implement support for any specific processor as I did for 386 and amd64. The difficulty depends on the difficulty of the ABI. In general it's not too hard but it requires a clear understanding of ABI details and assembly language programming with full backtrace information. It's about 600 lines of code for amd64. Ian
Re: [gofrontend-dev] Go patch committed: Implement method values in reflect package
Ian Lance Taylor i...@google.com writes: On Thu, Dec 12, 2013 at 12:21 AM, Michael Hudson-Doyle michael.hud...@linaro.org wrote: Ian Lance Taylor i...@google.com writes: This patch to the Go frontend and libgo implements method values in the reflect package. Working with method values and reflect now works correctly, at least on x86. Can you give me a test case? I can try it on a few other architectures tomorrow. The test case is test/recover.go in the master Go sources. But I know that that test won't work on other architectures, because currently reflect.MakeFunc is only implemented for 386 and amd64. Ah, OK. It should be possible to implement reflect.MakeFunc for all architectures in a somewhat inefficient manner by using libffi's closure API. I have not tried that. It is also of course possible to implement support for any specific processor as I did for 386 and amd64. The difficulty depends on the difficulty of the ABI. In general it's not too hard but it requires a clear understanding of ABI details and assembly language programming with full backtrace information. It's about 600 lines of code for amd64. OK, I'll add it to a list of things to look at at some point... Cheers, mwh