]> git.ipfire.org Git - thirdparty/gcc.git/commit
compiler: compile runtime.getcaller{pc,sp} into builtin functions
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Sep 2016 20:32:16 +0000 (20:32 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Sep 2016 20:32:16 +0000 (20:32 +0000)
commit105f9a24182ecd64c523082c0190fd815faa5619
treec603e6261575dd4da3b11d23174440467f68b4db
parent78299f8dd3af338f5d88eec565cd05b75dd89c18
compiler: compile runtime.getcaller{pc,sp} into builtin functions

    The runtime functions runtime.getcallerpc and runtime.getcallersp are
    intended to be efficient ways to get the return and frame address of the
    caller (that is, the caller of runtime.getcallerpc).  In the C code that
    is implemented by simply using C macros:

    This patch essentially implements those macros in the Go code.

    It would be nice if we could just use //extern for this, but it doesn't
    work because the runtime code passes the right argument.  Of course we
    could change the runtime code, but these are common enough that I'd
    prefer to avoid the difference from the gc version of the runtime code.

    This patch corrects the existing declaration of __builtin_return_address
    to use uint32, rather than uint, for the parameter type.  The builtin
    functions take the C type "unsigned int", which for the targets we use
    corresponds to the Go type uint32.  Not that it should matter, really.

    Reviewed-on: https://go-review.googlesource.com/29653

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240382 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/ChangeLog
gcc/go/go-gcc.cc
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h