Skip to content

Commit cf383b2

Browse files
committed
dist/IO.xs remove a dTHX call
- threaded perls without CPerlHost/iperlsys.h (ie all threaded unix perls) dont need a my_perl ptr, and don't assume all CCes have perfect LTO/LTCG and all OSes have a perfect designed bin image loader, to optimize away an unused my_perl var. This symbol crosses 2 separate TUs. ELF interposition, on paper, doesn't allow shifting over and dropping out args, but in real life, things are probably different. Write it correctly than assume optimizations will happen.
1 parent 2d5c834 commit cf383b2

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

dist/IO/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
IO 1.56
2+
* A very minor optimization was done in perl's emulated poll() on the OSes
3+
that use need that use Perl's implementation.
4+
15
IO 1.55
26
* XS changes for getline/getlines to support reference counted stacks
37
* moved the binmode method from IO::File to IO::Handle, since all types

dist/IO/IO.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use Carp;
77
use strict;
88
use warnings;
99

10-
our $VERSION = "1.55";
10+
our $VERSION = "1.56";
1111
XSLoader::load 'IO', $VERSION;
1212

1313
sub import {

dist/IO/poll.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*
1111
*/
1212

13+
#define PERL_NO_GET_CONTEXT
1314
#include "EXTERN.h"
1415
#include "perl.h"
1516
#include "XSUB.h"
@@ -40,8 +41,13 @@
4041

4142
# define POLL_EVENTS_MASK (POLL_CAN_READ | POLL_CAN_WRITE | POLL_HAS_EXCP)
4243

44+
#if defined(PERL_IMPLICIT_SYS)
4345
int
44-
poll(struct pollfd *fds, unsigned long nfds, int timeout)
46+
Perl_my_poll_cxt(pTHX_ struct pollfd *fds, unsigned long nfds, int timeout)
47+
#else
48+
int
49+
Perl_my_poll(struct pollfd *fds, unsigned long nfds, int timeout)
50+
#endif
4551
{
4652
int i,err;
4753
fd_set rfd,wfd,efd,ifd;

dist/IO/poll.h

+11-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@
2929
#ifdef poll
3030
# undef poll
3131
#endif
32-
#define poll Perl_my_poll
32+
33+
#if defined(PERL_IMPLICIT_SYS)
34+
# define poll(_fds, _nfds, _tm) Perl_my_poll_cxt(aTHX_ _fds, _nfds, _tm)
35+
#else
36+
# define poll Perl_my_poll
37+
#endif
3338

3439
#if WINVER < 0x0600
3540
typedef struct pollfd {
@@ -55,7 +60,11 @@ typedef struct pollfd {
5560

5661
#endif
5762

58-
int poll (struct pollfd *, unsigned long, int);
63+
#if defined(PERL_IMPLICIT_SYS)
64+
int Perl_my_poll_cxt(pTHX_ struct pollfd *, unsigned long, int);
65+
#else
66+
int Perl_my_poll(struct pollfd *, unsigned long, int);
67+
#endif
5968

6069
#ifndef HAS_POLL
6170
# define HAS_POLL

0 commit comments

Comments
 (0)