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.418 by root, Mon Feb 20 00:03:07 2012 UTC vs.
Revision 1.419 by root, Mon Feb 20 08:13:25 2012 UTC

101# if CORO_PTHREAD 101# if CORO_PTHREAD
102static void *coro_thx; 102static void *coro_thx;
103# endif 103# endif
104#endif 104#endif
105 105
106/* used in state.h */
107#define VAR(name,type) VARx(name, PL_ ## name, type)
108
109#ifdef __linux 106#ifdef __linux
110# include <time.h> /* for timespec */ 107# include <time.h> /* for timespec */
111# include <syscall.h> /* for SYS_* */ 108# include <syscall.h> /* for SYS_* */
112# ifdef SYS_clock_gettime 109# ifdef SYS_clock_gettime
113# define coro_clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts)) 110# define coro_clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts))
213}; 210};
214 211
215/* the structure where most of the perl state is stored, overlaid on the cxstack */ 212/* the structure where most of the perl state is stored, overlaid on the cxstack */
216typedef struct 213typedef struct
217{ 214{
218#define VARx(name,expr,type) type name; 215 #define VARx(name,expr,type) type name;
219# include "state.h" 216 #include "state.h"
220#undef VARx
221} perl_slots; 217} perl_slots;
222 218
223/* how many context stack entries do we need for perl_slots */ 219/* how many context stack entries do we need for perl_slots */
224#define SLOT_COUNT ((sizeof (perl_slots) + sizeof (PERL_CONTEXT) - 1) / sizeof (PERL_CONTEXT)) 220#define SLOT_COUNT ((sizeof (perl_slots) + sizeof (PERL_CONTEXT) - 1) / sizeof (PERL_CONTEXT))
225 221
710 706
711#if CORO_JIT 707#if CORO_JIT
712 load_perl_slots (slot); 708 load_perl_slots (slot);
713#else 709#else
714 #define VARx(name,expr,type) expr = slot->name; 710 #define VARx(name,expr,type) expr = slot->name;
715 # include "state.h" 711 #include "state.h"
716 #undef VARx
717#endif 712#endif
718 713
719 { 714 {
720 dSP; 715 dSP;
721 716
843 838
844#if CORO_JIT 839#if CORO_JIT
845 save_perl_slots (slot); 840 save_perl_slots (slot);
846#else 841#else
847 #define VARx(name,expr,type) slot->name = expr; 842 #define VARx(name,expr,type) slot->name = expr;
848 # include "state.h" 843 #include "state.h"
849 #undef VARx
850#endif 844#endif
851 } 845 }
852} 846}
853 847
854/* 848/*
3401 int count; 3395 int count;
3402 3396
3403 eval_pv ("require 'Coro/jit-" CORO_JIT_TYPE ".pl'", 1); 3397 eval_pv ("require 'Coro/jit-" CORO_JIT_TYPE ".pl'", 1);
3404 3398
3405 PUSHMARK (SP); 3399 PUSHMARK (SP);
3406#define VARx(name,expr,type) pushav_4uv (aTHX_ (UV)&(expr), sizeof (expr), offsetof (perl_slots, name), sizeof (type)); 3400 #define VARx(name,expr,type) pushav_4uv (aTHX_ (UV)&(expr), sizeof (expr), offsetof (perl_slots, name), sizeof (type));
3407# include "state.h" 3401 #include "state.h"
3408#undef VARx
3409 count = call_pv ("Coro::State::_jit", G_ARRAY); 3402 count = call_pv ("Coro::State::_jit", G_ARRAY);
3410 SPAGAIN; 3403 SPAGAIN;
3411 3404
3412 save = POPs; save_ptr = SvPVbyte (save, save_len); 3405 save = POPs; save_ptr = SvPVbyte (save, save_len);
3413 load = POPs; load_ptr = SvPVbyte (load, load_len); 3406 load = POPs; load_ptr = SvPVbyte (load, load_len);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines