mirror of
https://github.com/LIV2/bebbo-gcc.git
synced 2025-12-06 00:23:32 +00:00
PR go/79037
Backport from mainline:
compiler, runtime: align gc data for m68k
The current GC requires that the gc data be aligned to at least a 4
byte boundary, because it uses the lower two bits of the address for
flags (see LOOP and PRECISE in runtime/mgc0.c). As the gc data is
stored as a [...]uintptr, that is normally always true. However, on
m68k, that only guarantees 2 byte alignment. Fix it by forcing the
alignment.
The parfor code used by the current GC requires that the parfor data
be aligned to at least an 8 byte boundary. The code in parfor.c
verifies this. This is normally true, as the data uses uint64_t
values, but, again, this must be enforced explicitly on m68k.
Fixes GCC PR 79037.
Change-Id: Ifdf422db7b37e88f490e54c2f6d249117d359dd6
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@245110 138bc75d-0d04-0410-961f-82ee72b054a4
This commit is contained in:
parent
1939895252
commit
63bbd5a689
@ -2175,11 +2175,26 @@ Type::make_gc_symbol_var(Gogo* gogo)
|
||||
is_common = true;
|
||||
}
|
||||
|
||||
// The current garbage collector requires that the GC symbol be
|
||||
// aligned to at least a four byte boundary. See the use of PRECISE
|
||||
// and LOOP in libgo/runtime/mgc0.c.
|
||||
int64_t align;
|
||||
if (!sym_init->type()->backend_type_align(gogo, &align))
|
||||
go_assert(saw_errors());
|
||||
if (align < 4)
|
||||
align = 4;
|
||||
else
|
||||
{
|
||||
// Use default alignment.
|
||||
align = 0;
|
||||
}
|
||||
|
||||
// Since we are building the GC symbol in this package, we must create the
|
||||
// variable before converting the initializer to its backend representation
|
||||
// because the initializer may refer to the GC symbol for this type.
|
||||
this->gc_symbol_var_ =
|
||||
gogo->backend()->implicit_variable(sym_name, sym_btype, false, true, is_common, 0);
|
||||
gogo->backend()->implicit_variable(sym_name, sym_btype, false, true,
|
||||
is_common, align);
|
||||
if (phash != NULL)
|
||||
*phash = this->gc_symbol_var_;
|
||||
|
||||
|
||||
@ -36,7 +36,8 @@ static const String reflection_string =
|
||||
sizeof REFLECTION - 1
|
||||
};
|
||||
|
||||
const uintptr unsafe_Pointer_gc[] = {sizeof(void*), GC_APTR, 0, GC_END};
|
||||
const uintptr unsafe_Pointer_gc[] __attribute__((aligned(4))) =
|
||||
{sizeof(void*), GC_APTR, 0, GC_END};
|
||||
|
||||
const struct __go_type_descriptor unsafe_Pointer =
|
||||
{
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
struct ParForThread
|
||||
{
|
||||
// the thread's iteration space [32lsb, 32msb)
|
||||
uint64 pos;
|
||||
uint64 pos __attribute__((aligned(8)));
|
||||
// stats
|
||||
uint64 nsteal;
|
||||
uint64 nstealcnt;
|
||||
|
||||
@ -431,7 +431,7 @@ struct ParFor
|
||||
// otherwise parfor may return while other threads are still working
|
||||
ParForThread *thr; // array of thread descriptors
|
||||
// stats
|
||||
uint64 nsteal;
|
||||
uint64 nsteal __attribute__((aligned(8))); // force alignment for m68k
|
||||
uint64 nstealcnt;
|
||||
uint64 nprocyield;
|
||||
uint64 nosyield;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user