[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r22518 - in /fsf/trunk/libc: ./ locale/ malloc/ posix/ sysdeps/ieee754/dbl-64/
- To: commits@xxxxxxxxxx
- Subject: [Commits] r22518 - in /fsf/trunk/libc: ./ locale/ malloc/ posix/ sysdeps/ieee754/dbl-64/
- From: eglibc@xxxxxxxxxx
- Date: Wed, 27 Feb 2013 00:01:58 -0000
Author: eglibc
Date: Wed Feb 27 00:01:57 2013
New Revision: 22518
Log:
Import glibc-mainline for 2013-02-27
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/locale/elem-hash.h
fsf/trunk/libc/malloc/memusagestat.c
fsf/trunk/libc/posix/regex_internal.h
fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpa.c
fsf/trunk/libc/sysdeps/ieee754/dbl-64/sincos32.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Feb 27 00:01:57 2013
@@ -1,3 +1,36 @@
+2013-02-26 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/ieee754/dbl-64/mpa.c: Include alloca.h.
+ (__mul): Reduce iterations for calculating mantissa.
+
+ * sysdeps/ieee754/dbl-64/sincos32.c (__c32): Use MPONE and
+ MPTWO.
+ (__mpranred): Likewise.
+
+ [BZ #15160]
+ * malloc/memusagestat.c (main): Draw graphs for heap and stack
+ only if MAXSIZE_HEAP and MAXSIZE_STACK are non-zero.
+
+2013-02-26 Paul Eggert <eggert@xxxxxxxxxxx>
+
+ * posix/regex_internal.h [__GNUC__ < 3 + (__GNUC_MINOR__ < 1]:
+ Define __attribute__.
+
+2013-02-26 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * locale/elem-hash.h (elem_hash): Mark as pure and possibly
+ unused.
+ * posix/regex_internal.h (__attribute): Remove.
+ [!_LIBC && __i386__]: Use __attribute__ instead of __attribute.
+ (re_string_context_at): Likewise.
+ (bitset_not): Use __attribute__ and mark function as possibly
+ unused.
+ (bitset_merge): Likewise.
+ (bitset_mask): Likewise.
+ (re_string_char_size_at): Likewise.
+ (re_string_wchar_at): Likewise.
+ (re_string_elem_size_at): Likewise.
+
2013-02-25 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
* sysdeps/ieee754/dbl-64/sincos32.c (ss32): Remove commented
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Wed Feb 27 00:01:57 2013
@@ -11,7 +11,7 @@
11561, 13951, 14142, 14200, 14317, 14327, 14496, 14920, 14964, 14981,
14982, 14985, 14994, 14996, 15003, 15006, 15020, 15023, 15036, 15054,
- 15062, 15078.
+ 15062, 15078, 15160.
* Add support for calling C++11 thread_local object destructors on thread
and program exit. This needs compiler support for offloading C++11
Modified: fsf/trunk/libc/locale/elem-hash.h
==============================================================================
--- fsf/trunk/libc/locale/elem-hash.h (original)
+++ fsf/trunk/libc/locale/elem-hash.h Wed Feb 27 00:01:57 2013
@@ -18,7 +18,7 @@
/* The hashing function used for the table with collation symbols. */
-static int32_t
+static int32_t __attribute__ ((pure, unused))
elem_hash (const char *str, int_fast32_t n)
{
int32_t result = n;
Modified: fsf/trunk/libc/malloc/memusagestat.c
==============================================================================
--- fsf/trunk/libc/malloc/memusagestat.c (original)
+++ fsf/trunk/libc/malloc/memusagestat.c Wed Feb 27 00:01:57 2013
@@ -319,17 +319,26 @@
for (line = 1; line <= 3; ++line)
{
- cnt = ((ysize - 40) * (maxsize_heap / 4 * line / heap_scale)) /
- (maxsize_heap / heap_scale);
- gdImageDashedLine (im_out, 40, ysize - 20 - cnt, xsize - 40,
- ysize - 20 - cnt, red);
- snprintf (buf, sizeof (buf), heap_format, maxsize_heap / 4 * line /
- heap_scale);
- gdImageString (im_out, gdFontSmall, 39 - strlen (buf) * 6,
- ysize - 26 - cnt, (unsigned char *) buf, red);
-
- cnt2 = ((ysize - 40) * (maxsize_stack / 4 * line / stack_scale)) /
- (maxsize_stack / stack_scale);
+ if (maxsize_heap > 0)
+ {
+ cnt = (((ysize - 40) * (maxsize_heap / 4 * line / heap_scale))
+ / (maxsize_heap / heap_scale));
+ gdImageDashedLine (im_out, 40, ysize - 20 - cnt, xsize - 40,
+ ysize - 20 - cnt, red);
+ snprintf (buf, sizeof (buf), heap_format,
+ maxsize_heap / 4 * line / heap_scale);
+ gdImageString (im_out, gdFontSmall, 39 - strlen (buf) * 6,
+ ysize - 26 - cnt, (unsigned char *) buf, red);
+ }
+ else
+ cnt = 0;
+
+ if (maxsize_stack > 0)
+ cnt2 = (((ysize - 40) * (maxsize_stack / 4 * line / stack_scale))
+ / (maxsize_stack / stack_scale));
+ else
+ cnt2 = 0;
+
if (cnt != cnt2)
gdImageDashedLine (im_out, 40, ysize - 20 - cnt2, xsize - 40,
ysize - 20 - cnt2, green);
@@ -372,7 +381,7 @@
ysize - 14, yellow);
previously = now;
- if (also_total)
+ if (also_total && maxsize_heap > 0)
{
size_t new3;
@@ -386,21 +395,27 @@
last_total = new3;
}
- // assert (entry.heap <= maxsize_heap);
- new[0] = (ysize - 20) - ((((unsigned long long int) (ysize - 40))
- * entry.heap) / maxsize_heap);
- gdImageLine (im_out, 40 + ((xsize - 80) * (cnt - 1)) / total,
- last_heap, 40 + ((xsize - 80) * cnt) / total, new[0],
- red);
- last_heap = new[0];
-
- // assert (entry.stack <= maxsize_stack);
- new[1] = (ysize - 20) - ((((unsigned long long int) (ysize - 40))
- * entry.stack) / maxsize_stack);
- gdImageLine (im_out, 40 + ((xsize - 80) * (cnt - 1)) / total,
- last_stack, 40 + ((xsize - 80) * cnt) / total, new[1],
- green);
- last_stack = new[1];
+ if (maxsize_heap > 0)
+ {
+ new[0] = ((ysize - 20)
+ - ((((unsigned long long int) (ysize - 40))
+ * entry.heap) / maxsize_heap));
+ gdImageLine (im_out, 40 + ((xsize - 80) * (cnt - 1)) / total,
+ last_heap, 40 + ((xsize - 80) * cnt) / total,
+ new[0], red);
+ last_heap = new[0];
+ }
+
+ if (maxsize_stack > 0)
+ {
+ new[1] = ((ysize - 20)
+ - ((((unsigned long long int) (ysize - 40))
+ * entry.stack) / maxsize_stack));
+ gdImageLine (im_out, 40 + ((xsize - 80) * (cnt - 1)) / total,
+ last_stack, 40 + ((xsize - 80) * cnt) / total,
+ new[1], green);
+ last_stack = new[1];
+ }
}
cnt = 0;
@@ -448,7 +463,7 @@
next_tick += MAX (1, total / 20);
}
- if (also_total)
+ if (also_total && maxsize_heap > 0)
{
size_t new3;
@@ -459,16 +474,24 @@
last_total = new3;
}
- new[0] = (ysize - 20) - ((((unsigned long long int) (ysize - 40))
- * entry.heap) / maxsize_heap);
- gdImageLine (im_out, last_xpos, last_heap, xpos, new[0], red);
- last_heap = new[0];
-
- // assert (entry.stack <= maxsize_stack);
- new[1] = (ysize - 20) - ((((unsigned long long int) (ysize - 40))
- * entry.stack) / maxsize_stack);
- gdImageLine (im_out, last_xpos, last_stack, xpos, new[1], green);
- last_stack = new[1];
+ if (maxsize_heap > 0)
+ {
+ new[0] = ((ysize - 20)
+ - ((((unsigned long long int) (ysize - 40))
+ * entry.heap) / maxsize_heap));
+ gdImageLine (im_out, last_xpos, last_heap, xpos, new[0], red);
+ last_heap = new[0];
+ }
+
+ if (maxsize_stack > 0)
+ {
+ new[1] = ((ysize - 20)
+ - ((((unsigned long long int) (ysize - 40))
+ * entry.stack) / maxsize_stack));
+ gdImageLine (im_out, last_xpos, last_stack, xpos, new[1],
+ green);
+ last_stack = new[1];
+ }
last_xpos = xpos;
}
Modified: fsf/trunk/libc/posix/regex_internal.h
==============================================================================
--- fsf/trunk/libc/posix/regex_internal.h (original)
+++ fsf/trunk/libc/posix/regex_internal.h Wed Feb 27 00:01:57 2013
@@ -121,10 +121,8 @@
# define attribute_hidden
#endif /* not _LIBC */
-#ifdef __GNUC__
-# define __attribute(arg) __attribute__ (arg)
-#else
-# define __attribute(arg)
+#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1)
+# define __attribute__(arg)
#endif
extern const char __re_error_msgid[] attribute_hidden;
@@ -378,7 +376,7 @@
#ifndef _LIBC
# ifdef __i386__
-# define internal_function __attribute ((regparm (3), stdcall))
+# define internal_function __attribute__ ((regparm (3), stdcall))
# else
# define internal_function
# endif
@@ -397,7 +395,7 @@
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
static unsigned int re_string_context_at (const re_string_t *input, int idx,
int eflags)
- internal_function __attribute ((pure));
+ internal_function __attribute__ ((pure));
#endif
#define re_string_peek_byte(pstr, offset) \
((pstr)->mbs[(pstr)->cur_idx + offset])
@@ -686,7 +684,7 @@
/* Inline functions for bitset operation. */
-static void
+static void __attribute__ ((unused))
bitset_not (bitset_t set)
{
int bitset_i;
@@ -694,7 +692,7 @@
set[bitset_i] = ~set[bitset_i];
}
-static void
+static void __attribute__ ((unused))
bitset_merge (bitset_t dest, const bitset_t src)
{
int bitset_i;
@@ -702,7 +700,7 @@
dest[bitset_i] |= src[bitset_i];
}
-static void
+static void __attribute__ ((unused))
bitset_mask (bitset_t dest, const bitset_t src)
{
int bitset_i;
@@ -713,7 +711,7 @@
#ifdef RE_ENABLE_I18N
/* Inline functions for re_string. */
static int
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure, unused))
re_string_char_size_at (const re_string_t *pstr, int idx)
{
int byte_idx;
@@ -726,7 +724,7 @@
}
static wint_t
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure, unused))
re_string_wchar_at (const re_string_t *pstr, int idx)
{
if (pstr->mb_cur_max == 1)
@@ -736,7 +734,7 @@
# ifndef NOT_IN_libc
static int
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure, unused))
re_string_elem_size_at (const re_string_t *pstr, int idx)
{
# ifdef _LIBC
Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpa.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpa.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/mpa.c Wed Feb 27 00:01:57 2013
@@ -43,6 +43,7 @@
#include "endian.h"
#include "mpa.h"
#include <sys/param.h>
+#include <alloca.h>
#ifndef SECTION
# define SECTION
@@ -621,6 +622,7 @@
long p2 = p;
double u, zk;
const mp_no *a;
+ double *diag;
/* Is z=0? */
if (__glibc_unlikely (X[0] * Y[0] == ZERO))
@@ -673,12 +675,33 @@
while (k > ip + ip2 + 1)
Z[k--] = ZERO;
- zk = Z[k] = ZERO;
+ zk = ZERO;
+
+ /* Precompute sums of diagonal elements so that we can directly use them
+ later. See the next comment to know we why need them. */
+ diag = alloca (k * sizeof (double));
+ double d = ZERO;
+ for (i = 1; i <= ip; i++)
+ {
+ d += X[i] * Y[i];
+ diag[i] = d;
+ }
+ while (i < k)
+ diag[i++] = d;
while (k > p2)
{
- for (i = k - p2, j = p2; i < p2 + 1; i++, j--)
- zk += X[i] * Y[j];
+ long lim = k / 2;
+
+ if (k % 2 == 0)
+ /* We want to add this only once, but since we subtract it in the sum
+ of products above, we add twice. */
+ zk += 2 * X[lim] * Y[lim];
+
+ for (i = k - p2, j = p2; i < j; i++, j--)
+ zk += (X[i] + X[j]) * (Y[i] + Y[j]);
+
+ zk -= diag[k - 1];
u = (zk + CUTTER) - CUTTER;
if (u > zk)
@@ -687,11 +710,32 @@
zk = u * RADIXI;
}
- /* The real deal. */
+ /* The real deal. Mantissa digit Z[k] is the sum of all X[i] * Y[j] where i
+ goes from 1 -> k - 1 and j goes the same range in reverse. To reduce the
+ number of multiplications, we halve the range and if k is an even number,
+ add the diagonal element X[k/2]Y[k/2]. Through the half range, we compute
+ X[i] * Y[j] as (X[i] + X[j]) * (Y[i] + Y[j]) - X[i] * Y[i] - X[j] * Y[j].
+
+ This reduction tells us that we're summing two things, the first term
+ through the half range and the negative of the sum of the product of all
+ terms of X and Y in the full range. i.e.
+
+ SUM(X[i] * Y[i]) for k terms. This is precalculated above for each k in
+ a single loop so that it completes in O(n) time and can hence be directly
+ used in the loop below. */
while (k > 1)
{
- for (i = 1, j = k - 1; i < k; i++, j--)
- zk += X[i] * Y[j];
+ long lim = k / 2;
+
+ if (k % 2 == 0)
+ /* We want to add this only once, but since we subtract it in the sum
+ of products above, we add twice. */
+ zk += 2 * X[lim] * Y[lim];
+
+ for (i = 1, j = k - 1; i < j; i++, j--)
+ zk += (X[i] + X[j]) * (Y[i] + Y[j]);
+
+ zk -= diag[k - 1];
u = (zk + CUTTER) - CUTTER;
if (u > zk)
Modified: fsf/trunk/libc/sysdeps/ieee754/dbl-64/sincos32.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/dbl-64/sincos32.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/dbl-64/sincos32.c Wed Feb 27 00:01:57 2013
@@ -105,7 +105,6 @@
void
SECTION
__c32(mp_no *x, mp_no *y, mp_no *z, int p) {
- static const mp_no mpt={1,{1.0,2.0}}, one={1,{1.0,1.0}};
mp_no u,t,t1,t2,c,s;
int i;
__cpy(x,&u,p);
@@ -116,11 +115,11 @@
__mul(&c,&s,&t,p);
__sub(&s,&t,&t1,p);
__add(&t1,&t1,&s,p);
- __sub(&mpt,&c,&t1,p);
+ __sub(&mptwo,&c,&t1,p);
__mul(&t1,&c,&t2,p);
__add(&t2,&t2,&c,p);
}
- __sub(&one,&c,y,p);
+ __sub(&mpone,&c,y,p);
__cpy(&s,z,p);
}
@@ -237,7 +236,6 @@
number v;
double t,xn;
int i,k,n;
- static const mp_no one = {1,{1.0,1.0}};
mp_no a,b,c;
if (ABS(x) < 2.8e14) {
@@ -266,7 +264,7 @@
c.e=0;
if (c.d[1] >= 8388608.0)
{ t +=1.0;
- __sub(&c,&one,&b,p);
+ __sub(&c,&mpone,&b,p);
__mul(&b,&hp,y,p);
}
else __mul(&c,&hp,y,p);
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits