ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/State.xs
(Generate patch)

Comparing Coro/Coro/State.xs (file contents):
Revision 1.93 by root, Sun Nov 26 03:22:50 2006 UTC vs.
Revision 1.108 by root, Mon Nov 27 18:15:47 2006 UTC

1#define PERL_NO_GET_CONTEXT
2
3#include "libcoro/coro.c" 1#include "libcoro/coro.c"
4 2
5#include "EXTERN.h" 3#include "EXTERN.h"
6#include "perl.h" 4#include "perl.h"
7#include "XSUB.h" 5#include "XSUB.h"
8 6
9#include "patchlevel.h" 7#include "patchlevel.h"
10 8
11#if PERL_VERSION < 6 9#if USE_VALGRIND
10# include <valgrind/valgrind.h>
11#endif
12
13#define PERL_VERSION_ATLEAST(a,b,c) \
14 (PERL_REVISION > (a) \
15 || (PERL_REVISION == (a) \
16 && (PERL_VERSION > (b) \
17 || (PERL_VERSION == (b) && PERLSUBVERSION >= (c)))))
18
19#if !PERL_VERSION_ATLEAST (5,6,0)
12# ifndef PL_ppaddr 20# ifndef PL_ppaddr
13# define PL_ppaddr ppaddr 21# define PL_ppaddr ppaddr
14# endif 22# endif
15# ifndef call_sv 23# ifndef call_sv
16# define call_sv perl_call_sv 24# define call_sv perl_call_sv
54# ifndef PAGESIZE 62# ifndef PAGESIZE
55# define PAGESIZE pagesize 63# define PAGESIZE pagesize
56# define BOOT_PAGESIZE pagesize = sysconf (_SC_PAGESIZE) 64# define BOOT_PAGESIZE pagesize = sysconf (_SC_PAGESIZE)
57static long pagesize; 65static long pagesize;
58# else 66# else
59# define BOOT_PAGESIZE 67# define BOOT_PAGESIZE (void)0
60# endif 68# endif
69#else
70# define PAGESIZE 0
71# define BOOT_PAGESIZE (void)0
61#endif 72#endif
62 73
63/* The next macro should declare a variable stacklevel that contains and approximation 74/* The next macro should declare a variable stacklevel that contains and approximation
64 * to the current C stack pointer. Its property is that it changes with each call 75 * to the current C stack pointer. Its property is that it changes with each call
65 * and should be unique. */ 76 * and should be unique. */
66#define dSTACKLEVEL int stacklevel 77#define dSTACKLEVEL int stacklevel
67#define STACKLEVEL ((void *)&stacklevel) 78#define STACKLEVEL ((void *)&stacklevel)
68 79
69#define IN_DESTRUCT (PL_main_cv == Nullcv) 80#define IN_DESTRUCT (PL_main_cv == Nullcv)
70 81
71#define labs(l) ((l) >= 0 ? (l) : -(l)) 82#if __GNUC__ >= 3
83# define attribute(x) __attribute__(x)
84#else
85# define attribute(x)
86#endif
87
88#define NOINLINE attribute ((noinline))
72 89
73#include "CoroAPI.h" 90#include "CoroAPI.h"
74 91
75#define TRANSFER_SET_STACKLEVEL 0x8bfbfbfb /* magic cookie */ 92#define TRANSFER_SET_STACKLEVEL 0x8bfbfbfb /* magic cookie */
76 93
86static struct CoroAPI coroapi; 103static struct CoroAPI coroapi;
87static AV *main_mainstack; /* used to differentiate between $main and others */ 104static AV *main_mainstack; /* used to differentiate between $main and others */
88static HV *coro_state_stash, *coro_stash; 105static HV *coro_state_stash, *coro_stash;
89static SV *coro_mortal; /* will be freed after next transfer */ 106static SV *coro_mortal; /* will be freed after next transfer */
90 107
108static struct coro_cctx *cctx_first;
109static int cctx_count, cctx_idle;
110
91/* this is a structure representing a c-level coroutine */ 111/* this is a structure representing a c-level coroutine */
92typedef struct coro_stack { 112typedef struct coro_cctx {
93 struct coro_stack *next; 113 struct coro_cctx *next;
94 114
95 /* the stack */ 115 /* the stack */
96 void *sptr; 116 void *sptr;
97 long ssize; /* positive == mmap, otherwise malloc */ 117 long ssize; /* positive == mmap, otherwise malloc */
98 118
99 /* cpu state */ 119 /* cpu state */
100 void *idle_sp; /* original stacklevel when coroutine was created */ 120 void *idle_sp; /* sp of top-level transfer/schedule/cede call */
101 JMPENV *top_env; 121 JMPENV *top_env;
102 coro_context cctx; 122 coro_context cctx;
103} coro_stack;
104 123
105/* the (fake) coro_stack representing the main program */ 124#if USE_VALGRIND
106static coro_stack *main_stack; 125 int valgrind_id;
126#endif
127} coro_cctx;
107 128
108/* this is a structure representing a perl-level coroutine */ 129/* this is a structure representing a perl-level coroutine */
109struct coro { 130struct coro {
110 /* the c coroutine allocated to this perl coroutine, if any */ 131 /* the c coroutine allocated to this perl coroutine, if any */
111 coro_stack *stack; 132 coro_cctx *cctx;
112 133
113 /* data associated with this coroutine (initial args) */ 134 /* data associated with this coroutine (initial args) */
114 AV *args; 135 AV *args;
115 int refcnt; 136 int refcnt;
116 137
117 /* optionally saved, might be zero */ 138 /* optionally saved, might be zero */
118 AV *defav; 139 AV *defav;
119 SV *defsv; 140 SV *defsv;
120 SV *errsv; 141 SV *errsv;
121 142
122 /* saved global state not related to stacks */ 143#define VAR(name,type) type name;
123 U8 dowarn; 144# include "state.h"
124 I32 in_eval; 145#undef VAR
125
126 /* the stacks and related info (callchain etc..) */
127 PERL_SI *curstackinfo;
128 AV *curstack;
129 AV *mainstack;
130 SV **stack_sp;
131 OP *op;
132 SV **curpad;
133 AV *comppad;
134 CV *compcv;
135 SV **stack_base;
136 SV **stack_max;
137 SV **tmps_stack;
138 I32 tmps_floor;
139 I32 tmps_ix;
140 I32 tmps_max;
141 I32 *markstack;
142 I32 *markstack_ptr;
143 I32 *markstack_max;
144 I32 *scopestack;
145 I32 scopestack_ix;
146 I32 scopestack_max;
147 ANY *savestack;
148 I32 savestack_ix;
149 I32 savestack_max;
150 OP **retstack;
151 I32 retstack_ix;
152 I32 retstack_max;
153 PMOP *curpm;
154 COP *curcop;
155 146
156 /* coro process data */ 147 /* coro process data */
157 int prio; 148 int prio;
158}; 149};
159 150
160typedef struct coro *Coro__State; 151typedef struct coro *Coro__State;
161typedef struct coro *Coro__State_or_hashref; 152typedef struct coro *Coro__State_or_hashref;
162 153
163static AV * 154static AV *
164coro_clone_padlist (pTHX_ CV *cv) 155coro_clone_padlist (CV *cv)
165{ 156{
166 AV *padlist = CvPADLIST (cv); 157 AV *padlist = CvPADLIST (cv);
167 AV *newpadlist, *newpad; 158 AV *newpadlist, *newpad;
168 159
169 newpadlist = newAV (); 160 newpadlist = newAV ();
170 AvREAL_off (newpadlist); 161 AvREAL_off (newpadlist);
171#if PERL_VERSION < 9 162#if PERL_VERSION_ATLEAST (5,9,0)
163 Perl_pad_push (aTHX_ padlist, AvFILLp (padlist) + 1);
164#else
172 Perl_pad_push (aTHX_ padlist, AvFILLp (padlist) + 1, 1); 165 Perl_pad_push (aTHX_ padlist, AvFILLp (padlist) + 1, 1);
173#else
174 Perl_pad_push (aTHX_ padlist, AvFILLp (padlist) + 1);
175#endif 166#endif
176 newpad = (AV *)AvARRAY (padlist)[AvFILLp (padlist)]; 167 newpad = (AV *)AvARRAY (padlist)[AvFILLp (padlist)];
177 --AvFILLp (padlist); 168 --AvFILLp (padlist);
178 169
179 av_store (newpadlist, 0, SvREFCNT_inc (*av_fetch (padlist, 0, FALSE))); 170 av_store (newpadlist, 0, SvREFCNT_inc (*av_fetch (padlist, 0, FALSE)));
181 172
182 return newpadlist; 173 return newpadlist;
183} 174}
184 175
185static void 176static void
186free_padlist (pTHX_ AV *padlist) 177free_padlist (AV *padlist)
187{ 178{
188 /* may be during global destruction */ 179 /* may be during global destruction */
189 if (SvREFCNT (padlist)) 180 if (SvREFCNT (padlist))
190 { 181 {
191 I32 i = AvFILLp (padlist); 182 I32 i = AvFILLp (padlist);
212 AV *padlist; 203 AV *padlist;
213 AV *av = (AV *)mg->mg_obj; 204 AV *av = (AV *)mg->mg_obj;
214 205
215 /* casting is fun. */ 206 /* casting is fun. */
216 while (&PL_sv_undef != (SV *)(padlist = (AV *)av_pop (av))) 207 while (&PL_sv_undef != (SV *)(padlist = (AV *)av_pop (av)))
217 free_padlist (aTHX_ padlist); 208 free_padlist (padlist);
218 209
219 SvREFCNT_dec (av); 210 SvREFCNT_dec (av);
220 211
221 return 0; 212 return 0;
222} 213}
225 216
226static MGVTBL vtbl_coro = {0, 0, 0, 0, coro_cv_free}; 217static MGVTBL vtbl_coro = {0, 0, 0, 0, coro_cv_free};
227 218
228/* the next two functions merely cache the padlists */ 219/* the next two functions merely cache the padlists */
229static void 220static void
230get_padlist (pTHX_ CV *cv) 221get_padlist (CV *cv)
231{ 222{
232 MAGIC *mg = mg_find ((SV *)cv, PERL_MAGIC_coro); 223 MAGIC *mg = mg_find ((SV *)cv, PERL_MAGIC_coro);
233 224
234 if (mg && AvFILLp ((AV *)mg->mg_obj) >= 0) 225 if (mg && AvFILLp ((AV *)mg->mg_obj) >= 0)
235 CvPADLIST (cv) = (AV *)av_pop ((AV *)mg->mg_obj); 226 CvPADLIST (cv) = (AV *)av_pop ((AV *)mg->mg_obj);
236 else 227 else
237 { 228 {
238#if 0 229#if 0
239 /* this should work - but it doesn't :( */ 230 /* this is probably cleaner, but also slower? */
240 CV *cp = Perl_cv_clone (aTHX_ cv); 231 CV *cp = Perl_cv_clone (cv);
241 CvPADLIST (cv) = CvPADLIST (cp); 232 CvPADLIST (cv) = CvPADLIST (cp);
242 CvPADLIST (cp) = 0; 233 CvPADLIST (cp) = 0;
243 SvREFCNT_dec (cp); 234 SvREFCNT_dec (cp);
244#else 235#else
245 CvPADLIST (cv) = coro_clone_padlist (aTHX_ cv); 236 CvPADLIST (cv) = coro_clone_padlist (cv);
246#endif 237#endif
247 } 238 }
248} 239}
249 240
250static void 241static void
251put_padlist (pTHX_ CV *cv) 242put_padlist (CV *cv)
252{ 243{
253 MAGIC *mg = mg_find ((SV *)cv, PERL_MAGIC_coro); 244 MAGIC *mg = mg_find ((SV *)cv, PERL_MAGIC_coro);
254 245
255 if (!mg) 246 if (!mg)
256 { 247 {
264} 255}
265 256
266#define SB do { 257#define SB do {
267#define SE } while (0) 258#define SE } while (0)
268 259
269#define LOAD(state) load_state(aTHX_ (state)); 260#define LOAD(state) load_state((state));
270#define SAVE(state,flags) save_state(aTHX_ (state),(flags)); 261#define SAVE(state,flags) save_state((state),(flags));
271 262
272#define REPLACE_SV(sv,val) SB SvREFCNT_dec(sv); (sv) = (val); (val) = 0; SE 263#define REPLACE_SV(sv,val) SB SvREFCNT_dec(sv); (sv) = (val); (val) = 0; SE
273 264
274static void 265static void
275load_state(pTHX_ Coro__State c) 266load_state(Coro__State c)
276{ 267{
277 PL_dowarn = c->dowarn; 268#define VAR(name,type) PL_ ## name = c->name;
278 PL_in_eval = c->in_eval; 269# include "state.h"
279 270#undef VAR
280 PL_curstackinfo = c->curstackinfo;
281 PL_curstack = c->curstack;
282 PL_mainstack = c->mainstack;
283 PL_stack_sp = c->stack_sp;
284 PL_op = c->op;
285 PL_curpad = c->curpad;
286 PL_comppad = c->comppad;
287 PL_compcv = c->compcv;
288 PL_stack_base = c->stack_base;
289 PL_stack_max = c->stack_max;
290 PL_tmps_stack = c->tmps_stack;
291 PL_tmps_floor = c->tmps_floor;
292 PL_tmps_ix = c->tmps_ix;
293 PL_tmps_max = c->tmps_max;
294 PL_markstack = c->markstack;
295 PL_markstack_ptr = c->markstack_ptr;
296 PL_markstack_max = c->markstack_max;
297 PL_scopestack = c->scopestack;
298 PL_scopestack_ix = c->scopestack_ix;
299 PL_scopestack_max = c->scopestack_max;
300 PL_savestack = c->savestack;
301 PL_savestack_ix = c->savestack_ix;
302 PL_savestack_max = c->savestack_max;
303#if PERL_VERSION < 9
304 PL_retstack = c->retstack;
305 PL_retstack_ix = c->retstack_ix;
306 PL_retstack_max = c->retstack_max;
307#endif
308 PL_curpm = c->curpm;
309 PL_curcop = c->curcop;
310 271
311 if (c->defav) REPLACE_SV (GvAV (PL_defgv), c->defav); 272 if (c->defav) REPLACE_SV (GvAV (PL_defgv), c->defav);
312 if (c->defsv) REPLACE_SV (DEFSV , c->defsv); 273 if (c->defsv) REPLACE_SV (DEFSV , c->defsv);
313 if (c->errsv) REPLACE_SV (ERRSV , c->errsv); 274 if (c->errsv) REPLACE_SV (ERRSV , c->errsv);
314 275
321 { 282 {
322 AV *padlist = (AV *)POPs; 283 AV *padlist = (AV *)POPs;
323 284
324 if (padlist) 285 if (padlist)
325 { 286 {
326 put_padlist (aTHX_ cv); /* mark this padlist as available */ 287 put_padlist (cv); /* mark this padlist as available */
327 CvPADLIST(cv) = padlist; 288 CvPADLIST(cv) = padlist;
328 } 289 }
329 290
330 ++CvDEPTH(cv); 291 ++CvDEPTH(cv);
331 } 292 }
333 PUTBACK; 294 PUTBACK;
334 } 295 }
335} 296}
336 297
337static void 298static void
338save_state(pTHX_ Coro__State c, int flags) 299save_state(Coro__State c, int flags)
339{ 300{
340 { 301 {
341 dSP; 302 dSP;
342 I32 cxix = cxstack_ix; 303 I32 cxix = cxstack_ix;
343 PERL_CONTEXT *ccstk = cxstack; 304 PERL_CONTEXT *ccstk = cxstack;
371 } 332 }
372 333
373 PUSHs ((SV *)CvPADLIST(cv)); 334 PUSHs ((SV *)CvPADLIST(cv));
374 PUSHs ((SV *)cv); 335 PUSHs ((SV *)cv);
375 336
376 get_padlist (aTHX_ cv); 337 get_padlist (cv);
377 } 338 }
378 } 339 }
379#ifdef CXt_FORMAT 340#ifdef CXt_FORMAT
380 else if (CxTYPE(cx) == CXt_FORMAT) 341 else if (CxTYPE(cx) == CXt_FORMAT)
381 { 342 {
399 360
400 c->defav = flags & TRANSFER_SAVE_DEFAV ? (AV *)SvREFCNT_inc (GvAV (PL_defgv)) : 0; 361 c->defav = flags & TRANSFER_SAVE_DEFAV ? (AV *)SvREFCNT_inc (GvAV (PL_defgv)) : 0;
401 c->defsv = flags & TRANSFER_SAVE_DEFSV ? SvREFCNT_inc (DEFSV) : 0; 362 c->defsv = flags & TRANSFER_SAVE_DEFSV ? SvREFCNT_inc (DEFSV) : 0;
402 c->errsv = flags & TRANSFER_SAVE_ERRSV ? SvREFCNT_inc (ERRSV) : 0; 363 c->errsv = flags & TRANSFER_SAVE_ERRSV ? SvREFCNT_inc (ERRSV) : 0;
403 364
404 c->dowarn = PL_dowarn; 365#define VAR(name,type)c->name = PL_ ## name;
405 c->in_eval = PL_in_eval; 366# include "state.h"
406 367#undef VAR
407 c->curstackinfo = PL_curstackinfo;
408 c->curstack = PL_curstack;
409 c->mainstack = PL_mainstack;
410 c->stack_sp = PL_stack_sp;
411 c->op = PL_op;
412 c->curpad = PL_curpad;
413 c->comppad = PL_comppad;
414 c->compcv = PL_compcv;
415 c->stack_base = PL_stack_base;
416 c->stack_max = PL_stack_max;
417 c->tmps_stack = PL_tmps_stack;
418 c->tmps_floor = PL_tmps_floor;
419 c->tmps_ix = PL_tmps_ix;
420 c->tmps_max = PL_tmps_max;
421 c->markstack = PL_markstack;
422 c->markstack_ptr = PL_markstack_ptr;
423 c->markstack_max = PL_markstack_max;
424 c->scopestack = PL_scopestack;
425 c->scopestack_ix = PL_scopestack_ix;
426 c->scopestack_max = PL_scopestack_max;
427 c->savestack = PL_savestack;
428 c->savestack_ix = PL_savestack_ix;
429 c->savestack_max = PL_savestack_max;
430#if PERL_VERSION < 9
431 c->retstack = PL_retstack;
432 c->retstack_ix = PL_retstack_ix;
433 c->retstack_max = PL_retstack_max;
434#endif
435 c->curpm = PL_curpm;
436 c->curcop = PL_curcop;
437} 368}
438 369
439/* 370/*
440 * allocate various perl stacks. This is an exact copy 371 * allocate various perl stacks. This is an exact copy
441 * of perl.c:init_stacks, except that it uses less memory 372 * of perl.c:init_stacks, except that it uses less memory
442 * on the (sometimes correct) assumption that coroutines do 373 * on the (sometimes correct) assumption that coroutines do
443 * not usually need a lot of stackspace. 374 * not usually need a lot of stackspace.
444 */ 375 */
445static void 376static void
446coro_init_stacks (pTHX) 377coro_init_stacks ()
447{ 378{
448 LOCK;
449
450 PL_curstackinfo = new_stackinfo(96, 1024/sizeof(PERL_CONTEXT) - 1); 379 PL_curstackinfo = new_stackinfo(96, 1024/sizeof(PERL_CONTEXT) - 1);
451 PL_curstackinfo->si_type = PERLSI_MAIN; 380 PL_curstackinfo->si_type = PERLSI_MAIN;
452 PL_curstack = PL_curstackinfo->si_stack; 381 PL_curstack = PL_curstackinfo->si_stack;
453 PL_mainstack = PL_curstack; /* remember in case we switch stacks */ 382 PL_mainstack = PL_curstack; /* remember in case we switch stacks */
454 383
475 404
476 New(54,PL_savestack,96,ANY); 405 New(54,PL_savestack,96,ANY);
477 PL_savestack_ix = 0; 406 PL_savestack_ix = 0;
478 PL_savestack_max = 96; 407 PL_savestack_max = 96;
479 408
480#if PERL_VERSION < 9 409#if !PERL_VERSION_ATLEAST (5,9,0)
481 New(54,PL_retstack,8,OP*); 410 New(54,PL_retstack,8,OP*);
482 PL_retstack_ix = 0; 411 PL_retstack_ix = 0;
483 PL_retstack_max = 8; 412 PL_retstack_max = 8;
484#endif 413#endif
485
486 UNLOCK;
487} 414}
488 415
489/* 416/*
490 * destroy the stacks, the callchain etc... 417 * destroy the stacks, the callchain etc...
491 */ 418 */
492static void 419static void
493destroy_stacks(pTHX) 420coro_destroy_stacks ()
494{ 421{
495 if (!IN_DESTRUCT) 422 if (!IN_DESTRUCT)
496 { 423 {
497 /* is this ugly, I ask? */ 424 /* is this ugly, I ask? */
498 LEAVE_SCOPE (0); 425 LEAVE_SCOPE (0);
529 456
530 Safefree (PL_tmps_stack); 457 Safefree (PL_tmps_stack);
531 Safefree (PL_markstack); 458 Safefree (PL_markstack);
532 Safefree (PL_scopestack); 459 Safefree (PL_scopestack);
533 Safefree (PL_savestack); 460 Safefree (PL_savestack);
534#if PERL_VERSION < 9 461#if !PERL_VERSION_ATLEAST (5,9,0)
535 Safefree (PL_retstack); 462 Safefree (PL_retstack);
536#endif 463#endif
537} 464}
538 465
539static void 466static void
540setup_coro (struct coro *coro) 467setup_coro (struct coro *coro)
541{ 468{
542 /* 469 /*
543 * emulate part of the perl startup here. 470 * emulate part of the perl startup here.
544 */ 471 */
545 dTHX;
546 dSP;
547 UNOP myop;
548 SV *sub_init = (SV *)get_cv ("Coro::State::coro_init", FALSE);
549 472
550 coro_init_stacks (aTHX); 473 coro_init_stacks ();
474
551 /*PL_curcop = 0;*/ 475 PL_curcop = 0;
552 /*PL_in_eval = PL_in_eval;*/ /* inherit */ 476 PL_in_eval = 0;
477 PL_curpm = 0;
478
479 {
480 dSP;
481 LOGOP myop;
482
483 /* I have no idea why this is needed, but it is */
484 PUSHMARK (SP);
485
553 SvREFCNT_dec (GvAV (PL_defgv)); 486 SvREFCNT_dec (GvAV (PL_defgv));
554 GvAV (PL_defgv) = coro->args; coro->args = 0; 487 GvAV (PL_defgv) = coro->args; coro->args = 0;
555 488
556 SPAGAIN;
557
558 Zero (&myop, 1, UNOP); 489 Zero (&myop, 1, LOGOP);
559 myop.op_next = Nullop; 490 myop.op_next = Nullop;
560 myop.op_flags = OPf_WANT_VOID; 491 myop.op_flags = OPf_WANT_VOID;
561 492
562 PL_op = (OP *)&myop; 493 PL_op = (OP *)&myop;
563 494
564 PUSHMARK(SP); 495 PUSHMARK (SP);
565 XPUSHs (sub_init); 496 XPUSHs ((SV *)get_cv ("Coro::State::_coro_init", FALSE));
566 PUTBACK; 497 PUTBACK;
567 PL_op = PL_ppaddr[OP_ENTERSUB](aTHX); 498 PL_op = PL_ppaddr[OP_ENTERSUB](aTHX);
568 SPAGAIN; 499 SPAGAIN;
569 500
570 ENTER; /* necessary e.g. for dounwind */ 501 ENTER; /* necessary e.g. for dounwind */
502 }
571} 503}
572 504
573static void 505static void
574free_coro_mortal () 506free_coro_mortal ()
575{ 507{
578 SvREFCNT_dec (coro_mortal); 510 SvREFCNT_dec (coro_mortal);
579 coro_mortal = 0; 511 coro_mortal = 0;
580 } 512 }
581} 513}
582 514
515static void NOINLINE
516prepare_cctx (coro_cctx *cctx)
517{
518 dSP;
519 LOGOP myop;
520
521 Zero (&myop, 1, LOGOP);
522 myop.op_next = PL_op;
523 myop.op_flags = OPf_WANT_VOID;
524
525 sv_setiv (get_sv ("Coro::State::_cctx", FALSE), PTR2IV (cctx));
526
527 PUSHMARK (SP);
528 XPUSHs ((SV *)get_cv ("Coro::State::_cctx_init", FALSE));
529 PUTBACK;
530 PL_restartop = PL_ppaddr[OP_ENTERSUB](aTHX);
531 SPAGAIN;
532}
533
583static void 534static void
584coro_run (void *arg) 535coro_run (void *arg)
585{ 536{
537 /* coro_run is the alternative epilogue of transfer() */
538 UNLOCK;
539
586 /* 540 /*
587 * this is a _very_ stripped down perl interpreter ;) 541 * this is a _very_ stripped down perl interpreter ;)
588 */ 542 */
589 dTHX;
590
591 UNLOCK;
592
593 PL_top_env = &PL_start_env; 543 PL_top_env = &PL_start_env;
594 544
595 sv_setiv (get_sv ("Coro::State::cctx_stack", FALSE), PTR2IV ((coro_stack *)arg)); 545 /* inject call to cctx_init */
596 sv_setiv (get_sv ("Coro::State::cctx_restartop", FALSE), PTR2IV (PL_op)); 546 prepare_cctx ((coro_cctx *)arg);
597 547
598 /* continue at cctx_init, without entersub */
599 PL_restartop = CvSTART (get_cv ("Coro::State::cctx_init", FALSE));
600
601 /* somebody will hit me for both perl_run and PL_restart_op */ 548 /* somebody will hit me for both perl_run and PL_restartop */
602 perl_run (aTHX_ PERL_GET_CONTEXT); 549 perl_run (PL_curinterp);
603 550
551 fputs ("FATAL: C coroutine fell over the edge of the world, aborting. Did you call exit in a coroutine?\n", stderr);
604 abort (); 552 abort ();
605} 553}
606 554
607static coro_stack * 555static coro_cctx *
608stack_new () 556cctx_new ()
609{ 557{
610 coro_stack *stack; 558 coro_cctx *cctx;
611 559
560 ++cctx_count;
561
612 New (0, stack, 1, coro_stack); 562 New (0, cctx, 1, coro_cctx);
613 563
614#if HAVE_MMAP 564#if HAVE_MMAP
615 565
616 stack->ssize = ((STACKSIZE * sizeof (long) + PAGESIZE - 1) / PAGESIZE + STACKGUARD) * PAGESIZE; /* mmap should do allocate-on-write for us */ 566 cctx->ssize = ((STACKSIZE * sizeof (long) + PAGESIZE - 1) / PAGESIZE + STACKGUARD) * PAGESIZE;
567 /* mmap suppsedly does allocate-on-write for us */
617 stack->sptr = mmap (0, stack->ssize, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); 568 cctx->sptr = mmap (0, cctx->ssize, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
618 569
619 if (stack->sptr == (void *)-1) 570 if (cctx->sptr == (void *)-1)
620 { 571 {
621 perror ("FATAL: unable to mmap stack for coroutine"); 572 perror ("FATAL: unable to mmap stack for coroutine");
622 _exit (EXIT_FAILURE); 573 _exit (EXIT_FAILURE);
623 } 574 }
624 575
576# if STACKGUARD
625 mprotect (stack->sptr, STACKGUARD * PAGESIZE, PROT_NONE); 577 mprotect (cctx->sptr, STACKGUARD * PAGESIZE, PROT_NONE);
578# endif
626 579
627#else 580#else
628 581
629 stack->ssize = STACKSIZE * (long)sizeof (long); 582 cctx->ssize = STACKSIZE * (long)sizeof (long);
630 New (0, stack->sptr, STACKSIZE, long); 583 New (0, cctx->sptr, STACKSIZE, long);
631 584
632 if (!stack->sptr) 585 if (!cctx->sptr)
633 { 586 {
634 perror (stderr, "FATAL: unable to malloc stack for coroutine"); 587 perror ("FATAL: unable to malloc stack for coroutine");
635 _exit (EXIT_FAILURE); 588 _exit (EXIT_FAILURE);
636 } 589 }
637 590
638#endif 591#endif
639 592
593#if USE_VALGRIND
594 cctx->valgrind_id = VALGRIND_STACK_REGISTER (
595 STACKGUARD * PAGESIZE + (char *)cctx->sptr,
596 cctx->ssize + (char *)cctx->sptr
597 );
598#endif
599
640 coro_create (&stack->cctx, coro_run, (void *)stack, stack->sptr, stack->ssize); 600 coro_create (&cctx->cctx, coro_run, (void *)cctx, cctx->sptr, cctx->ssize);
641 601
642 return stack; 602 return cctx;
643} 603}
644 604
645static void 605static void
646stack_free (coro_stack *stack) 606cctx_free (coro_cctx *cctx)
647{ 607{
648 if (!stack || stack == main_stack) 608 if (!cctx)
649 return; 609 return;
650 610
611 --cctx_count;
612
613#if USE_VALGRIND
614 VALGRIND_STACK_DEREGISTER (cctx->valgrind_id);
615#endif
616
651#if HAVE_MMAP 617#if HAVE_MMAP
652 munmap (stack->sptr, stack->ssize); 618 munmap (cctx->sptr, cctx->ssize);
653#else 619#else
654 Safefree (stack->sptr); 620 Safefree (cctx->sptr);
655#endif 621#endif
656 622
657 Safefree (stack); 623 Safefree (cctx);
658} 624}
659 625
660static coro_stack *stack_first;
661
662static coro_stack * 626static coro_cctx *
663stack_get () 627cctx_get ()
664{ 628{
665 coro_stack *stack; 629 coro_cctx *cctx;
666 630
667 if (stack_first) 631 if (cctx_first)
668 { 632 {
669 stack = stack_first; 633 --cctx_idle;
634 cctx = cctx_first;
670 stack_first = stack->next; 635 cctx_first = cctx->next;
671 } 636 }
672 else 637 else
673 { 638 {
674 stack = stack_new (); 639 cctx = cctx_new ();
675 PL_op = PL_op->op_next; 640 PL_op = PL_op->op_next;
676 } 641 }
677 642
678 return stack; 643 return cctx;
679} 644}
680 645
681static void 646static void
682stack_put (coro_stack *stack) 647cctx_put (coro_cctx *cctx)
683{ 648{
684 stack->next = stack_first; 649 ++cctx_idle;
685 stack_first = stack; 650 cctx->next = cctx_first;
651 cctx_first = cctx;
686} 652}
687 653
688/* never call directly, always through the coro_state_transfer global variable */ 654/* never call directly, always through the coro_state_transfer global variable */
689static void 655static void NOINLINE
690transfer_impl (pTHX_ struct coro *prev, struct coro *next, int flags) 656transfer (struct coro *prev, struct coro *next, int flags)
691{ 657{
692 dSTACKLEVEL; 658 dSTACKLEVEL;
693 659
694 /* sometimes transfer is only called to set idle_sp */ 660 /* sometimes transfer is only called to set idle_sp */
695 if (flags == TRANSFER_SET_STACKLEVEL) 661 if (flags == TRANSFER_SET_STACKLEVEL)
696 ((coro_stack *)prev)->idle_sp = STACKLEVEL; 662 ((coro_cctx *)prev)->idle_sp = STACKLEVEL;
697 else if (prev != next) 663 else if (prev != next)
698 { 664 {
699 coro_stack *prev__stack; 665 coro_cctx *prev__cctx;
700 666
701 LOCK; 667 LOCK;
702 668
703 if (next->mainstack) 669 if (next->mainstack)
704 { 670 {
712 /* first get rid of the old state */ 678 /* first get rid of the old state */
713 SAVE (prev, -1); 679 SAVE (prev, -1);
714 /* setup coroutine call */ 680 /* setup coroutine call */
715 setup_coro (next); 681 setup_coro (next);
716 /* need a stack */ 682 /* need a stack */
717 next->stack = 0; 683 next->cctx = 0;
718 } 684 }
719 685
686 if (!prev->cctx)
687 /* create a new empty context */
688 Newz (0, prev->cctx, 1, coro_cctx);
689
720 prev__stack = prev->stack; 690 prev__cctx = prev->cctx;
721 691
722 /* possibly "free" the stack */ 692 /* possibly "free" the cctx */
723 if (prev__stack->idle_sp == STACKLEVEL) 693 if (prev__cctx->idle_sp == STACKLEVEL)
724 { 694 {
725 stack_put (prev__stack); 695 cctx_put (prev__cctx);
726 prev->stack = 0; 696 prev->cctx = 0;
727 } 697 }
728 698
729 if (!next->stack) 699 if (!next->cctx)
730 next->stack = stack_get (); 700 next->cctx = cctx_get ();
731 701
732 if (prev__stack != next->stack) 702 if (prev__cctx != next->cctx)
733 { 703 {
734 prev__stack->top_env = PL_top_env; 704 prev__cctx->top_env = PL_top_env;
735 PL_top_env = next->stack->top_env; 705 PL_top_env = next->cctx->top_env;
736 coro_transfer (&prev__stack->cctx, &next->stack->cctx); 706 coro_transfer (&prev__cctx->cctx, &next->cctx->cctx);
737 } 707 }
738 708
739 free_coro_mortal (); 709 free_coro_mortal ();
740 710
741 UNLOCK; 711 UNLOCK;
742 } 712 }
743} 713}
744
745/* use this function pointer to call the above function */
746/* this is done to increase chances of the compiler not inlining the call */
747/* not static to make it even harder for the compiler (and theoretically impossible in most cases */
748void (*coro_state_transfer)(pTHX_ struct coro *prev, struct coro *next, int flags) = transfer_impl;
749 714
750struct transfer_args 715struct transfer_args
751{ 716{
752 struct coro *prev, *next; 717 struct coro *prev, *next;
753 int flags; 718 int flags;
754}; 719};
755 720
756#define TRANSFER(ta) coro_state_transfer ((ta).prev, (ta).next, (ta).flags) 721#define TRANSFER(ta) transfer ((ta).prev, (ta).next, (ta).flags)
757 722
758static void 723static void
759coro_state_destroy (struct coro *coro) 724coro_state_destroy (struct coro *coro)
760{ 725{
761 if (coro->refcnt--) 726 if (coro->refcnt--)
763 728
764 if (coro->mainstack && coro->mainstack != main_mainstack) 729 if (coro->mainstack && coro->mainstack != main_mainstack)
765 { 730 {
766 struct coro temp; 731 struct coro temp;
767 732
768 SAVE (aTHX_ (&temp), TRANSFER_SAVE_ALL); 733 SAVE ((&temp), TRANSFER_SAVE_ALL);
769 LOAD (aTHX_ coro); 734 LOAD (coro);
770 735
771 destroy_stacks (aTHX); 736 coro_destroy_stacks ();
772 737
773 LOAD ((&temp)); /* this will get rid of defsv etc.. */ 738 LOAD ((&temp)); /* this will get rid of defsv etc.. */
774 739
775 coro->mainstack = 0; 740 coro->mainstack = 0;
776 } 741 }
777 742
778 stack_free (coro->stack); 743 cctx_free (coro->cctx);
779 SvREFCNT_dec (coro->args); 744 SvREFCNT_dec (coro->args);
780 Safefree (coro); 745 Safefree (coro);
781} 746}
782 747
783static int 748static int
784coro_state_clear (SV *sv, MAGIC *mg) 749coro_state_clear (pTHX_ SV *sv, MAGIC *mg)
785{ 750{
786 struct coro *coro = (struct coro *)mg->mg_ptr; 751 struct coro *coro = (struct coro *)mg->mg_ptr;
787 mg->mg_ptr = 0; 752 mg->mg_ptr = 0;
788 753
789 coro_state_destroy (coro); 754 coro_state_destroy (coro);
790 755
791 return 0; 756 return 0;
792} 757}
793 758
794static int 759static int
795coro_state_dup (MAGIC *mg, CLONE_PARAMS *params) 760coro_state_dup (pTHX_ MAGIC *mg, CLONE_PARAMS *params)
796{ 761{
797 struct coro *coro = (struct coro *)mg->mg_ptr; 762 struct coro *coro = (struct coro *)mg->mg_ptr;
798 763
799 ++coro->refcnt; 764 ++coro->refcnt;
800 765
801 return 0; 766 return 0;
802} 767}
803 768
804static MGVTBL coro_state_vtbl = { 0, 0, 0, 0, coro_state_clear, 0, coro_state_dup, 0 }; 769static MGVTBL coro_state_vtbl = {
770 0, 0, 0, 0,
771 coro_state_clear,
772 0,
773#ifdef MGf_DUP
774 coro_state_dup,
775#else
776# define MGf_DUP 0
777#endif
778};
805 779
806static struct coro * 780static struct coro *
807SvSTATE (SV *coro) 781SvSTATE (SV *coro)
808{ 782{
809 HV *stash; 783 HV *stash;
824 assert (mg->mg_type == PERL_MAGIC_ext); 798 assert (mg->mg_type == PERL_MAGIC_ext);
825 return (struct coro *)mg->mg_ptr; 799 return (struct coro *)mg->mg_ptr;
826} 800}
827 801
828static void 802static void
829prepare_transfer (pTHX_ struct transfer_args *ta, SV *prev, SV *next, int flags) 803prepare_transfer (struct transfer_args *ta, SV *prev, SV *next, int flags)
830{ 804{
831 ta->prev = SvSTATE (prev); 805 ta->prev = SvSTATE (prev);
832 ta->next = SvSTATE (next); 806 ta->next = SvSTATE (next);
833 ta->flags = flags; 807 ta->flags = flags;
834} 808}
837api_transfer (SV *prev, SV *next, int flags) 811api_transfer (SV *prev, SV *next, int flags)
838{ 812{
839 dTHX; 813 dTHX;
840 struct transfer_args ta; 814 struct transfer_args ta;
841 815
842 prepare_transfer (aTHX_ &ta, prev, next, flags); 816 prepare_transfer (&ta, prev, next, flags);
843 TRANSFER (ta); 817 TRANSFER (ta);
844} 818}
845 819
846/** Coro ********************************************************************/ 820/** Coro ********************************************************************/
847 821
856static GV *coro_current, *coro_idle; 830static GV *coro_current, *coro_idle;
857static AV *coro_ready [PRIO_MAX-PRIO_MIN+1]; 831static AV *coro_ready [PRIO_MAX-PRIO_MIN+1];
858static int coro_nready; 832static int coro_nready;
859 833
860static void 834static void
861coro_enq (pTHX_ SV *sv) 835coro_enq (SV *sv)
862{ 836{
863 int prio; 837 int prio;
864 838
865 if (SvTYPE (sv) != SVt_PVHV) 839 if (SvTYPE (sv) != SVt_PVHV)
866 croak ("Coro::ready tried to enqueue something that is not a coroutine"); 840 croak ("Coro::ready tried to enqueue something that is not a coroutine");
870 av_push (coro_ready [prio - PRIO_MIN], sv); 844 av_push (coro_ready [prio - PRIO_MIN], sv);
871 coro_nready++; 845 coro_nready++;
872} 846}
873 847
874static SV * 848static SV *
875coro_deq (pTHX_ int min_prio) 849coro_deq (int min_prio)
876{ 850{
877 int prio = PRIO_MAX - PRIO_MIN; 851 int prio = PRIO_MAX - PRIO_MIN;
878 852
879 min_prio -= PRIO_MIN; 853 min_prio -= PRIO_MIN;
880 if (min_prio < 0) 854 if (min_prio < 0)
897 871
898 if (SvROK (coro)) 872 if (SvROK (coro))
899 coro = SvRV (coro); 873 coro = SvRV (coro);
900 874
901 LOCK; 875 LOCK;
902 coro_enq (aTHX_ SvREFCNT_inc (coro)); 876 coro_enq (SvREFCNT_inc (coro));
903 UNLOCK; 877 UNLOCK;
904} 878}
905 879
906static void 880static void
907prepare_schedule (aTHX_ struct transfer_args *ta) 881prepare_schedule (struct transfer_args *ta)
908{ 882{
909 SV *current, *prev, *next; 883 SV *current, *prev, *next;
910
911 LOCK;
912 884
913 current = GvSV (coro_current); 885 current = GvSV (coro_current);
914 886
915 for (;;) 887 for (;;)
916 { 888 {
917 LOCK; 889 LOCK;
918
919 next = coro_deq (aTHX_ PRIO_MIN); 890 next = coro_deq (PRIO_MIN);
891 UNLOCK;
920 892
921 if (next) 893 if (next)
922 break; 894 break;
923
924 UNLOCK;
925 895
926 { 896 {
927 dSP; 897 dSP;
928 898
929 ENTER; 899 ENTER;
940 910
941 prev = SvRV (current); 911 prev = SvRV (current);
942 SvRV (current) = next; 912 SvRV (current) = next;
943 913
944 /* free this only after the transfer */ 914 /* free this only after the transfer */
915 LOCK;
945 free_coro_mortal (); 916 free_coro_mortal ();
917 UNLOCK;
946 coro_mortal = prev; 918 coro_mortal = prev;
947 919
948 ta->prev = SvSTATE (prev); 920 ta->prev = SvSTATE (prev);
949 ta->next = SvSTATE (next); 921 ta->next = SvSTATE (next);
950 ta->flags = TRANSFER_SAVE_ALL; 922 ta->flags = TRANSFER_SAVE_ALL;
951
952 UNLOCK;
953} 923}
954 924
955static void 925static void
956prepare_cede (aTHX_ struct transfer_args *ta) 926prepare_cede (struct transfer_args *ta)
957{ 927{
958 LOCK; 928 LOCK;
959 coro_enq (aTHX_ SvREFCNT_inc (SvRV (GvSV (coro_current)))); 929 coro_enq (SvREFCNT_inc (SvRV (GvSV (coro_current))));
960 UNLOCK; 930 UNLOCK;
961 931
962 prepare_schedule (ta); 932 prepare_schedule (ta);
963} 933}
964 934
1002 main_mainstack = PL_mainstack; 972 main_mainstack = PL_mainstack;
1003 973
1004 coroapi.ver = CORO_API_VERSION; 974 coroapi.ver = CORO_API_VERSION;
1005 coroapi.transfer = api_transfer; 975 coroapi.transfer = api_transfer;
1006 976
1007 Newz (0, main_stack, 1, coro_stack);
1008 main_stack->idle_sp = (void *)-1;
1009
1010 assert (("PRIO_NORMAL must be 0", !PRIO_NORMAL)); 977 assert (("PRIO_NORMAL must be 0", !PRIO_NORMAL));
1011} 978}
1012 979
1013SV * 980SV *
1014new (char *klass, ...) 981new (char *klass, ...)
1025 sv_magicext ((SV *)hv, 0, PERL_MAGIC_ext, &coro_state_vtbl, (char *)coro, 0)->mg_flags |= MGf_DUP; 992 sv_magicext ((SV *)hv, 0, PERL_MAGIC_ext, &coro_state_vtbl, (char *)coro, 0)->mg_flags |= MGf_DUP;
1026 RETVAL = sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1)); 993 RETVAL = sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1));
1027 994
1028 for (i = 1; i < items; i++) 995 for (i = 1; i < items; i++)
1029 av_push (coro->args, newSVsv (ST (i))); 996 av_push (coro->args, newSVsv (ST (i)));
1030
1031 coro->stack = main_stack;
1032 /*coro->mainstack = 0; *//*actual work is done inside transfer */
1033 /*coro->stack = 0;*/
1034} 997}
1035 OUTPUT: 998 OUTPUT:
1036 RETVAL 999 RETVAL
1037 1000
1038void 1001void
1039transfer (...) 1002_set_stacklevel (...)
1040 ALIAS: 1003 ALIAS:
1041 Coro::schedule = 1 1004 Coro::State::transfer = 1
1042 Coro::cede = 2 1005 Coro::schedule = 2
1043 _set_stacklevel = 3 1006 Coro::cede = 3
1007 Coro::Cont::yield = 4
1044 CODE: 1008 CODE:
1045{ 1009{
1046 struct transfer_args ta; 1010 struct transfer_args ta;
1047 1011
1048 switch (ix) 1012 switch (ix)
1049 { 1013 {
1050 case 0: 1014 case 0:
1051 if (items != 3)
1052 croak ("Coro::State::transfer(prev,next,flags) expects three arguments, not %d", items);
1053
1054 prepare_transfer (&ta, ST (0), ST (1), SvIV (ST (2)));
1055 break;
1056
1057 case 1:
1058 prepare_schedule (&ta);
1059 break;
1060
1061 case 2:
1062 prepare_cede (&ta);
1063 break;
1064
1065 case 3:
1066 ta.prev = (struct coro *)INT2PTR (coro_stack *, SvIV (ST (0))); 1015 ta.prev = (struct coro *)INT2PTR (coro_cctx *, SvIV (ST (0)));
1067 ta.next = 0; 1016 ta.next = 0;
1068 ta.flags = TRANSFER_SET_STACKLEVEL; 1017 ta.flags = TRANSFER_SET_STACKLEVEL;
1069 break; 1018 break;
1019
1020 case 1:
1021 if (items != 3)
1022 croak ("Coro::State::transfer(prev,next,flags) expects three arguments, not %d", items);
1023
1024 prepare_transfer (&ta, ST (0), ST (1), SvIV (ST (2)));
1025 break;
1026
1027 case 2:
1028 prepare_schedule (&ta);
1029 break;
1030
1031 case 3:
1032 prepare_cede (&ta);
1033 break;
1034
1035 case 4:
1036 {
1037 SV *yieldstack;
1038 SV *sv;
1039 AV *defav = GvAV (PL_defgv);
1040
1041 yieldstack = *hv_fetch (
1042 (HV *)SvRV (GvSV (coro_current)),
1043 "yieldstack", sizeof ("yieldstack") - 1,
1044 0
1045 );
1046
1047 /* set up @_ -- ugly */
1048 av_clear (defav);
1049 av_fill (defav, items - 1);
1050 while (items--)
1051 av_store (defav, items, SvREFCNT_inc (ST(items)));
1052
1053 sv = av_pop ((AV *)SvRV (yieldstack));
1054 ta.prev = SvSTATE (*av_fetch ((AV *)SvRV (sv), 0, 0));
1055 ta.next = SvSTATE (*av_fetch ((AV *)SvRV (sv), 1, 0));
1056 ta.flags = 0;
1057 SvREFCNT_dec (sv);
1058 }
1059 break;
1060
1070 } 1061 }
1071 1062
1072 TRANSFER (ta); 1063 TRANSFER (ta);
1073} 1064}
1074 1065
1081 sv_unmagic (SvRV (dst), PERL_MAGIC_ext); 1072 sv_unmagic (SvRV (dst), PERL_MAGIC_ext);
1082 1073
1083 ++coro_src->refcnt; 1074 ++coro_src->refcnt;
1084 sv_magicext (SvRV (dst), 0, PERL_MAGIC_ext, &coro_state_vtbl, (char *)coro_src, 0)->mg_flags |= MGf_DUP; 1075 sv_magicext (SvRV (dst), 0, PERL_MAGIC_ext, &coro_state_vtbl, (char *)coro_src, 0)->mg_flags |= MGf_DUP;
1085} 1076}
1086
1087void
1088_nonlocal_goto (IV nextop)
1089 CODE:
1090 /* uuh, somebody will kill me again for this */
1091 PL_op->op_next = INT2PTR (OP *, nextop);
1092 1077
1093void 1078void
1094_exit (code) 1079_exit (code)
1095 int code 1080 int code
1096 PROTOTYPE: $ 1081 PROTOTYPE: $
1097 CODE: 1082 CODE:
1098 _exit (code); 1083 _exit (code);
1099 1084
1100MODULE = Coro::State PACKAGE = Coro::Cont 1085int
1086cctx_count ()
1087 CODE:
1088 RETVAL = cctx_count;
1089 OUTPUT:
1090 RETVAL
1101 1091
1102void 1092int
1103yield (...) 1093cctx_idle ()
1104 PROTOTYPE: @ 1094 CODE:
1105 CODE: 1095 RETVAL = cctx_idle;
1106{ 1096 OUTPUT:
1107 SV *yieldstack; 1097 RETVAL
1108 SV *sv;
1109 AV *defav = GvAV (PL_defgv);
1110 struct coro *prev, *next;
1111
1112 yieldstack = *hv_fetch (
1113 (HV *)SvRV (GvSV (coro_current)),
1114 "yieldstack", sizeof ("yieldstack") - 1,
1115 0
1116 );
1117
1118 /* set up @_ -- ugly */
1119 av_clear (defav);
1120 av_fill (defav, items - 1);
1121 while (items--)
1122 av_store (defav, items, SvREFCNT_inc (ST(items)));
1123
1124 sv = av_pop ((AV *)SvRV (yieldstack));
1125 prev = SvSTATE (*av_fetch ((AV *)SvRV (sv), 0, 0));
1126 next = SvSTATE (*av_fetch ((AV *)SvRV (sv), 1, 0));
1127 SvREFCNT_dec (sv);
1128
1129 coro_state_transfer (aTHX_ prev, next, 0);
1130}
1131 1098
1132MODULE = Coro::State PACKAGE = Coro 1099MODULE = Coro::State PACKAGE = Coro
1133 1100
1134BOOT: 1101BOOT:
1135{ 1102{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines