diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index b524ce11ba538efc7724c55bdefbbe1f4d69e241..9a5a2f9df5044400b0ca2fcdf4acb0b59cf64c9a 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 5906b447e15e59a28367b29f71fd27e23e286533..ad4672ffe059a20cf292b34dab535538a02e2724 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 43025dd7b61c90d5bbc218d6b94cefca75fbe959..2e79263a632da45ec62c5f1e79328d7233f4c317 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()) diff --git a/libgo/runtime/go-new.c b/libgo/runtime/go-new.c index dad6efb30c0cc3f0c3dd00779334afb4fe203d4c..01bc2af31211056dd1d0386a2dc293648e68aa62 100644 --- a/libgo/runtime/go-new.c +++ b/libgo/runtime/go-new.c @@ -8,19 +8,12 @@ #include "runtime.h" #include "arch.h" #include "malloc.h" +#include "go-type.h" void * __go_new (const struct __go_type_descriptor *td, uintptr_t size) { return runtime_mallocgc (size, (uintptr) td | TypeInfo_SingleObject, - 0); -} - -void * -__go_new_nopointers (const struct __go_type_descriptor *td, uintptr_t size) -{ - return runtime_mallocgc (size, - (uintptr) td | TypeInfo_SingleObject, - FlagNoScan); + td->__code & GO_NO_POINTERS ? FlagNoScan : 0); }