summaryrefslogtreecommitdiffstats
path: root/libgo/runtime/mgc0.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-18 23:49:49 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-18 23:49:49 +0000
commit8381eda7ff1e5a2874d708573654e64a4efcfb4f (patch)
tree1a7d38cd8be5484451189338ed6f4b76d8521f31 /libgo/runtime/mgc0.c
parent2851d736ebf1e8cceebb9106cab69d2c3fdc7624 (diff)
downloadppe42-gcc-8381eda7ff1e5a2874d708573654e64a4efcfb4f.tar.gz
ppe42-gcc-8381eda7ff1e5a2874d708573654e64a4efcfb4f.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200181 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime/mgc0.c')
-rw-r--r--libgo/runtime/mgc0.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libgo/runtime/mgc0.c b/libgo/runtime/mgc0.c
index ffbe2cefb2d..88283ccab2b 100644
--- a/libgo/runtime/mgc0.c
+++ b/libgo/runtime/mgc0.c
@@ -120,7 +120,7 @@ struct Workbuf
typedef struct Finalizer Finalizer;
struct Finalizer
{
- void (*fn)(void*);
+ FuncVal *fn;
void *arg;
const struct __go_func_type *ft;
};
@@ -1130,7 +1130,6 @@ addroots(void)
addroot((Obj){(byte*)&runtime_allm, sizeof runtime_allm, 0});
runtime_MProf_Mark(addroot);
runtime_time_scan(addroot);
- runtime_trampoline_scan(addroot);
// MSpan.types
allspans = runtime_mheap.allspans;
@@ -1182,7 +1181,7 @@ addroots(void)
static bool
handlespecial(byte *p, uintptr size)
{
- void (*fn)(void*);
+ FuncVal *fn;
const struct __go_func_type *ft;
FinBlock *block;
Finalizer *f;
@@ -1731,11 +1730,12 @@ runfinq(void* dummy __attribute__ ((unused)))
for(; fb; fb=next) {
next = fb->next;
for(i=0; i<(uint32)fb->cnt; i++) {
- void *params[1];
+ void *params[2];
f = &fb->fin[i];
params[0] = &f->arg;
- reflect_call(f->ft, (void*)f->fn, 0, 0, params, nil);
+ params[1] = f;
+ reflect_call(f->ft, f->fn, 0, 0, params, nil);
f->fn = nil;
f->arg = nil;
}
OpenPOWER on IntegriCloud