From 1e1cc4eb570aa6fec645ff4faf13431847b99db8 Mon Sep 17 00:00:00 2001 From: Ken Thompson Date: Tue, 27 Jan 2009 12:03:53 -0800 Subject: defer R=r OCL=23592 CL=23592 --- src/runtime/runtime.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/runtime/runtime.h') diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 5552c9e94d..78e2affc62 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -52,6 +52,7 @@ typedef struct SigTab SigTab; typedef struct MCache MCache; typedef struct Iface Iface; typedef struct Itype Itype; +typedef struct Defer Defer; /* * per cpu declaration @@ -128,6 +129,7 @@ struct G { byte* stackguard; // must not move byte* stackbase; // must not move + Defer* defer; // must not move byte* stack0; // first stack segment Gobuf sched; G* alllink; // on allg @@ -136,8 +138,8 @@ struct G int32 goid; int32 selgen; // valid sudog pointer G* schedlink; - bool readyonstop; - M* m; // for debuggers + bool readyonstop; + M* m; // for debuggers }; struct Mem { @@ -151,8 +153,8 @@ struct M G* g0; // g0 w interrupt stack - must not move uint64 morearg; // arg to morestack - must not move uint64 cret; // return value from C - must not move - uint64 procid; // for debuggers - must not move - G* gsignal; // signal-handling G - must not move + uint64 procid; // for debuggers - must not move + G* gsignal; // signal-handling G - must not move G* curg; // current running goroutine G* lastg; // last running goroutine - to emulate fifo Gobuf sched; @@ -235,6 +237,18 @@ enum Amax }; +/* + * defered subroutine calls + */ +struct Defer +{ + int32 siz; + byte* sp; + byte* fn; + Defer* link; + byte args[8]; // padded to actual size +}; + /* * external data */ @@ -286,6 +300,7 @@ int32 write(int32, void*, int32); void close(int32); int32 fstat(int32, void*); bool cas(uint32*, uint32, uint32); +void jmpdefer(byte*); void exit1(int32); void ready(G*); byte* getenv(int8*); -- cgit v1.3-5-g9baa