develooper Front page | perl.perl5.porters | Postings from July 2019

[perl #134172] commit 027471cf breaks t/op/sprintf2.t on FreeBSD-11

Thread Previous
From:
Hugo van der Sanden via RT
Date:
July 22, 2019 15:47
Subject:
[perl #134172] commit 027471cf breaks t/op/sprintf2.t on FreeBSD-11
Message ID:
rt-4.0.24-17770-1563810459-1724.134172-15-0@perl.org
On Tue, 11 Jun 2019 06:30:21 -0700, hv wrote:
> I feel the problems here are essentially a clash between the work from
> bc37e90eb: "Perl_sv_vcatpvfn_flags: set locale at most once" and from
> e9bc6d6b: "Add thread-safe locale handling". Because of the mutex
> requirements of the latter, attempting to retain the former will need
> us to identify every possible route out of sv_vcatpvfn - not only the
> explicit croaks, but also eg any attempt to read an SV that might be
> tied or overloaded.
> 
> I don't think that's a practical thing to do; as such, I'm not
> convinced there's a practical route to getting correct mutex-protected
> locale changes on the platforms that need it while retaining the "do
> this only once" performance benefits.

Attached is an attempt to fix this by defining a new more tightly scoped
WITH_LC_NUMERIC_SET_TO_NEEDED macro, and using this around each point
(that I was able to identify) that needs the locale switching.

As Dave mentioned, the expensive part is the hints check of IN_LC(LC_NUMERIC);
I cache a copy of that for sv_vcatpvfn_flags (and format_hexfp) to use;
however I note that the same check is done multiple times within the
underlying STORE_LC_NUMERIC_SET_TO_NEEDED macro, so it may be worth
making variants of WITH_LC_x and STORE_LC_x that accept a cached boolean
for the hints check.

I'd appreciate if someone could look through for any location I might
have missed that needs the new macro, and we should probably give this
some smoking.

Hugo

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134172

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About