aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-gcc.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2013-06-18 23:49:49 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-06-18 23:49:49 +0000
commitfdbc38a6e8d7c920eea6c6231c7fe2c987fa8aa2 (patch)
tree1a7d38cd8be5484451189338ed6f4b76d8521f31 /gcc/go/go-gcc.cc
parent25e00ab67444a01dce446e95308521d1a73f8232 (diff)
downloadgcc-fdbc38a6e8d7c920eea6c6231c7fe2c987fa8aa2.zip
gcc-fdbc38a6e8d7c920eea6c6231c7fe2c987fa8aa2.tar.gz
gcc-fdbc38a6e8d7c920eea6c6231c7fe2c987fa8aa2.tar.bz2
compiler, runtime: Use function descriptors.
This changes the representation of a Go value of function type from being a pointer to function code (like a C function pointer) to being a pointer to a struct. The first field of the struct points to the function code. The remaining fields, if any, are the addresses of variables referenced in enclosing functions. For each call to a function, the address of the function descriptor is passed as the last argument. This lets us avoid generating trampolines, and removes the use of writable/executable sections of the heap. From-SVN: r200181
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r--gcc/go/go-gcc.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index a6acf13..bd2d0dd 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -287,10 +287,10 @@ class Gcc_backend : public Backend
Location, Bstatement**);
Bvariable*
- immutable_struct(const std::string&, bool, Btype*, Location);
+ immutable_struct(const std::string&, bool, bool, Btype*, Location);
void
- immutable_struct_set_init(Bvariable*, const std::string&, bool, Btype*,
+ immutable_struct_set_init(Bvariable*, const std::string&, bool, bool, Btype*,
Location, Bexpression*);
Bvariable*
@@ -1454,8 +1454,8 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock,
// Create a named immutable initialized data structure.
Bvariable*
-Gcc_backend::immutable_struct(const std::string& name, bool, Btype* btype,
- Location location)
+Gcc_backend::immutable_struct(const std::string& name, bool, bool,
+ Btype* btype, Location location)
{
tree type_tree = btype->get_tree();
if (type_tree == error_mark_node)
@@ -1482,7 +1482,7 @@ Gcc_backend::immutable_struct(const std::string& name, bool, Btype* btype,
void
Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&,
- bool is_common, Btype*,
+ bool is_hidden, bool is_common, Btype*,
Location,
Bexpression* initializer)
{
@@ -1495,7 +1495,10 @@ Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&,
// We can't call make_decl_one_only until we set DECL_INITIAL.
if (!is_common)
- TREE_PUBLIC(decl) = 1;
+ {
+ if (!is_hidden)
+ TREE_PUBLIC(decl) = 1;
+ }
else
{
make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl));