mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 11:48:30 +00:00
Make improvements to locking
This change makes pthread_mutex_lock() as fast as _spinlock() by default. Thread instability issues on NetBSD have been resolved. Improvements made to gdtoa thread code. Crash reporting will now synchronize between threads in a slightly better way.
This commit is contained in:
parent
25041b8026
commit
d5312b60f7
60 changed files with 890 additions and 629 deletions
9
third_party/gdtoa/strtoIg.c
vendored
9
third_party/gdtoa/strtoIg.c
vendored
|
@ -39,6 +39,7 @@ __gdtoa_strtoIg(const char *s00, char **se, const FPI *fpi, Long *exp, Bigint **
|
|||
int i, nb, nw, nw1, rv, rv1, swap;
|
||||
unsigned int nb1, nb11;
|
||||
Long e1;
|
||||
ThInfo *TI = 0;
|
||||
b = *B;
|
||||
rv = strtodg(s00, se, fpi, exp, b->x);
|
||||
if (!(rv & STRTOG_Inexact)) {
|
||||
|
@ -47,7 +48,7 @@ __gdtoa_strtoIg(const char *s00, char **se, const FPI *fpi, Long *exp, Bigint **
|
|||
}
|
||||
e1 = exp[0];
|
||||
rv1 = rv ^ STRTOG_Inexact;
|
||||
b1 = __gdtoa_Balloc(b->k);
|
||||
b1 = __gdtoa_Balloc(b->k, &TI);
|
||||
Bcopy(b1, b);
|
||||
nb = fpi->nbits;
|
||||
nb1 = nb & 31;
|
||||
|
@ -56,7 +57,7 @@ __gdtoa_strtoIg(const char *s00, char **se, const FPI *fpi, Long *exp, Bigint **
|
|||
nw1 = nw - 1;
|
||||
if (rv & STRTOG_Inexlo) {
|
||||
swap = 0;
|
||||
b1 = __gdtoa_increment(b1);
|
||||
b1 = __gdtoa_increment(b1, &TI);
|
||||
if ((rv & STRTOG_Retmask) == STRTOG_Zero) {
|
||||
if (fpi->sudden_underflow) {
|
||||
b1->x[0] = 0;
|
||||
|
@ -85,7 +86,7 @@ __gdtoa_strtoIg(const char *s00, char **se, const FPI *fpi, Long *exp, Bigint **
|
|||
else {
|
||||
swap = STRTOG_Neg;
|
||||
if ((rv & STRTOG_Retmask) == STRTOG_Infinite) {
|
||||
b1 = __gdtoa_set_ones(b1, nb);
|
||||
b1 = __gdtoa_set_ones(b1, nb, &TI);
|
||||
e1 = fpi->emax;
|
||||
rv1 = STRTOG_Normal | STRTOG_Inexlo | (rv & STRTOG_Neg);
|
||||
goto swapcheck;
|
||||
|
@ -108,7 +109,7 @@ __gdtoa_strtoIg(const char *s00, char **se, const FPI *fpi, Long *exp, Bigint **
|
|||
rv1 |= STRTOG_Underflow;
|
||||
}
|
||||
else {
|
||||
b1 = __gdtoa_lshift(b1, 1);
|
||||
b1 = __gdtoa_lshift(b1, 1, &TI);
|
||||
b1->x[0] |= 1;
|
||||
--e1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue