[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r24061 - in /fsf/trunk/libc: ./ include/ locale/ malloc/ manual/ ports/ ports/sysdeps/alpha/ ports/sysdeps/alpha/alphaev67/ ...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r24061 - in /fsf/trunk/libc: ./ include/ locale/ malloc/ manual/ ports/ ports/sysdeps/alpha/ ports/sysdeps/alpha/alphaev67/ ...
- From: eglibc@xxxxxxxxxx
- Date: Sat, 21 Sep 2013 00:02:03 -0000
Author: eglibc
Date: Sat Sep 21 00:02:02 2013
New Revision: 24061
Log:
Import glibc-mainline for 2013-09-21
Added:
fsf/trunk/libc/manual/probes.texi
Removed:
fsf/trunk/libc/ports/sysdeps/mips/mips64/memset.S
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/include/string.h
fsf/trunk/libc/locale/iso-639.def
fsf/trunk/libc/malloc/arena.c
fsf/trunk/libc/malloc/malloc.c
fsf/trunk/libc/manual/Makefile
fsf/trunk/libc/manual/threads.texi
fsf/trunk/libc/ports/ChangeLog.alpha
fsf/trunk/libc/ports/ChangeLog.arm
fsf/trunk/libc/ports/ChangeLog.m68k
fsf/trunk/libc/ports/ChangeLog.mips
fsf/trunk/libc/ports/ChangeLog.tile
fsf/trunk/libc/ports/sysdeps/alpha/alphaev67/ffs.S
fsf/trunk/libc/ports/sysdeps/alpha/ffs.S
fsf/trunk/libc/ports/sysdeps/arm/armv6t2/ffs.S
fsf/trunk/libc/ports/sysdeps/m68k/ffs.c
fsf/trunk/libc/ports/sysdeps/mips/memset.S
fsf/trunk/libc/ports/sysdeps/tile/ffs.c
fsf/trunk/libc/string/ffs.c
fsf/trunk/libc/sysdeps/i386/ffs.c
fsf/trunk/libc/sysdeps/i386/i686/ffs.c
fsf/trunk/libc/sysdeps/powerpc/ffs.c
fsf/trunk/libc/sysdeps/s390/ffs.c
fsf/trunk/libc/sysdeps/x86_64/ffs.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Sep 21 00:02:02 2013
@@ -1,3 +1,64 @@
+2013-09-20 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
+
+ * include/string.h (__ffs): Declare as hidden.
+ * string/ffs.c (__ffs): Define as hidden.
+ * sysdeps/i386/ffs.c (__ffs): Likewise.
+ * sysdeps/i386/i686/ffs.c (__ffs): Likewise.
+ * sysdeps/powerpc/ffs.c (__ffs): Likewise.
+ * sysdeps/s390/ffs.c (__ffs): Likewise.
+ * sysdeps/x86_64/ffs.c (__ffs): Likewise.
+
+2013-09-20 Alexandre Oliva <aoliva@xxxxxxxxxx>
+
+ * NEWS: Mention malloc probes.
+
+ * malloc/arena.c (new_heap): New memory_heap_new probe.
+ (grow_heap): New memory_heap_more probe.
+ (shrink_heap): New memory_heap_less probe.
+ (heap_trim): New memory_heap_free probe.
+ * malloc/malloc.c (sysmalloc): New memory_sbrk_more probe.
+ (systrim): New memory_sbrk_less probe.
+ * manual/probes.texi: Document them.
+
+ * malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
+ * manual/probes.texi: Document it.
+
+ * malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe.
+ (__libc_realloc): Add memory_realloc_retry probe.
+ (__libc_memalign): Add memory_memalign_retry probe.
+ (__libc_valloc): Add memory_valloc_retry probe.
+ (__libc_pvalloc): Add memory_pvalloc_retry probe.
+ (__libc_calloc): Add memory_calloc_retry probe.
+ * manual/probes.texi: Document them.
+
+ * malloc/arena.c (get_free_list): Add probe
+ memory_arena_reuse_free_list.
+ (reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
+ and memory_arena_reuse.
+ (arena_get2) [!PER_THREAD]: Likewise.
+ * malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
+ memory_arena_reuse_realloc.
+ * manual/probes.texi: Document them.
+
+ * malloc/malloc.c (__libc_free): Add
+ memory_mallopt_free_dyn_thresholds probe.
+ (__libc_mallopt): Add multiple memory_mallopt probes.
+ * manual/probes.texi: Document them.
+
+ * malloc/malloc.c: Include stap-probe.h.
+ (__libc_mallopt): Add memory_mallopt probe.
+ * malloc/arena.c (_int_new_arena): Add memory_arena_new probe.
+ * manual/probes.texi: New.
+ * manual/Makefile (chapters): Add probes.
+ * manual/threads.texi: Set next node.
+
+2013-09-19 Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
+
+ [BZ #15963, #13985]
+ * locale/iso-639.def: Add Chiga (cgg) and Chinese (gan, hak,
+ czh, cjy, lzh, cmn, mnp, cdo, czo, cpx, wuu, hsn, yue).
+ Add `Chinese' to `nan' entry name.
+
2013-09-19 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
* sysdeps/ieee754/dbl-64/s_sin.c (POLYNOMIAL2): New macro.
@@ -371,7 +432,7 @@
2013-09-04 Chris Leonard <cjl@sugarlabs,.org>
- [BZ #15923]
+ [BZ #15923]
* locale/iso-4217.def: Update iso-1427.def and related occurrences.
2013-09-04 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat Sep 21 00:02:02 2013
@@ -9,9 +9,10 @@
* The following bugs are resolved with this release:
- 14155, 14699, 15427, 15522, 15531, 15532, 15640, 15736, 15748, 15749,
- 15797, 15844, 15849, 15855, 15856, 15857, 15867, 15886, 15887, 15890,
- 15892, 15893, 15895, 15897, 15905, 15909, 15921, 15939, 15966.
+ 13985. 14155, 14699, 15427, 15522, 15531, 15532, 15640, 15736, 15748,
+ 15749, 15797, 15844, 15849, 15855, 15856, 15857, 15867, 15886, 15887,
+ 15890, 15892, 15893, 15895, 15897, 15905, 15909, 15921, 15939, 15966,
+ 15963.
* CVE-2013-4237 The readdir_r function could write more than NAME_MAX bytes
to the d_name member of struct dirent, or omit the terminating NUL
@@ -24,12 +25,18 @@
* New locales: quz_PE.
-* Add country_car field to LC_ADDRESS, many locales.
-
-* Update iso-1427.def and related occurrences.
+* The LC_ADDRESS field was updated to support country_car for almost all
+ supported locales.
+
+* ISO 1427 definitions were updated.
* The configure option --disable-versioning has been removed. Builds with
--disable-versioning had not worked for several years.
+
+* ISO 639 definitions were updated for Chiga (cgg) and Chinese (gan, hak, czh,
+ cjy, lzh, cmn, mnp, cdo, czo, cpx, wuu, hsn, yue).
+
+* SystemTap probes for malloc have been introduced.
Version 2.18
Modified: fsf/trunk/libc/include/string.h
==============================================================================
--- fsf/trunk/libc/include/string.h (original)
+++ fsf/trunk/libc/include/string.h Sat Sep 21 00:02:02 2013
@@ -90,6 +90,7 @@
libc_hidden_proto (__strsep_g)
libc_hidden_proto (strnlen)
libc_hidden_proto (memmem)
+libc_hidden_proto (__ffs)
libc_hidden_builtin_proto (memchr)
libc_hidden_builtin_proto (memcpy)
Modified: fsf/trunk/libc/locale/iso-639.def
==============================================================================
--- fsf/trunk/libc/locale/iso-639.def (original)
+++ fsf/trunk/libc/locale/iso-639.def Sat Sep 21 00:02:02 2013
@@ -95,6 +95,7 @@
DEFINE_LANGUAGE_CODE2 ("Chhattisgarhi", hne) /* ISO 639-3 */
DEFINE_LANGUAGE_CODE3 ("Chibcha", chb, chb)
DEFINE_LANGUAGE_CODE ("Chichewa; Chewa; Nyanja", ny, nya, nya)
+DEFINE_LANGUAGE_CODE3 ("Chiga", cgg, cgg)
DEFINE_LANGUAGE_CODE ("Chinese", zh, zho, chi)
DEFINE_LANGUAGE_CODE3 ("Chinook jargon", chn, chn)
DEFINE_LANGUAGE_CODE3 ("Chipewyan", chp, chp)
@@ -161,6 +162,7 @@
DEFINE_LANGUAGE_CODE ("Fulah", ff, ful, ful)
DEFINE_LANGUAGE_CODE ("Gaelic; Scottish Gaelic", gd, gla, gla)
DEFINE_LANGUAGE_CODE ("Galician", gl, glg, glg)
+DEFINE_LANGUAGE_CODE3 ("Gan Chinese", gan, gan)
DEFINE_LANGUAGE_CODE ("Ganda", lg, lug, lug)
DEFINE_LANGUAGE_CODE3 ("Gayo", gay, gay)
DEFINE_LANGUAGE_CODE3 ("Ga", gaa, gaa)
@@ -184,6 +186,7 @@
DEFINE_LANGUAGE_CODE3 ("GwichÃÂin", gwi, gwi)
DEFINE_LANGUAGE_CODE3 ("Haida", hai, hai)
DEFINE_LANGUAGE_CODE ("Haitian; Haitian Creole", ht, hat, hat)
+DEFINE_LANGUAGE_CODE3 ("Hakka Chinese", hak, hak)
DEFINE_LANGUAGE_CODE ("Hausa", ha, hau, hau)
DEFINE_LANGUAGE_CODE3 ("Hawaiian", haw, haw)
DEFINE_LANGUAGE_CODE ("Hebrew", he, heb, heb)
@@ -194,6 +197,7 @@
DEFINE_LANGUAGE_CODE ("Hiri Motu", ho, hmo, hmo)
DEFINE_LANGUAGE_CODE3 ("Hittite", hit, hit)
DEFINE_LANGUAGE_CODE3 ("Hmong", hmn, hmn)
+DEFINE_LANGUAGE_CODE3 ("Huizhou Chinese", czh, czh)
DEFINE_LANGUAGE_CODE ("Hungarian", hu, hun, hun)
DEFINE_LANGUAGE_CODE3 ("Hupa", hup, hup)
DEFINE_LANGUAGE_CODE3 ("Iban", iba, iba)
@@ -219,6 +223,7 @@
DEFINE_LANGUAGE_CODE ("Italian", it, ita, ita)
DEFINE_LANGUAGE_CODE ("Japanese", ja, jpn, jpn)
DEFINE_LANGUAGE_CODE ("Javanese", jv, jav, jav)
+DEFINE_LANGUAGE_CODE3 ("Jinyu Chinese", cjy, cjy)
DEFINE_LANGUAGE_CODE3 ("Judeo-Arabic", jrb, jrb)
DEFINE_LANGUAGE_CODE3 ("Judeo-Persian", jpr, jpr)
DEFINE_LANGUAGE_CODE3 ("Kabardian", kbd, kbd)
@@ -267,6 +272,7 @@
DEFINE_LANGUAGE_CODE3 ("Lezghian", lez, lez)
DEFINE_LANGUAGE_CODE ("Limburgan; Limburger; Limburgish", li, lim, lim)
DEFINE_LANGUAGE_CODE ("Lingala", ln, lin, lin)
+DEFINE_LANGUAGE_CODE3 ("Literary Chinese", lzh, lzh)
DEFINE_LANGUAGE_CODE ("Lithuanian", lt, lit, lit)
DEFINE_LANGUAGE_CODE3 ("Lojban", jbo, jbo)
DEFINE_LANGUAGE_CODE3 ("Low German; Low Saxon; German, Low; Saxon, Low", nds, nds)
@@ -290,6 +296,7 @@
DEFINE_LANGUAGE_CODE ("Malay", ms, msa, may)
DEFINE_LANGUAGE_CODE ("Maltese", mt, mlt, mlt)
DEFINE_LANGUAGE_CODE3 ("Manchu", mnc, mnc)
+DEFINE_LANGUAGE_CODE3 ("Mandarin Chinese", cmn, cmn)
DEFINE_LANGUAGE_CODE3 ("Mandar", mdr, mdr)
DEFINE_LANGUAGE_CODE3 ("Mandingo", man, man)
DEFINE_LANGUAGE_CODE3 ("Manipuri", mni, mni)
@@ -305,7 +312,10 @@
DEFINE_LANGUAGE_CODE3 ("Mende", men, men)
DEFINE_LANGUAGE_CODE3 ("Mi'kmaq; Micmac", mic, mic)
DEFINE_LANGUAGE_CODE3 ("Minangkabau", min, min)
-DEFINE_LANGUAGE_CODE3 ("Min Nan", nan, nan)
+DEFINE_LANGUAGE_CODE3 ("Min Bei Chinese", mnp, mnp)
+DEFINE_LANGUAGE_CODE3 ("Min Dong Chinese", cdo, cdo)
+DEFINE_LANGUAGE_CODE3 ("Min Nan Chinese", nan, nan)
+DEFINE_LANGUAGE_CODE3 ("Min Zhong Chinese", czo, czo)
DEFINE_LANGUAGE_CODE3 ("Mirandese", mwl, mwl)
DEFINE_LANGUAGE_CODE3 ("Miscellaneous languages", mis, mis)
DEFINE_LANGUAGE_CODE3 ("Mohawk", moh, moh)
@@ -369,6 +379,7 @@
DEFINE_LANGUAGE_CODE ("Portuguese", pt, por, por)
DEFINE_LANGUAGE_CODE3 ("Prakrit languages", pra, pra)
DEFINE_LANGUAGE_CODE3 ("ProvenÃÂal, Old (to 1500)", pro, pro)
+DEFINE_LANGUAGE_CODE3 ("Pu-Xian Chinese", cpx, cpx)
DEFINE_LANGUAGE_CODE ("Pushto", ps, pus, pus)
DEFINE_LANGUAGE_CODE ("Quechua", qu, que, que)
DEFINE_LANGUAGE_CODE ("Raeto-Romance", rm, roh, roh)
@@ -486,12 +497,15 @@
DEFINE_LANGUAGE_CODE3 ("Washo", was, was)
DEFINE_LANGUAGE_CODE ("Welsh", cy, cym, wel)
DEFINE_LANGUAGE_CODE ("Wolof", wo, wol, wol)
+DEFINE_LANGUAGE_CODE3 ("Wu Chinese", wuu, wuu)
DEFINE_LANGUAGE_CODE ("Xhosa", xh, xho, xho)
+DEFINE_LANGUAGE_CODE3 ("Xiang Chinese", hsn, hsn)
DEFINE_LANGUAGE_CODE3 ("Yakut", sah, sah)
DEFINE_LANGUAGE_CODE3 ("Yao", yao, yao)
DEFINE_LANGUAGE_CODE3 ("Yapese", yap, yap)
DEFINE_LANGUAGE_CODE ("Yiddish", yi, yid, yid)
DEFINE_LANGUAGE_CODE ("Yoruba", yo, yor, yor)
+DEFINE_LANGUAGE_CODE3 ("Yue Chinese", yue, yue)
DEFINE_LANGUAGE_CODE3 ("Yupik languages", ypk, ypk)
DEFINE_LANGUAGE_CODE3 ("Zande", znd, znd)
DEFINE_LANGUAGE_CODE3 ("Zapotec", zap, zap)
Modified: fsf/trunk/libc/malloc/arena.c
==============================================================================
--- fsf/trunk/libc/malloc/arena.c (original)
+++ fsf/trunk/libc/malloc/arena.c Sat Sep 21 00:02:02 2013
@@ -581,6 +581,7 @@
h->size = size;
h->mprotect_size = size;
THREAD_STAT(stat_n_heaps++);
+ LIBC_PROBE (memory_heap_new, 2, h, h->size);
return h;
}
@@ -606,6 +607,7 @@
}
h->size = new_size;
+ LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
@@ -633,6 +635,7 @@
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
+ LIBC_PROBE (memory_heap_less, 2, h, h->size);
return 0;
}
@@ -674,6 +677,7 @@
break;
ar_ptr->system_mem -= heap->size;
arena_mem -= heap->size;
+ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
delete_heap(heap);
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
@@ -736,6 +740,7 @@
top(a) = (mchunkptr)ptr;
set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
+ LIBC_PROBE (memory_arena_new, 2, a, size);
tsd_setspecific(arena_key, (void *)a);
mutex_init(&a->mutex);
(void)mutex_lock(&a->mutex);
@@ -774,6 +779,7 @@
if (result != NULL)
{
+ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
(void)mutex_lock(&result->mutex);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
@@ -810,9 +816,11 @@
result = result->next;
/* No arena available. Wait for the next in line. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
(void)mutex_lock(&result->mutex);
out:
+ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
next_to_use = result->next;
@@ -891,6 +899,7 @@
if (retried)
(void)mutex_unlock(&list_lock);
THREAD_STAT(++(a->stat_lock_loop));
+ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
tsd_setspecific(arena_key, (void *)a);
return a;
}
@@ -903,6 +912,7 @@
locks. */
if(!retried && mutex_trylock(&list_lock)) {
/* We will block to not run in a busy loop. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
(void)mutex_lock(&list_lock);
/* Since we blocked there might be an arena available now. */
@@ -926,6 +936,7 @@
static mstate
arena_get_retry (mstate ar_ptr, size_t bytes)
{
+ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
if(ar_ptr != &main_arena) {
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Sat Sep 21 00:02:02 2013
@@ -1878,6 +1878,8 @@
#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
+#include <stap-probe.h>
+
/* ------------------- Support for multiple arenas -------------------- */
#include "arena.c"
@@ -2446,8 +2448,10 @@
below even if we cannot call MORECORE.
*/
- if (size > 0)
+ if (size > 0) {
brk = (char*)(MORECORE(size));
+ LIBC_PROBE (memory_sbrk_more, 2, brk, size);
+ }
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
@@ -2745,6 +2749,8 @@
(*hook) ();
new_brk = (char*)(MORECORE(0));
+ LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
+
if (new_brk != (char*)MORECORE_FAILURE) {
released = (long)(current_brk - new_brk);
@@ -2854,6 +2860,7 @@
return 0;
victim = _int_malloc(ar_ptr, bytes);
if(!victim) {
+ LIBC_PROBE (memory_malloc_retry, 1, bytes);
ar_ptr = arena_get_retry(ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
victim = _int_malloc(ar_ptr, bytes);
@@ -2894,6 +2901,8 @@
{
mp_.mmap_threshold = chunksize (p);
mp_.trim_threshold = 2 * mp_.mmap_threshold;
+ LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2,
+ mp_.mmap_threshold, mp_.trim_threshold);
}
munmap_chunk(p);
return;
@@ -2973,6 +2982,7 @@
#endif
#if !defined PER_THREAD
+ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
/* As in malloc(), remember this arena for the next allocation. */
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
@@ -2986,6 +2996,7 @@
if (newp == NULL)
{
/* Try harder to allocate memory in other arenas. */
+ LIBC_PROBE (memory_realloc_retry, 2, bytes, oldmem);
newp = __libc_malloc(bytes);
if (newp != NULL)
{
@@ -3027,6 +3038,7 @@
return 0;
p = _int_memalign(ar_ptr, alignment, bytes);
if(!p) {
+ LIBC_PROBE (memory_memalign_retry, 2, bytes, alignment);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, alignment, bytes);
@@ -3070,6 +3082,7 @@
return 0;
p = _int_valloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_valloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, bytes);
@@ -3111,6 +3124,7 @@
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
p = _int_pvalloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_pvalloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
@@ -3187,6 +3201,7 @@
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
+ LIBC_PROBE (memory_calloc_retry, 1, sz);
av = arena_get_retry (av, sz);
if (__builtin_expect(av != NULL, 1)) {
mem = _int_malloc(av, sz);
@@ -4695,21 +4710,29 @@
/* Ensure initialization/consolidation */
malloc_consolidate(av);
+ LIBC_PROBE (memory_mallopt, 2, param_number, value);
+
switch(param_number) {
case M_MXFAST:
- if (value >= 0 && value <= MAX_FAST_SIZE) {
- set_max_fast(value);
- }
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
+ set_max_fast(value);
+ }
else
res = 0;
break;
case M_TRIM_THRESHOLD:
+ LIBC_PROBE (memory_mallopt_trim_threshold, 3, value,
+ mp_.trim_threshold, mp_.no_dyn_threshold);
mp_.trim_threshold = value;
mp_.no_dyn_threshold = 1;
break;
case M_TOP_PAD:
+ LIBC_PROBE (memory_mallopt_top_pad, 3, value,
+ mp_.top_pad, mp_.no_dyn_threshold);
mp_.top_pad = value;
mp_.no_dyn_threshold = 1;
break;
@@ -4720,33 +4743,45 @@
res = 0;
else
{
+ LIBC_PROBE (memory_mallopt_mmap_threshold, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.mmap_threshold = value;
mp_.no_dyn_threshold = 1;
}
break;
case M_MMAP_MAX:
+ LIBC_PROBE (memory_mallopt_mmap_max, 3, value,
+ mp_.n_mmaps_max, mp_.no_dyn_threshold);
mp_.n_mmaps_max = value;
mp_.no_dyn_threshold = 1;
break;
case M_CHECK_ACTION:
+ LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action);
check_action = value;
break;
case M_PERTURB:
+ LIBC_PROBE (memory_mallopt_perturb, 2, value, perturb_byte);
perturb_byte = value;
break;
#ifdef PER_THREAD
case M_ARENA_TEST:
if (value > 0)
- mp_.arena_test = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_test, 2, value, mp_.arena_test);
+ mp_.arena_test = value;
+ }
break;
case M_ARENA_MAX:
if (value > 0)
- mp_.arena_max = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_max, 2, value, mp_.arena_max);
+ mp_.arena_max = value;
+ }
break;
#endif
}
Modified: fsf/trunk/libc/manual/Makefile
==============================================================================
--- fsf/trunk/libc/manual/Makefile (original)
+++ fsf/trunk/libc/manual/Makefile Sat Sep 21 00:02:02 2013
@@ -42,7 +42,7 @@
message search pattern io stdio llio filesys \
pipe socket terminal syslog math arith time \
resource setjmp signal startup process job nss \
- users sysinfo conf crypt debug threads)
+ users sysinfo conf crypt debug threads probes)
add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
contrib.texi
Added: fsf/trunk/libc/manual/probes.texi
==============================================================================
--- fsf/trunk/libc/manual/probes.texi (added)
+++ fsf/trunk/libc/manual/probes.texi Sat Sep 21 00:02:02 2013
@@ -1,0 +1,257 @@
+@node Internal Probes
+@c @node Internal Probes, , POSIX Threads, Top
+@c %MENU% Probes to monitor libc internal behavior
+@chapter Internal probes
+
+In order to aid in debugging and monitoring internal behavior,
+@theglibc{} exposes nearly-zero-overhead SystemTap probes marked with
+the @code{libc} provider.
+
+These probes are not part of the @glibcadj{} stable ABI, and they are
+subject to change or removal across releases. Our only promise with
+regard to them is that, if we find a need to remove or modify the
+arguments of a probe, the modified probe will have a different name, so
+that program monitors relying on the old probe will not get unexpected
+arguments.
+
+@menu
+* Memory Allocation Probes:: Probes in the memory allocation subsystem
+@end menu
+
+@node Memory Allocation Probes
+@section Memory Allocation Probes
+
+These probes are designed to signal relatively unusual situations within
+the virtual memory subsystem of @theglibc{}. The location and the
+availability of some probes depend on whether per-thread arenas are
+enabled (the default) or disabled at the time @theglibc{} is compiled.
+
+@deftp Probe memory_sbrk_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after the main arena is extended by calling
+@code{sbrk}. Argument @var{$arg1} is the additional size requested to
+@code{sbrk}, and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_sbrk_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after the size of the main arena is decreased by
+calling @code{sbrk}. Argument @var{$arg1} is the size released by
+@code{sbrk} (the positive value, rather than the negative value passed
+to @code{sbrk}), and @var{$arg2} is the pointer that marks the end of
+the @code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_heap_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after a new heap is @code{mmap}ed. Argument
+@var{$arg1} is a pointer to the base of the memory area, where the
+@code{heap_info} data structure is held, and @var{$arg2} is the size of
+the heap.
+@end deftp
+
+@deftp Probe memory_heap_free (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered @emph{before} (unlike the other sbrk and heap
+probes) a heap is completely removed via @code{munmap}. Argument
+@var{$arg1} is a pointer to the heap, and @var{$arg2} is the size of the
+heap.
+@end deftp
+
+@deftp Probe memory_heap_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after a trailing portion of an @code{mmap}ed
+heap is extended. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered after a trailing portion of an @code{mmap}ed
+heap is released. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_malloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
+@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
+@deftpx Probe memory_valloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_pvalloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_calloc_retry (size_t @var{$arg1})
+These probes are triggered when the corresponding functions fail to
+obtain the requested amount of memory from the arena in use, before they
+call @code{arena_get_retry} to select an alternate arena in which to
+retry the allocation. Argument @var{$arg1} is the amount of memory
+requested by the user; in the @code{calloc} case, that is the total size
+computed from both function arguments. In the @code{realloc} case,
+@var{$arg2} is the pointer to the memory area being resized. In the
+@code{memalign} case, @var{$arg2} is the alignment to be used for the
+request, which may be stricter than the value passed to the
+@code{memalign} function.
+
+Note that the argument order does @emph{not} match that of the
+corresponding two-argument functions, so that in all of these probes the
+user-requested allocation size is in @var{$arg1}.
+@end deftp
+
+@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
+This probe is triggered within @code{arena_get_retry} (the function
+called to select the alternate arena in which to retry an allocation
+that failed on the first attempt), before the selection of an alternate
+arena. This probe is redundant, but much easier to use when it's not
+important to determine which of the various memory allocation functions
+is failing to allocate on the first try. Argument @var{$arg1} is the
+same as in the function-specific probes, except for extra room for
+padding introduced by functions that have to ensure stricter alignment.
+Argument @var{$arg2} is the arena in which allocation failed.
+@end deftp
+
+@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is triggered when @code{malloc} allocates and initializes an
+additional arena (not the main arena), but before the arena is assigned
+to the running thread or inserted into the internal linked list of
+arenas. The arena's @code{malloc_state} internal data structure is
+located at @var{$arg1}, within a newly-allocated heap big enough to hold
+at least @var{$arg2} bytes.
+@end deftp
+
+@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
+This probe is triggered when @code{malloc} has just selected an existing
+arena to reuse, and (temporarily) reserved it for exclusive use.
+Argument @var{$arg1} is a pointer to the newly-selected arena, and
+@var{$arg2} is a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
+@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
+point to the same arena. In this configuration, this will usually only
+occur once per thread. The exception is when a thread first selected
+the main arena, but a subsequent allocation from it fails: then, and
+only then, may we switch to another arena to retry that allocations, and
+for further allocations within that thread.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, whenever the mutex for the previously-selected arena
+cannot be immediately acquired.
+@end deftp
+
+@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
+This probe is triggered when @code{malloc} is about to wait for an arena
+to become available for reuse. Argument @var{$arg1} holds a pointer to
+the mutex the thread is going to wait on, @var{$arg2} is a pointer to a
+newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
+arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, when a thread first tries to allocate memory or
+needs a retry after a failure to allocate from the main arena, there
+isn't any free arena, the maximum number of arenas has been reached, and
+an existing arena was chosen for reuse, but its mutex could not be
+immediately acquired. The mutex in @var{$arg1} is the mutex of the
+selected arena.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, when a thread first tries to allocate memory or the
+mutex of the arena it previously used could not be immediately acquired,
+and none of the existing arenas could be immediately reserved for
+exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
+and since the arena won't have been selected yet, @var{$arg2} will be
+@code{NULL}.
+@end deftp
+
+@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
+This probe is triggered when @code{malloc} has chosen an arena that is
+in the free list for use by a thread, within the @code{get_free_list}
+function. This probe is only available when @code{malloc} is configured
+to use per-thread arenas. The argument @var{$arg1} holds a pointer to
+the selected arena.
+@end deftp
+
+@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
+This probe is triggered within @code{realloc}, as the arena of the
+current thread is changed to match that in which the given address was
+allocated. This probe is @emph{not} available when @code{malloc} is
+configured to use per-thread arenas. The argument @var{$arg1} holds a
+pointer to the newly-selected arena.
+@end deftp
+
+@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
+This probe is triggered when function @code{mallopt} is called to change
+@code{malloc} internal configuration parameters, before any change to
+the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
+the ones passed to the @code{mallopt} function.
+@end deftp
+
+@deftp Probe memory_mallopt_mxfast (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_MXFAST}, and the requested
+value is in an acceptable range. Argument @var{$arg1} is the requested
+value, and @var{$arg2} is the previous value of this @code{malloc}
+parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_trim_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is triggere shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_TRIM_THRESHOLD}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustment was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_top_pad (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_TOP_PAD}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustment was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_MMAP_THRESHOLD}, and the
+requested value is in an acceptable range. Argument @var{$arg1} is the
+requested value, @var{$arg2} is the previous value of this @code{malloc}
+parameter, and @var{$arg3} is nonzero if dynamic threshold adjustment
+was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_max (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_MMAP_MAX}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustment was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_CHECK_ACTION}. Argument
+@var{$arg1} is the requested value, and @var{$arg2} is the previous
+value of this @code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_PERTURB}. Argument
+@var{$arg1} is the requested value, and @var{$arg2} is the previous
+value of this @code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_arena_test (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_ARENA_TEST}, and the
+requested value is in an acceptable range. Argument @var{$arg1} is the
+requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter. This probe is only available when per-thread
+arenas are enabled.
+@end deftp
+
+@deftp Probe memory_mallopt_arena_max (int @var{$arg1}, int @var{$arg2})
+This probe is triggered shortly after the @code{memory_mallopt} probe,
+when the parameter to be changed is @code{M_ARENA_MAX}, and the
+requested value is in an acceptable range. Argument @var{$arg1} is the
+requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter. This probe is only available when per-thread
+arenas are enabled.
+@end deftp
+
+@deftp Probe memory_mallopt_free_dyn_thresholds (int @var{$arg1}, int @var{$arg2})
+This probe is triggered when function @code{free} decides to adjust the
+dynamic brk/mmap thresholds. Argument @var{$arg1} and @var{$arg2} are
+the adjusted mmap and trim thresholds, respectively.
+@end deftp
Modified: fsf/trunk/libc/manual/threads.texi
==============================================================================
--- fsf/trunk/libc/manual/threads.texi (original)
+++ fsf/trunk/libc/manual/threads.texi Sat Sep 21 00:02:02 2013
@@ -1,5 +1,5 @@
@node POSIX Threads
-@c @node POSIX Threads, , Cryptographic Functions, Top
+@c @node POSIX Threads, Intenal Probes, Cryptographic Functions, Top
@chapter POSIX Threads
@c %MENU% POSIX Threads
@cindex pthreads
Modified: fsf/trunk/libc/ports/ChangeLog.alpha
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.alpha (original)
+++ fsf/trunk/libc/ports/ChangeLog.alpha Sat Sep 21 00:02:02 2013
@@ -1,3 +1,8 @@
+2013-09-20 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
+
+ * sysdeps/alpha/alphaev67/ffs.S (__ffs): Define as hidden.
+ * sysdeps/alpha/ffs.S (__ffs): Likewise.
+
2013-09-11 Andreas Schwab <schwab@xxxxxxx>
* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (__O_TMPFILE):
Modified: fsf/trunk/libc/ports/ChangeLog.arm
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.arm (original)
+++ fsf/trunk/libc/ports/ChangeLog.arm Sat Sep 21 00:02:02 2013
@@ -1,3 +1,7 @@
+2013-09-20 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
+
+ * sysdeps/arm/armv6t2/ffs.S (__ffs): Define as hidden.
+
2013-09-18 Dinar Temirbulatov <dtemirbulatov@xxxxxxxxx>
[BZ #15640]
Modified: fsf/trunk/libc/ports/ChangeLog.m68k
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.m68k (original)
+++ fsf/trunk/libc/ports/ChangeLog.m68k Sat Sep 21 00:02:02 2013
@@ -1,3 +1,7 @@
+2013-09-20 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
+
+ * sysdeps/m68k/ffs.c (__ffs): Define as hidden.
+
2013-09-04 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
* sysdeps/unix/sysv/linux/m68k/mmap64.c: New file.
Modified: fsf/trunk/libc/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.mips (original)
+++ fsf/trunk/libc/ports/ChangeLog.mips Sat Sep 21 00:02:02 2013
@@ -1,3 +1,8 @@
+2013-09-20 Steve Ellcey <sellcey@xxxxxxxx>
+
+ * sysdeps/mips/memset.S: Change prefetching and add loop unrolling.
+ * sysdeps/mips/mips64/memset.S: Remove.
+
2013-09-18 Maciej W. Rozycki <macro@xxxxxxxxxxxxxxxx>
Thomas Schwinge <thomas@xxxxxxxxxxxxxxxx>
Modified: fsf/trunk/libc/ports/ChangeLog.tile
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.tile (original)
+++ fsf/trunk/libc/ports/ChangeLog.tile Sat Sep 21 00:02:02 2013
@@ -1,3 +1,7 @@
+2013-09-20 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
+
+ * sysdeps/tile/ffs.c (__ffs): Define as hidden.
+
2013-08-21 OndÃÂej BÃÂlka <neleai@xxxxxxxxx>
* sysdeps/tile/jmpbuf-offsets.h: Fix typos.
Modified: fsf/trunk/libc/ports/sysdeps/alpha/alphaev67/ffs.S
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/alpha/alphaev67/ffs.S (original)
+++ fsf/trunk/libc/ports/sysdeps/alpha/alphaev67/ffs.S Sat Sep 21 00:02:02 2013
@@ -47,4 +47,5 @@
END(__ffs)
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
Modified: fsf/trunk/libc/ports/sysdeps/alpha/ffs.S
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/alpha/ffs.S (original)
+++ fsf/trunk/libc/ports/sysdeps/alpha/ffs.S Sat Sep 21 00:02:02 2013
@@ -85,6 +85,7 @@
END(ffsl)
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
weak_extern (ffsl)
weak_alias (ffsl, ffsll)
Modified: fsf/trunk/libc/ports/sysdeps/arm/armv6t2/ffs.S
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/arm/armv6t2/ffs.S (original)
+++ fsf/trunk/libc/ports/sysdeps/arm/armv6t2/ffs.S Sat Sep 21 00:02:02 2013
@@ -32,4 +32,5 @@
weak_alias (__ffs, ffs)
weak_alias (__ffs, ffsl)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
Modified: fsf/trunk/libc/ports/sysdeps/m68k/ffs.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/m68k/ffs.c (original)
+++ fsf/trunk/libc/ports/sysdeps/m68k/ffs.c Sat Sep 21 00:02:02 2013
@@ -36,6 +36,7 @@
return 32 - cnt;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#undef ffsl
weak_alias (__ffs, ffsl)
Modified: fsf/trunk/libc/ports/sysdeps/mips/memset.S
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/memset.S (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/memset.S Sat Sep 21 00:02:02 2013
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Hartvig Ekner <hartvige@xxxxxxxx>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,70 +15,353 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <sysdep.h>
+#ifdef ANDROID_CHANGES
+# include "machine/asm.h"
+# include "machine/regdef.h"
+# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
+#elif _LIBC
+# include <sysdep.h>
+# include <regdef.h>
+# include <sys/asm.h>
+# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
+#elif _COMPILING_NEWLIB
+# include "machine/asm.h"
+# include "machine/regdef.h"
+# define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
+#else
+# include <regdef.h>
+# include <sys/asm.h>
+#endif
+
+/* Check to see if the MIPS architecture we are compiling for supports
+ prefetching. */
+
+#if (__mips == 4) || (__mips == 5) || (__mips == 32) || (__mips == 64)
+# ifndef DISABLE_PREFETCH
+# define USE_PREFETCH
+# endif
+#endif
+
+#if defined(_MIPS_SIM) && ((_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32))
+# ifndef DISABLE_DOUBLE
+# define USE_DOUBLE
+# endif
+#endif
+
+#ifndef USE_DOUBLE
+# ifndef DISABLE_DOUBLE_ALIGN
+# define DOUBLE_ALIGN
+# endif
+#endif
+
+/* Some asm.h files do not have the L macro definition. */
+#ifndef L
+# if _MIPS_SIM == _ABIO32
+# define L(label) $L ## label
+# else
+# define L(label) .L ## label
+# endif
+#endif
+
+/* Some asm.h files do not have the PTR_ADDIU macro definition. */
+#ifndef PTR_ADDIU
+# ifdef USE_DOUBLE
+# define PTR_ADDIU daddiu
+# else
+# define PTR_ADDIU addiu
+# endif
+#endif
+
+/* Using PREFETCH_HINT_PREPAREFORSTORE instead of PREFETCH_STORE
+ or PREFETCH_STORE_STREAMED offers a large performance advantage
+ but PREPAREFORSTORE has some special restrictions to consider.
+
+ Prefetch with the 'prepare for store' hint does not copy a memory
+ location into the cache, it just allocates a cache line and zeros
+ it out. This means that if you do not write to the entire cache
+ line before writing it out to memory some data will get zero'ed out
+ when the cache line is written back to memory and data will be lost.
+
+ There are ifdef'ed sections of this memcpy to make sure that it does not
+ do prefetches on cache lines that are not going to be completely written.
+ This code is only needed and only used when PREFETCH_STORE_HINT is set to
+ PREFETCH_HINT_PREPAREFORSTORE. This code assumes that cache lines are
+ less than MAX_PREFETCH_SIZE bytes and if the cache line is larger it will
+ not work correctly. */
+
+#ifdef USE_PREFETCH
+# define PREFETCH_HINT_STORE 1
+# define PREFETCH_HINT_STORE_STREAMED 5
+# define PREFETCH_HINT_STORE_RETAINED 7
+# define PREFETCH_HINT_PREPAREFORSTORE 30
+
+/* If we have not picked out what hints to use at this point use the
+ standard load and store prefetch hints. */
+# ifndef PREFETCH_STORE_HINT
+# define PREFETCH_STORE_HINT PREFETCH_HINT_STORE
+# endif
+
+/* We double everything when USE_DOUBLE is true so we do 2 prefetches to
+ get 64 bytes in that case. The assumption is that each individual
+ prefetch brings in 32 bytes. */
+# ifdef USE_DOUBLE
+# define PREFETCH_CHUNK 64
+# define PREFETCH_FOR_STORE(chunk, reg) \
+ pref PREFETCH_STORE_HINT, (chunk)*64(reg); \
+ pref PREFETCH_STORE_HINT, ((chunk)*64)+32(reg)
+# else
+# define PREFETCH_CHUNK 32
+# define PREFETCH_FOR_STORE(chunk, reg) \
+ pref PREFETCH_STORE_HINT, (chunk)*32(reg)
+# endif
+
+/* MAX_PREFETCH_SIZE is the maximum size of a prefetch, it must not be less
+ than PREFETCH_CHUNK, the assumed size of each prefetch. If the real size
+ of a prefetch is greater than MAX_PREFETCH_SIZE and the PREPAREFORSTORE
+ hint is used, the code will not work correctly. If PREPAREFORSTORE is not
+ used than MAX_PREFETCH_SIZE does not matter. */
+# define MAX_PREFETCH_SIZE 128
+/* PREFETCH_LIMIT is set based on the fact that we never use an offset greater
+ than 5 on a STORE prefetch and that a single prefetch can never be larger
+ than MAX_PREFETCH_SIZE. We add the extra 32 when USE_DOUBLE is set because
+ we actually do two prefetches in that case, one 32 bytes after the other. */
+# ifdef USE_DOUBLE
+# define PREFETCH_LIMIT (5 * PREFETCH_CHUNK) + 32 + MAX_PREFETCH_SIZE
+# else
+# define PREFETCH_LIMIT (5 * PREFETCH_CHUNK) + MAX_PREFETCH_SIZE
+# endif
+
+# if (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE) \
+ && ((PREFETCH_CHUNK * 4) < MAX_PREFETCH_SIZE)
+/* We cannot handle this because the initial prefetches may fetch bytes that
+ are before the buffer being copied. We start copies with an offset
+ of 4 so avoid this situation when using PREPAREFORSTORE. */
+# error "PREFETCH_CHUNK is too large and/or MAX_PREFETCH_SIZE is too small."
+# endif
+#else /* USE_PREFETCH not defined */
+# define PREFETCH_FOR_STORE(offset, reg)
+#endif
+
+/* Allow the routine to be named something else if desired. */
+#ifndef MEMSET_NAME
+# define MEMSET_NAME memset
+#endif
+
+/* We load/store 64 bits at a time when USE_DOUBLE is true.
+ The C_ prefix stands for CHUNK and is used to avoid macro name
+ conflicts with system header files. */
+
+#ifdef USE_DOUBLE
+# define C_ST sd
+# if __MIPSEB
+# define C_STHI sdl /* high part is left in big-endian */
+# else
+# define C_STHI sdr /* high part is right in little-endian */
+# endif
+#else
+# define C_ST sw
+# if __MIPSEB
+# define C_STHI swl /* high part is left in big-endian */
+# else
+# define C_STHI swr /* high part is right in little-endian */
+# endif
+#endif
+
+/* Bookkeeping values for 32 vs. 64 bit mode. */
+#ifdef USE_DOUBLE
+# define NSIZE 8
+# define NSIZEMASK 0x3f
+# define NSIZEDMASK 0x7f
+#else
+# define NSIZE 4
+# define NSIZEMASK 0x1f
+# define NSIZEDMASK 0x3f
+#endif
+#define UNIT(unit) ((unit)*NSIZE)
+#define UNITM1(unit) (((unit)*NSIZE)-1)
+
+#ifdef ANDROID_CHANGES
+LEAF(MEMSET_NAME,0)
+#else
+LEAF(MEMSET_NAME)
+#endif
.set nomips16
-
-/* void *memset(void *s, int c, size_t n). */
-
-#if __MIPSEB
-# define SWHI swl /* high part is left in big-endian */
-#else
-# define SWHI swr /* high part is right in little-endian */
-#endif
-
-ENTRY (memset)
.set noreorder
-
- slti t1, a2, 8 # Less than 8?
- bne t1, zero, L(last8)
- move v0, a0 # Setup exit value before too late
-
- beq a1, zero, L(ueven) # If zero pattern, no need to extend
- andi a1, 0xff # Avoid problems with bogus arguments
- sll t0, a1, 8
- or a1, t0
- sll t0, a1, 16
- or a1, t0 # a1 is now pattern in full word
-
-L(ueven):
- subu t0, zero, a0 # Unaligned address?
- andi t0, 0x3
- beq t0, zero, L(chkw)
- subu a2, t0
- SWHI a1, 0(a0) # Yes, handle first unaligned part
- addu a0, t0 # Now both a0 and a2 are updated
-
+/* If the size is less than 2*NSIZE (8 or 16), go to L(lastb). Regardless of
+ size, copy dst pointer to v0 for the return value. */
+ slti t2,a2,(2 * NSIZE)
+ bne t2,zero,L(lastb)
+ move v0,a0
+
+/* If memset value is not zero, we copy it to all the bytes in a 32 or 64
+ bit word. */
+ beq a1,zero,L(set0) /* If memset value is zero no smear */
+ PTR_SUBU a3,zero,a0
+ nop
+
+ /* smear byte into 32 or 64 bit word */
+#if ((__mips == 64) || (__mips == 32)) && (__mips_isa_rev >= 2)
+# ifdef USE_DOUBLE
+ dins a1, a1, 8, 8 /* Replicate fill byte into half-word. */
+ dins a1, a1, 16, 16 /* Replicate fill byte into word. */
+ dins a1, a1, 32, 32 /* Replicate fill byte into dbl word. */
+# else
+ ins a1, a1, 8, 8 /* Replicate fill byte into half-word. */
+ ins a1, a1, 16, 16 /* Replicate fill byte into word. */
+# endif
+#else
+# ifdef USE_DOUBLE
+ and a1,0xff
+ dsll t2,a1,8
+ or a1,t2
+ dsll t2,a1,16
+ or a1,t2
+ dsll t2,a1,32
+ or a1,t2
+# else
+ and a1,0xff
+ sll t2,a1,8
+ or a1,t2
+ sll t2,a1,16
+ or a1,t2
+# endif
+#endif
+
+/* If the destination address is not aligned do a partial store to get it
+ aligned. If it is already aligned just jump to L(aligned). */
+L(set0):
+ andi t2,a3,(NSIZE-1) /* word-unaligned address? */
+ beq t2,zero,L(aligned) /* t2 is the unalignment count */
+ PTR_SUBU a2,a2,t2
+ C_STHI a1,0(a0)
+ PTR_ADDU a0,a0,t2
+
+L(aligned):
+/* If USE_DOUBLE is not set we may still want to align the data on a 16
+ byte boundry instead of an 8 byte boundry to maximize the opportunity
+ of proAptiv chips to do memory bonding (combining two sequential 4
+ byte stores into one 8 byte store). We know there are at least 4 bytes
+ left to store or we would have jumped to L(lastb) earlier in the code. */
+#ifdef DOUBLE_ALIGN
+ andi t2,a3,4
+ beq t2,zero,L(double_aligned)
+ PTR_SUBU a2,a2,t2
+ sw a1,0(a0)
+ PTR_ADDU a0,a0,t2
+L(double_aligned):
+#endif
+
+/* Now the destination is aligned to (word or double word) aligned address
+ Set a2 to count how many bytes we have to copy after all the 64/128 byte
+ chunks are copied and a3 to the dest pointer after all the 64/128 byte
+ chunks have been copied. We will loop, incrementing a0 until it equals
+ a3. */
+ andi t8,a2,NSIZEDMASK /* any whole 64-byte/128-byte chunks? */
+ beq a2,t8,L(chkw) /* if a2==t8, no 64-byte/128-byte chunks */
+ PTR_SUBU a3,a2,t8 /* subtract from a2 the reminder */
+ PTR_ADDU a3,a0,a3 /* Now a3 is the final dst after loop */
+
+/* When in the loop we may prefetch with the 'prepare to store' hint,
+ in this case the a0+x should not be past the "t0-32" address. This
+ means: for x=128 the last "safe" a0 address is "t0-160". Alternatively,
+ for x=64 the last "safe" a0 address is "t0-96" In the current version we
+ will use "prefetch hint,128(a0)", so "t0-160" is the limit. */
+#if defined(USE_PREFETCH) \
+ && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ PTR_ADDU t0,a0,a2 /* t0 is the "past the end" address */
+ PTR_SUBU t9,t0,PREFETCH_LIMIT /* t9 is the "last safe pref" address */
+#endif
+#if defined(USE_PREFETCH) \
+ && (PREFETCH_STORE_HINT != PREFETCH_HINT_PREPAREFORSTORE)
+ PREFETCH_FOR_STORE (1, a0)
+ PREFETCH_FOR_STORE (2, a0)
+ PREFETCH_FOR_STORE (3, a0)
+#endif
+
+L(loop16w):
+#if defined(USE_PREFETCH) \
+ && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ sltu v1,t9,a0 /* If a0 > t9 don't use next prefetch */
+ bgtz v1,L(skip_pref)
+ nop
+#endif
+ PREFETCH_FOR_STORE (4, a0)
+ PREFETCH_FOR_STORE (5, a0)
+L(skip_pref):
+ C_ST a1,UNIT(0)(a0)
+ C_ST a1,UNIT(1)(a0)
+ C_ST a1,UNIT(2)(a0)
+ C_ST a1,UNIT(3)(a0)
+ C_ST a1,UNIT(4)(a0)
+ C_ST a1,UNIT(5)(a0)
+ C_ST a1,UNIT(6)(a0)
+ C_ST a1,UNIT(7)(a0)
+ C_ST a1,UNIT(8)(a0)
+ C_ST a1,UNIT(9)(a0)
+ C_ST a1,UNIT(10)(a0)
+ C_ST a1,UNIT(11)(a0)
+ C_ST a1,UNIT(12)(a0)
+ C_ST a1,UNIT(13)(a0)
+ C_ST a1,UNIT(14)(a0)
+ C_ST a1,UNIT(15)(a0)
+ PTR_ADDIU a0,a0,UNIT(16) /* adding 64/128 to dest */
+ bne a0,a3,L(loop16w)
+ nop
+ move a2,t8
+
+/* Here we have dest word-aligned but less than 64-bytes or 128 bytes to go.
+ Check for a 32(64) byte chunk and copy if if there is one. Otherwise
+ jump down to L(chk1w) to handle the tail end of the copy. */
L(chkw):
- andi t0, a2, 0x7 # Enough left for one loop iteration?
- beq t0, a2, L(chkl)
- subu a3, a2, t0
- addu a3, a0 # a3 is last loop address +1
- move a2, t0 # a2 is now # of bytes left after loop
-L(loopw):
- addiu a0, 8 # Handle 2 words pr. iteration
- sw a1, -8(a0)
- bne a0, a3, L(loopw)
- sw a1, -4(a0)
-
-L(chkl):
- andi t0, a2, 0x4 # Check if there is at least a full
- beq t0, zero, L(last8) # word remaining after the loop
- subu a2, t0
- sw a1, 0(a0) # Yes...
- addiu a0, 4
-
-L(last8):
- blez a2, L(exit) # Handle last 8 bytes (if cnt>0)
- addu a3, a2, a0 # a3 is last address +1
-L(lst8l):
- addiu a0, 1
- bne a0, a3, L(lst8l)
- sb a1, -1(a0)
-L(exit):
- j ra # Bye, bye
- nop
-
+ andi t8,a2,NSIZEMASK /* is there a 32-byte/64-byte chunk. */
+ /* the t8 is the reminder count past 32-bytes */
+ beq a2,t8,L(chk1w)/* when a2==t8, no 32-byte chunk */
+ nop
+ C_ST a1,UNIT(0)(a0)
+ C_ST a1,UNIT(1)(a0)
+ C_ST a1,UNIT(2)(a0)
+ C_ST a1,UNIT(3)(a0)
+ C_ST a1,UNIT(4)(a0)
+ C_ST a1,UNIT(5)(a0)
+ C_ST a1,UNIT(6)(a0)
+ C_ST a1,UNIT(7)(a0)
+ PTR_ADDIU a0,a0,UNIT(8)
+
+/* Here we have less than 32(64) bytes to set. Set up for a loop to
+ copy one word (or double word) at a time. Set a2 to count how many
+ bytes we have to copy after all the word (or double word) chunks are
+ copied and a3 to the dest pointer after all the (d)word chunks have
+ been copied. We will loop, incrementing a0 until a0 equals a3. */
+L(chk1w):
+ andi a2,t8,(NSIZE-1) /* a2 is the reminder past one (d)word chunks */
+ beq a2,t8,L(lastb)
+ PTR_SUBU a3,t8,a2 /* a3 is count of bytes in one (d)word chunks */
+ PTR_ADDU a3,a0,a3 /* a3 is the dst address after loop */
+
+/* copying in words (4-byte or 8 byte chunks) */
+L(wordCopy_loop):
+ PTR_ADDIU a0,a0,UNIT(1)
+ bne a0,a3,L(wordCopy_loop)
+ C_ST a1,UNIT(-1)(a0)
+
+/* Copy the last 8 (or 16) bytes */
+L(lastb):
+ blez a2,L(leave)
+ PTR_ADDU a3,a0,a2 /* a3 is the last dst address */
+L(lastbloop):
+ PTR_ADDIU a0,a0,1
+ bne a0,a3,L(lastbloop)
+ sb a1,-1(a0)
+L(leave):
+ j ra
+ nop
+
+ .set at
.set reorder
-END (memset)
-libc_hidden_builtin_def (memset)
+END(MEMSET_NAME)
+#ifndef ANDROID_CHANGES
+# ifdef _LIBC
+libc_hidden_builtin_def (MEMSET_NAME)
+# endif
+#endif
Removed: fsf/trunk/libc/ports/sysdeps/mips/mips64/memset.S
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/mips64/memset.S (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/mips64/memset.S (removed)
@@ -1,90 +1,0 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Hartvig Ekner <hartvige@xxxxxxxx>, 2002.
- Ported to mips3 n32/n64 by Alexandre Oliva <aoliva@xxxxxxxxxx>
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-
-/* void *memset(void *s, int c, size_t n);
-
- This could probably be optimized further. */
-
-#if __MIPSEB
-# define SDHI sdl /* high part is left in big-endian */
-#else
-# define SDHI sdr /* high part is right in little-endian */
-#endif
-
-ENTRY (memset)
- .set noreorder
-
- slti ta1, a2, 16 # Less than 16?
- bne ta1, zero, L(last16)
- move v0, a0 # Setup exit value before too late
-
- beq a1, zero, L(ueven) # If zero pattern, no need to extend
- andi a1, 0xff # Avoid problems with bogus arguments
- dsll ta0, a1, 8
- or a1, ta0
- dsll ta0, a1, 16
- or a1, ta0 # a1 is now pattern in full word
- dsll ta0, a1, 32
- or a1, ta0 # a1 is now pattern in double word
-
-L(ueven):
- PTR_SUBU ta0, zero, a0 # Unaligned address?
- andi ta0, 0x7
- beq ta0, zero, L(chkw)
- PTR_SUBU a2, ta0
- SDHI a1, 0(a0) # Yes, handle first unaligned part
- PTR_ADDU a0, ta0 # Now both a0 and a2 are updated
-
-L(chkw):
- andi ta0, a2, 0xf # Enough left for one loop iteration?
- beq ta0, a2, L(chkl)
- PTR_SUBU a3, a2, ta0
- PTR_ADDU a3, a0 # a3 is last loop address +1
- move a2, ta0 # a2 is now # of bytes left after loop
-L(loopw):
- PTR_ADDIU a0, 16 # Handle 2 dwords pr. iteration
- sd a1, -16(a0)
- bne a0, a3, L(loopw)
- sd a1, -8(a0)
-
-L(chkl):
- andi ta0, a2, 0x8 # Check if there is at least a double
- beq ta0, zero, L(last16) # word remaining after the loop
- PTR_SUBU a2, ta0
- sd a1, 0(a0) # Yes...
- PTR_ADDIU a0, 8
-
-L(last16):
- blez a2, L(exit) # Handle last 16 bytes (if cnt>0)
- PTR_ADDU a3, a2, a0 # a3 is last address +1
-L(lst16l):
- PTR_ADDIU a0, 1
- bne a0, a3, L(lst16l)
- sb a1, -1(a0)
-L(exit):
- j ra # Bye, bye
- nop
-
- .set reorder
-END (memset)
-libc_hidden_builtin_def (memset)
Modified: fsf/trunk/libc/ports/sysdeps/tile/ffs.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/tile/ffs.c (original)
+++ fsf/trunk/libc/ports/sysdeps/tile/ffs.c Sat Sep 21 00:02:02 2013
@@ -27,6 +27,7 @@
return __builtin_ffs (x);
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#undef ffsll
Modified: fsf/trunk/libc/string/ffs.c
==============================================================================
--- fsf/trunk/libc/string/ffs.c (original)
+++ fsf/trunk/libc/string/ffs.c Sat Sep 21 00:02:02 2013
@@ -46,6 +46,7 @@
return table[x >> a] + a;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#if ULONG_MAX == UINT_MAX
Modified: fsf/trunk/libc/sysdeps/i386/ffs.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/ffs.c (original)
+++ fsf/trunk/libc/sysdeps/i386/ffs.c Sat Sep 21 00:02:02 2013
@@ -41,6 +41,7 @@
return cnt;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#undef ffsl
weak_alias (__ffs, ffsl)
Modified: fsf/trunk/libc/sysdeps/i386/i686/ffs.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/ffs.c (original)
+++ fsf/trunk/libc/sysdeps/i386/i686/ffs.c Sat Sep 21 00:02:02 2013
@@ -39,6 +39,7 @@
return cnt + 1;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#undef ffsl
weak_alias (__ffs, ffsl)
Modified: fsf/trunk/libc/sysdeps/powerpc/ffs.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/ffs.c (original)
+++ fsf/trunk/libc/sysdeps/powerpc/ffs.c Sat Sep 21 00:02:02 2013
@@ -35,6 +35,7 @@
return 32 - cnt;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#if ULONG_MAX == UINT_MAX
#undef ffsl
Modified: fsf/trunk/libc/sysdeps/s390/ffs.c
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/ffs.c (original)
+++ fsf/trunk/libc/sysdeps/s390/ffs.c Sat Sep 21 00:02:02 2013
@@ -63,6 +63,7 @@
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
#if ULONG_MAX == UINT_MAX
#undef ffsl
Modified: fsf/trunk/libc/sysdeps/x86_64/ffs.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/ffs.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/ffs.c Sat Sep 21 00:02:02 2013
@@ -35,4 +35,5 @@
return cnt + 1;
}
weak_alias (__ffs, ffs)
+libc_hidden_def (__ffs)
libc_hidden_builtin_def (ffs)
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits