Skip to content

Commit 654b66e

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 654b66e

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-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

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@
4040

4141
# define POLL_EVENTS_MASK (POLL_CAN_READ | POLL_CAN_WRITE | POLL_HAS_EXCP)
4242

43+
#if defined(PERL_IMPLICIT_SYS)
4344
int
44-
poll(struct pollfd *fds, unsigned long nfds, int timeout)
45+
Perl_my_poll_cxt(pTHX_ struct pollfd *fds, unsigned long nfds, int timeout)
46+
#else
47+
int
48+
Perl_my_poll(struct pollfd *fds, unsigned long nfds, int timeout)
49+
#endif
4550
{
4651
int i,err;
4752
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)