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:
Justine Tunney 2022-06-19 01:13:03 -07:00
parent 25041b8026
commit d5312b60f7
60 changed files with 890 additions and 629 deletions

View file

@ -35,31 +35,31 @@
void
freedtoa(char *s)
{
ThInfo *TI = 0;
Bigint *b = (Bigint *)((int *)s - 1);
b->maxwds = 1 << (b->k = *(int*)b);
__gdtoa_Bfree(b);
b->maxwds = 1 << (b->k = *(int *)b);
__gdtoa_Bfree(b, &TI);
}
char *
__gdtoa_rv_alloc(int i)
__gdtoa_rv_alloc(int i, ThInfo **PTI)
{
int j, k, *r;
j = sizeof(ULong);
for(k = 0;
(int)(sizeof(Bigint) - sizeof(ULong) - sizeof(int)) + j <= i;
j <<= 1)
k++;
r = (int*)__gdtoa_Balloc(k);
for (k = 0; (int)(sizeof(Bigint) - sizeof(ULong) - sizeof(int)) + j <= i;
j <<= 1)
k++;
r = (int *)__gdtoa_Balloc(k, PTI);
*r = k;
return (char *)(r+1);
return (char *)(r + 1);
}
char *
__gdtoa_nrv_alloc(char *s, char **rve, int n)
__gdtoa_nrv_alloc(char *s, char **rve, int n, ThInfo **PTI)
{
char *rv, *t;
t = rv = __gdtoa_rv_alloc(n);
while((*t = *s++) !=0)
t = rv = __gdtoa_rv_alloc(n, PTI);
while ((*t = *s++) != 0)
t++;
if (rve)
*rve = t;