aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-07-14 01:22:25 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-07-14 01:22:25 +0000
commit67a546ab451541e24dae5c8ecbaf692c8cd89f08 (patch)
treeb317e5c995b24230c3a354dfb57ea03905f419de /gcc/go
parentd8b6e6a172f6ab862c47dabbab6b1832cd49b1ee (diff)
downloadgcc-67a546ab451541e24dae5c8ecbaf692c8cd89f08.zip
gcc-67a546ab451541e24dae5c8ecbaf692c8cd89f08.tar.gz
gcc-67a546ab451541e24dae5c8ecbaf692c8cd89f08.tar.bz2
compiler,runtime: Determine if allocations need new pointers in runtime.
As the removed comment states, if the package being compiled played certain tricks with pointers that looked like integers, the compiler might allocate space for new pointers unnecessarily. Since the type information on the heap is now precise, this logic can be moved to the runtime. Reviewed-on: https://go-review.googlesource.com/11581 From-SVN: r225757
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/gogo.cc10
-rw-r--r--gcc/go/gofrontend/runtime.def4
3 files changed, 2 insertions, 14 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index b524ce1..9a5a2f9 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-83191e8e2cb9f47f7c1e6bcb9997f21163292612
+2c985e4781691fea3eb4171de85265bfbc4e4997
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 5906b44..ad4672f 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -4391,15 +4391,7 @@ Gogo::allocate_memory(Type* type, Location location)
Expression* td = Expression::make_type_descriptor(type, location);
Expression* size =
Expression::make_type_info(type, Expression::TYPE_INFO_SIZE);
-
- // If this package imports unsafe, then it may play games with
- // pointers that look like integers. We should be able to determine
- // whether or not to use new pointers in libgo/go-new.c. FIXME.
- bool use_new_pointers = this->imported_unsafe_ || type->has_pointer();
- return Runtime::make_call((use_new_pointers
- ? Runtime::NEW
- : Runtime::NEW_NOPOINTERS),
- location, 2, td, size);
+ return Runtime::make_call(Runtime::NEW, location, 2, td, size);
}
// Traversal class used to check for return statements.
diff --git a/gcc/go/gofrontend/runtime.def b/gcc/go/gofrontend/runtime.def
index 43025dd..2e79263 100644
--- a/gcc/go/gofrontend/runtime.def
+++ b/gcc/go/gofrontend/runtime.def
@@ -223,10 +223,6 @@ DEF_GO_RUNTIME(REGISTER_GC_ROOTS, "__go_register_gc_roots", P1(POINTER), R0())
// Allocate memory.
DEF_GO_RUNTIME(NEW, "__go_new", P2(TYPE, UINTPTR), R1(POINTER))
-// Allocate memory which can not contain pointers.
-DEF_GO_RUNTIME(NEW_NOPOINTERS, "__go_new_nopointers", P2(TYPE, UINTPTR), R1(POINTER))
-
-
// Start a new goroutine.
DEF_GO_RUNTIME(GO, "__go_go", P2(FUNC_PTR, POINTER), R0())