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.425 by root, Wed Dec 5 00:14:22 2012 UTC vs.
Revision 1.437 by root, Tue Nov 5 15:13:42 2013 UTC

1/* this works around a bug in mingw32 providing a non-working setjmp */ 1/* this works around a bug in mingw32 providing a non-working setjmp */
2#define USE_NO_MINGW_SETJMP_TWO_ARGS 2#define USE_NO_MINGW_SETJMP_TWO_ARGS
3 3
4#define NDEBUG 1 4#define NDEBUG 1 /* perl usually disables NDEBUG later */
5 5
6#include "libcoro/coro.c" 6#include "libcoro/coro.c"
7 7
8#define PERL_NO_GET_CONTEXT 8#define PERL_NO_GET_CONTEXT
9#define PERL_EXT 9#define PERL_EXT
26#ifndef SVs_PADSTALE 26#ifndef SVs_PADSTALE
27# define SVs_PADSTALE 0 27# define SVs_PADSTALE 0
28#endif 28#endif
29 29
30#ifdef PadARRAY 30#ifdef PadARRAY
31# define NEWPADAPI 31# define NEWPADAPI 1
32# define newPADLIST(var) (Newz (0, var, 1, PADLIST), Newx (PadlistARRAY (var), 2, PAD *)) 32# define newPADLIST(var) (Newz (0, var, 1, PADLIST), Newx (PadlistARRAY (var), 2, PAD *))
33#else 33#else
34typedef AV PADNAMELIST; 34typedef AV PADNAMELIST;
35# if !PERL_VERSION_ATLEAST(5,8,0) 35# if !PERL_VERSION_ATLEAST(5,8,0)
36typedef AV PADLIST; 36typedef AV PADLIST;
42# define PadARRAY AvARRAY 42# define PadARRAY AvARRAY
43# define PadMAX AvFILLp 43# define PadMAX AvFILLp
44# define newPADLIST(var) ((var) = newAV (), av_extend (var, 1)) 44# define newPADLIST(var) ((var) = newAV (), av_extend (var, 1))
45#endif 45#endif
46 46
47/* 5.19.something has replaced SVt_BIND by SVt_INVLIST */
48/* we just alias it to SVt_IV, as that is sufficient for swap_sv for now */
49#if PERL_VERSION_ATLEAST(5,19,0)
50# define SVt_BIND SVt_IV
51#endif
52
47#if defined(_WIN32) 53#if defined(_WIN32)
48# undef HAS_GETTIMEOFDAY 54# undef HAS_GETTIMEOFDAY
49# undef setjmp 55# undef setjmp
50# undef longjmp 56# undef longjmp
51# undef _exit 57# undef _exit
52# define setjmp _setjmp /* deep magic */ 58# define setjmp _setjmp /* deep magic */
53#else 59#else
54# include <inttypes.h> /* most portable stdint.h */ 60# include <inttypes.h> /* most portable stdint.h */
55#endif 61#endif
56 62
57#if HAVE_MMAP
58# include <unistd.h>
59# include <sys/mman.h>
60# ifndef MAP_ANONYMOUS
61# ifdef MAP_ANON
62# define MAP_ANONYMOUS MAP_ANON
63# else
64# undef HAVE_MMAP
65# endif
66# endif
67# include <limits.h>
68# ifndef PAGESIZE
69# define PAGESIZE pagesize
70# define BOOT_PAGESIZE pagesize = sysconf (_SC_PAGESIZE)
71static long pagesize;
72# else
73# define BOOT_PAGESIZE (void)0
74# endif
75#else
76# define PAGESIZE 0
77# define BOOT_PAGESIZE (void)0
78#endif
79
80#if CORO_USE_VALGRIND
81# include <valgrind/valgrind.h>
82#endif
83
84/* the maximum number of idle cctx that will be pooled */ 63/* the maximum number of idle cctx that will be pooled */
85static int cctx_max_idle = 4; 64static int cctx_max_idle = 4;
86 65
87#if defined(DEBUGGING) && PERL_VERSION_ATLEAST(5,12,0) 66#if defined(DEBUGGING) && PERL_VERSION_ATLEAST(5,12,0)
88# define HAS_SCOPESTACK_NAME 1 67# define HAS_SCOPESTACK_NAME 1
89#endif
90
91#if !__i386 && !__x86_64 && !__powerpc && !__m68k && !__alpha && !__mips && !__sparc64
92# undef CORO_STACKGUARD
93#endif
94
95#ifndef CORO_STACKGUARD
96# define CORO_STACKGUARD 0
97#endif 68#endif
98 69
99/* prefer perl internal functions over our own? */ 70/* prefer perl internal functions over our own? */
100#ifndef CORO_PREFER_PERL_FUNCTIONS 71#ifndef CORO_PREFER_PERL_FUNCTIONS
101# define CORO_PREFER_PERL_FUNCTIONS 0 72# define CORO_PREFER_PERL_FUNCTIONS 0
192typedef struct coro_cctx 163typedef struct coro_cctx
193{ 164{
194 struct coro_cctx *next; 165 struct coro_cctx *next;
195 166
196 /* the stack */ 167 /* the stack */
197 void *sptr; 168 struct coro_stack stack;
198 size_t ssize;
199 169
200 /* cpu state */ 170 /* cpu state */
201 void *idle_sp; /* sp of top-level transfer/schedule/cede call */ 171 void *idle_sp; /* sp of top-level transfer/schedule/cede call */
202#ifndef NDEBUG 172#ifndef NDEBUG
203 JMPENV *idle_te; /* same as idle_sp, but for top_env */ 173 JMPENV *idle_te; /* same as idle_sp, but for top_env */
312#define coro_nready coroapi.nready 282#define coro_nready coroapi.nready
313 283
314/** JIT *********************************************************************/ 284/** JIT *********************************************************************/
315 285
316#if CORO_JIT 286#if CORO_JIT
317 /* APPLE doesn't have HAVE_MMAP though */ 287 /* APPLE doesn't have mmap though */
318 #define CORO_JIT_UNIXY (__linux || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __solaris || __APPLE__) 288 #define CORO_JIT_UNIXY (__linux || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __solaris || __APPLE__)
319 #ifndef CORO_JIT_TYPE 289 #ifndef CORO_JIT_TYPE
320 #if __x86_64 && CORO_JIT_UNIXY 290 #if ECB_AMD64 && CORO_JIT_UNIXY
321 #define CORO_JIT_TYPE "amd64-unix" 291 #define CORO_JIT_TYPE "amd64-unix"
322 #elif __i386 && CORO_JIT_UNIXY 292 #elif __i386 && CORO_JIT_UNIXY
323 #define CORO_JIT_TYPE "x86-unix" 293 #define CORO_JIT_TYPE "x86-unix"
324 #endif 294 #endif
325 #endif 295 #endif
326#endif 296#endif
327 297
328#if !defined(CORO_JIT_TYPE) || !HAVE_MMAP 298#if !defined(CORO_JIT_TYPE) || _POSIX_MEMORY_PROTECTION <= 0
329 #undef CORO_JIT 299 #undef CORO_JIT
330#endif 300#endif
331 301
332#if CORO_JIT 302#if CORO_JIT
333 typedef void (*load_save_perl_slots_type)(perl_slots *); 303 typedef void (*load_save_perl_slots_type)(perl_slots *);
547coro_derive_padlist (pTHX_ CV *cv) 517coro_derive_padlist (pTHX_ CV *cv)
548{ 518{
549 PADLIST *padlist = CvPADLIST (cv); 519 PADLIST *padlist = CvPADLIST (cv);
550 PADLIST *newpadlist; 520 PADLIST *newpadlist;
551 PAD *newpad; 521 PAD *newpad;
552 PADOFFSET const off = PadlistMAX (padlist) + 1; 522 PADOFFSET off = PadlistMAX (padlist) + 1;
553 523
554 newPADLIST(newpadlist); 524#if NEWPADAPI
555#if !PERL_VERSION_ATLEAST(5,15,3) 525
556 /* Padlists are AvREAL as of 5.15.3. See perl bug #98092 and perl commit 7d953ba. */ 526 /* if we had the original CvDEPTH, we might be able to steal the CvDEPTH+1 entry instead */
557 AvREAL_off (newpadlist); 527 /* 20131102194744.GA6705@schmorp.de, 20131102195825.2013.qmail@lists-nntp.develooper.com */
558#endif 528 while (!PadlistARRAY (padlist)[off - 1])
529 --off;
530
531 Perl_pad_push (aTHX_ padlist, off);
532
533 newpad = PadlistARRAY (padlist)[off];
534 PadlistARRAY (padlist)[off] = 0;
535
536#else
537
559#if PERL_VERSION_ATLEAST (5,10,0) 538#if PERL_VERSION_ATLEAST (5,10,0)
560 Perl_pad_push (aTHX_ padlist, off); 539 Perl_pad_push (aTHX_ padlist, off);
561#else 540#else
562 Perl_pad_push (aTHX_ padlist, off, 1); 541 Perl_pad_push (aTHX_ padlist, off, 1);
563#endif 542#endif
543
564 newpad = PadlistARRAY (padlist)[off]; 544 newpad = PadlistARRAY (padlist)[off];
565 PadlistMAX (padlist) = off - 1; 545 PadlistMAX (padlist) = off - 1;
546
547#endif
548
549 newPADLIST (newpadlist);
550#if !PERL_VERSION_ATLEAST(5,15,3)
551 /* Padlists are AvREAL as of 5.15.3. See perl bug #98092 and perl commit 7d953ba. */
552 AvREAL_off (newpadlist);
553#endif
566 554
567 /* Already extended to 2 elements by newPADLIST. */ 555 /* Already extended to 2 elements by newPADLIST. */
568 PadlistMAX (newpadlist) = 1; 556 PadlistMAX (newpadlist) = 1;
569 PadlistNAMES (newpadlist) = (PADNAMELIST *)SvREFCNT_inc_NN (PadlistNAMES (padlist)); 557 PadlistNAMES (newpadlist) = (PADNAMELIST *)SvREFCNT_inc_NN (PadlistNAMES (padlist));
570 PadlistARRAY (newpadlist)[1] = newpad; 558 PadlistARRAY (newpadlist)[1] = newpad;
593 SvREFCNT_dec (pad); 581 SvREFCNT_dec (pad);
594 } 582 }
595 583
596 SvREFCNT_dec (PadlistNAMES (padlist)); 584 SvREFCNT_dec (PadlistNAMES (padlist));
597 585
598#ifdef NEWPADAPI 586#if NEWPADAPI
599 Safefree (PadlistARRAY (padlist)); 587 Safefree (PadlistARRAY (padlist));
600 Safefree (padlist); 588 Safefree (padlist);
601#else 589#else
602 AvFILLp (padlist) = -1; 590 AvFILLp (padlist) = -1;
603 AvREAL_off (padlist); 591 AvREAL_off (padlist);
1519static coro_cctx * 1507static coro_cctx *
1520cctx_new_empty (void) 1508cctx_new_empty (void)
1521{ 1509{
1522 coro_cctx *cctx = cctx_new (); 1510 coro_cctx *cctx = cctx_new ();
1523 1511
1524 cctx->sptr = 0; 1512 cctx->stack.sptr = 0;
1525 coro_create (&cctx->cctx, 0, 0, 0, 0); 1513 coro_create (&cctx->cctx, 0, 0, 0, 0);
1526 1514
1527 return cctx; 1515 return cctx;
1528} 1516}
1529 1517
1530/* create a new cctx suitable as destination/running a perl interpreter */ 1518/* create a new cctx suitable as destination/running a perl interpreter */
1531static coro_cctx * 1519static coro_cctx *
1532cctx_new_run (void) 1520cctx_new_run (void)
1533{ 1521{
1534 coro_cctx *cctx = cctx_new (); 1522 coro_cctx *cctx = cctx_new ();
1535 void *stack_start;
1536 size_t stack_size;
1537 1523
1538#if HAVE_MMAP 1524 if (!coro_stack_alloc (&cctx->stack, cctx_stacksize))
1539 cctx->ssize = ((cctx_stacksize * sizeof (long) + PAGESIZE - 1) / PAGESIZE + CORO_STACKGUARD) * PAGESIZE;
1540 /* mmap supposedly does allocate-on-write for us */
1541 cctx->sptr = mmap (0, cctx->ssize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS, -1, 0);
1542
1543 if (cctx->sptr != (void *)-1)
1544 {
1545 #if CORO_STACKGUARD
1546 mprotect (cctx->sptr, CORO_STACKGUARD * PAGESIZE, PROT_NONE);
1547 #endif
1548 stack_start = (char *)cctx->sptr + CORO_STACKGUARD * PAGESIZE;
1549 stack_size = cctx->ssize - CORO_STACKGUARD * PAGESIZE;
1550 cctx->flags |= CC_MAPPED;
1551 } 1525 {
1552 else
1553#endif
1554 {
1555 cctx->ssize = cctx_stacksize * (long)sizeof (long);
1556 New (0, cctx->sptr, cctx_stacksize, long);
1557
1558 if (!cctx->sptr)
1559 {
1560 perror ("FATAL: unable to allocate stack for coroutine, exiting."); 1526 perror ("FATAL: unable to allocate stack for coroutine, exiting.");
1561 _exit (EXIT_FAILURE); 1527 _exit (EXIT_FAILURE);
1562 }
1563
1564 stack_start = cctx->sptr;
1565 stack_size = cctx->ssize;
1566 } 1528 }
1567 1529
1568 #if CORO_USE_VALGRIND
1569 cctx->valgrind_id = VALGRIND_STACK_REGISTER ((char *)stack_start, (char *)stack_start + stack_size);
1570 #endif
1571
1572 coro_create (&cctx->cctx, cctx_run, (void *)cctx, stack_start, stack_size); 1530 coro_create (&cctx->cctx, cctx_run, (void *)cctx, cctx->stack.sptr, cctx->stack.ssze);
1573 1531
1574 return cctx; 1532 return cctx;
1575} 1533}
1576 1534
1577static void 1535static void
1583 assert (("FATAL: tried to destroy current cctx", cctx != cctx_current)); 1541 assert (("FATAL: tried to destroy current cctx", cctx != cctx_current));
1584 1542
1585 --cctx_count; 1543 --cctx_count;
1586 coro_destroy (&cctx->cctx); 1544 coro_destroy (&cctx->cctx);
1587 1545
1588 /* coro_transfer creates new, empty cctx's */ 1546 coro_stack_free (&cctx->stack);
1589 if (cctx->sptr)
1590 {
1591 #if CORO_USE_VALGRIND
1592 VALGRIND_STACK_DEREGISTER (cctx->valgrind_id);
1593 #endif
1594
1595#if HAVE_MMAP
1596 if (cctx->flags & CC_MAPPED)
1597 munmap (cctx->sptr, cctx->ssize);
1598 else
1599#endif
1600 Safefree (cctx->sptr);
1601 }
1602 1547
1603 Safefree (cctx); 1548 Safefree (cctx);
1604} 1549}
1605 1550
1606/* wether this cctx should be destructed */ 1551/* wether this cctx should be destructed */
1625} 1570}
1626 1571
1627static void 1572static void
1628cctx_put (coro_cctx *cctx) 1573cctx_put (coro_cctx *cctx)
1629{ 1574{
1630 assert (("FATAL: cctx_put called on non-initialised cctx in Coro (please report)", cctx->sptr)); 1575 assert (("FATAL: cctx_put called on non-initialised cctx in Coro (please report)", cctx->stack.sptr));
1631 1576
1632 /* free another cctx if overlimit */ 1577 /* free another cctx if overlimit */
1633 if (ecb_expect_false (cctx_idle >= cctx_max_idle)) 1578 if (ecb_expect_false (cctx_idle >= cctx_max_idle))
1634 { 1579 {
1635 coro_cctx *first = cctx_first; 1580 coro_cctx *first = cctx_first;
2174{ 2119{
2175 AV *od = coro->on_destroy; 2120 AV *od = coro->on_destroy;
2176 2121
2177 if (!od) 2122 if (!od)
2178 return; 2123 return;
2124
2125 coro->on_destroy = 0;
2126 sv_2mortal ((SV *)od);
2179 2127
2180 while (AvFILLp (od) >= 0) 2128 while (AvFILLp (od) >= 0)
2181 { 2129 {
2182 SV *cb = sv_2mortal (av_pop (od)); 2130 SV *cb = sv_2mortal (av_pop (od));
2183 2131
3227 /* it quickly returns */ 3175 /* it quickly returns */
3228 if (CORO_THROW) 3176 if (CORO_THROW)
3229 return 0; 3177 return 0;
3230 3178
3231 /* one element that is an RV? repeat! */ 3179 /* one element that is an RV? repeat! */
3232 if (AvFILLp (state) == 0 && SvROK (AvARRAY (state)[0])) 3180 if (AvFILLp (state) == 0 && SvTYPE (AvARRAY (state)[0]) != SVt_PV)
3233 return 1; 3181 return 1;
3234 3182
3235 /* restore status */ 3183 /* restore status */
3236 { 3184 {
3237 SV *data_sv = av_pop (state); 3185 SV *data_sv = av_pop (state);
3470#ifdef USE_ITHREADS 3418#ifdef USE_ITHREADS
3471# if CORO_PTHREAD 3419# if CORO_PTHREAD
3472 coro_thx = PERL_GET_CONTEXT; 3420 coro_thx = PERL_GET_CONTEXT;
3473# endif 3421# endif
3474#endif 3422#endif
3475 BOOT_PAGESIZE;
3476
3477 /* perl defines these to check for existance first, but why it doesn't */ 3423 /* perl defines these to check for existance first, but why it doesn't */
3478 /* just create them one at init time is not clear to me, except for */ 3424 /* just create them one at init time is not clear to me, except for */
3479 /* programs trying to delete them, but... */ 3425 /* programs trying to delete them, but... */
3480 /* anyway, we declare this as invalid and make sure they are initialised here */ 3426 /* anyway, we declare this as invalid and make sure they are initialised here */
3481 DEFSV; 3427 DEFSV;
3551void 3497void
3552transfer (...) 3498transfer (...)
3553 PROTOTYPE: $$ 3499 PROTOTYPE: $$
3554 CODE: 3500 CODE:
3555 CORO_EXECUTE_SLF_XS (slf_init_transfer); 3501 CORO_EXECUTE_SLF_XS (slf_init_transfer);
3556
3557void
3558_exit (int code)
3559 PROTOTYPE: $
3560 CODE:
3561 _exit (code);
3562 3502
3563SV * 3503SV *
3564clone (Coro::State coro) 3504clone (Coro::State coro)
3565 CODE: 3505 CODE:
3566{ 3506{
3621void 3561void
3622list () 3562list ()
3623 PROTOTYPE: 3563 PROTOTYPE:
3624 PPCODE: 3564 PPCODE:
3625{ 3565{
3626 struct coro *coro; 3566 struct coro *coro;
3627 for (coro = coro_first; coro; coro = coro->next) 3567 for (coro = coro_first; coro; coro = coro->next)
3628 if (coro->hv) 3568 if (coro->hv)
3629 XPUSHs (sv_2mortal (newRV_inc ((SV *)coro->hv))); 3569 XPUSHs (sv_2mortal (newRV_inc ((SV *)coro->hv)));
3630} 3570}
3631 3571
3793 3733
3794void 3734void
3795times (Coro::State self) 3735times (Coro::State self)
3796 PPCODE: 3736 PPCODE:
3797{ 3737{
3798 struct coro *current = SvSTATE (coro_current); 3738 struct coro *current = SvSTATE (coro_current);
3799 3739
3800 if (ecb_expect_false (current == self)) 3740 if (ecb_expect_false (current == self))
3801 { 3741 {
3802 coro_times_update (); 3742 coro_times_update ();
3803 coro_times_add (SvSTATE (coro_current)); 3743 coro_times_add (SvSTATE (coro_current));
4078 on_leave = 1 4018 on_leave = 1
4079 PROTOTYPE: & 4019 PROTOTYPE: &
4080 CODE: 4020 CODE:
4081{ 4021{
4082 struct coro *coro = SvSTATE_current; 4022 struct coro *coro = SvSTATE_current;
4083 AV **avp = ix ? &coro->on_leave : &coro->on_enter; 4023 AV **avp = ix ? &coro->on_leave : &coro->on_enter;
4084 4024
4085 block = s_get_cv_croak (block); 4025 block = s_get_cv_croak (block);
4086 4026
4087 if (!*avp) 4027 if (!*avp)
4088 *avp = newAV (); 4028 *avp = newAV ();
4108 4048
4109SV * 4049SV *
4110new (SV *klass, SV *count = 0) 4050new (SV *klass, SV *count = 0)
4111 CODE: 4051 CODE:
4112{ 4052{
4113 int semcnt = 1; 4053 int semcnt = 1;
4114 4054
4115 if (count) 4055 if (count)
4116 { 4056 {
4117 SvGETMAGIC (count); 4057 SvGETMAGIC (count);
4118 4058
4178 XSRETURN_NO; 4118 XSRETURN_NO;
4179} 4119}
4180 4120
4181void 4121void
4182waiters (SV *self) 4122waiters (SV *self)
4183 PPCODE: 4123 PPCODE:
4184{ 4124{
4185 AV *av = (AV *)SvRV (self); 4125 AV *av = (AV *)SvRV (self);
4186 int wcount = AvFILLp (av) + 1 - 1; 4126 int wcount = AvFILLp (av) + 1 - 1;
4187 4127
4188 if (GIMME_V == G_SCALAR) 4128 if (GIMME_V == G_SCALAR)
4200 4140
4201void 4141void
4202_may_delete (SV *sem, int count, unsigned int extra_refs) 4142_may_delete (SV *sem, int count, unsigned int extra_refs)
4203 PPCODE: 4143 PPCODE:
4204{ 4144{
4205 AV *av = (AV *)SvRV (sem); 4145 AV *av = (AV *)SvRV (sem);
4206 4146
4207 if (SvREFCNT ((SV *)av) == 1 + extra_refs 4147 if (SvREFCNT ((SV *)av) == 1 + extra_refs
4208 && AvFILLp (av) == 0 /* no waiters, just count */ 4148 && AvFILLp (av) == 0 /* no waiters, just count */
4209 && SvIV (AvARRAY (av)[0]) == count) 4149 && SvIV (AvARRAY (av)[0]) == count)
4210 XSRETURN_YES; 4150 XSRETURN_YES;
4231 4171
4232void 4172void
4233broadcast (SV *self) 4173broadcast (SV *self)
4234 CODE: 4174 CODE:
4235{ 4175{
4236 AV *av = (AV *)SvRV (self); 4176 AV *av = (AV *)SvRV (self);
4237 coro_signal_wake (aTHX_ av, AvFILLp (av)); 4177 coro_signal_wake (aTHX_ av, AvFILLp (av));
4238} 4178}
4239 4179
4240void 4180void
4241send (SV *self) 4181send (SV *self)
4249 SvIVX (AvARRAY (av)[0]) = 1; /* remember the signal */ 4189 SvIVX (AvARRAY (av)[0]) = 1; /* remember the signal */
4250} 4190}
4251 4191
4252IV 4192IV
4253awaited (SV *self) 4193awaited (SV *self)
4254 CODE: 4194 CODE:
4255 RETVAL = AvFILLp ((AV *)SvRV (self)) + 1 - 1; 4195 RETVAL = AvFILLp ((AV *)SvRV (self)) + 1 - 1;
4256 OUTPUT: 4196 OUTPUT:
4257 RETVAL 4197 RETVAL
4258 4198
4259 4199
4264 4204
4265void 4205void
4266_schedule (...) 4206_schedule (...)
4267 CODE: 4207 CODE:
4268{ 4208{
4269 static int incede; 4209 static int incede;
4270 4210
4271 api_cede_notself (aTHX); 4211 api_cede_notself (aTHX);
4272 4212
4273 ++incede; 4213 ++incede;
4274 while (coro_nready >= incede && api_cede (aTHX)) 4214 while (coro_nready >= incede && api_cede (aTHX))
4318 { 4258 {
4319 PL_ppaddr [OP_SSELECT] = coro_old_pp_sselect; 4259 PL_ppaddr [OP_SSELECT] = coro_old_pp_sselect;
4320 coro_old_pp_sselect = 0; 4260 coro_old_pp_sselect = 0;
4321 } 4261 }
4322 4262
4263MODULE = Coro::State PACKAGE = Coro::Util
4264
4265void
4266_exit (int code)
4267 CODE:
4268 _exit (code);
4269
4270NV
4271time ()
4272 CODE:
4273 RETVAL = nvtime (aTHX);
4274 OUTPUT:
4275 RETVAL
4276
4277NV
4278gettimeofday ()
4279 PPCODE:
4280{
4281 UV tv [2];
4282 u2time (aTHX_ tv);
4283 EXTEND (SP, 2);
4284 PUSHs (sv_2mortal (newSVuv (tv [0])));
4285 PUSHs (sv_2mortal (newSVuv (tv [1])));
4286}
4287

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines