|
From: <sv...@va...> - 2005-04-05 21:00:02
|
Author: sewardj
Date: 2005-04-05 21:59:55 +0100 (Tue, 05 Apr 2005)
New Revision: 3522
Modified:
trunk/coregrind/core.h
trunk/coregrind/vg_malloc2.c
trunk/coregrind/vg_replace_malloc.c
trunk/coregrind/vg_scheduler.c
trunk/docs/xml/manual-core.xml
trunk/include/tool.h.base
Log:
Get rid of the --sloppy-malloc=3D flag and the functionality it
controlled (rounding user malloc requests up to a multiple of 4).
Subsequent changes to memcheck made it more or less pointless, it is a
time waster in the malloc/free path, and nobody ever used it AFAIK.
Modified: trunk/coregrind/core.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/core.h 2005-04-05 18:36:05 UTC (rev 3521)
+++ trunk/coregrind/core.h 2005-04-05 20:59:55 UTC (rev 3522)
@@ -385,9 +385,6 @@
// greater than 8.
#define VG_MIN_MALLOC_SZB 8
=20
-// Round-up size for --sloppy-malloc=3Dyes.
-#define VG_SLOPPY_MALLOC_SZB 4
-
extern void* VG_(arena_malloc) ( ArenaId arena, SizeT nbytes );
extern void VG_(arena_free) ( ArenaId arena, void* ptr );
extern void* VG_(arena_calloc) ( ArenaId arena,=20
@@ -500,7 +497,6 @@
=20
SizeT (*arena_payload_szB) (ArenaId aid, void* payload);
=20
- Bool clo_sloppy_malloc;
Bool clo_trace_malloc;
};
=20
Modified: trunk/coregrind/vg_malloc2.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_malloc2.c 2005-04-05 18:36:05 UTC (rev 3521)
+++ trunk/coregrind/vg_malloc2.c 2005-04-05 20:59:55 UTC (rev 3522)
@@ -518,13 +518,9 @@
/*--- Command line options ---*/
/*------------------------------------------------------------*/
=20
-/* Round malloc sizes up to a multiple of VG_SLOPPY_MALLOC_SZB bytes?
- default: NO
- Nb: the allocator always rounds blocks up to a multiple of
- VG_MIN_MALLOC_SZB. VG_(clo_sloppy_malloc) is relevant eg. for
- Memcheck, which will be byte-precise with addressability maps on its
- malloc allocations unless --sloppy-malloc=3Dyes. */
-Bool VG_(clo_sloppy_malloc) =3D False;
+/* Nb: the allocator always rounds blocks up to a multiple of
+ VG_MIN_MALLOC_SZB.
+*/
=20
/* DEBUG: print malloc details? default: NO */
Bool VG_(clo_trace_malloc) =3D False;
@@ -550,7 +546,6 @@
}
}
=20
- else VG_BOOL_CLO(arg, "--sloppy-malloc", VG_(clo_sloppy_malloc))
else VG_BOOL_CLO(arg, "--trace-malloc", VG_(clo_trace_malloc))
else=20
return False;
@@ -561,9 +556,8 @@
void VG_(replacement_malloc_print_usage)(void)
{
VG_(printf)(
-" --sloppy-malloc=3Dno|yes round malloc sizes to multiple of %d? [=
no]\n"
" --alignment=3D<number> set minimum alignment of allocations [%=
d]\n",
- VG_SLOPPY_MALLOC_SZB, VG_MIN_MALLOC_SZB
+ VG_MIN_MALLOC_SZB
);
}
=20
Modified: trunk/coregrind/vg_replace_malloc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_replace_malloc.c 2005-04-05 18:36:05 UTC (rev 3521=
)
+++ trunk/coregrind/vg_replace_malloc.c 2005-04-05 20:59:55 UTC (rev 3522=
)
@@ -153,12 +153,6 @@
if (info.clo_trace_malloc) \
internal_printf(format, ## args )
=20
-#define MAYBE_SLOPPIFY(n) \
- if (info.clo_sloppy_malloc) { \
- n =3D (n+(VG_SLOPPY_MALLOC_SZB-1)) & ~(VG_SLOPPY_MALLOC_SZB-1); \
- }
-
-
/* Below are new versions of malloc, __builtin_new, free,=20
__builtin_delete, calloc, realloc, memalign, and friends.
=20
@@ -180,7 +174,6 @@
void* v; \
\
MALLOC_TRACE(#fnname "(%llu)", (ULong)n ); \
- MAYBE_SLOPPIFY(n); \
if (!init_done) init(); \
\
v =3D (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n =
); \
@@ -201,7 +194,6 @@
void* v; \
\
MALLOC_TRACE(#fnname "(%llu)", (ULong)n ); \
- MAYBE_SLOPPIFY(n); \
if (!init_done) init(); \
\
v =3D (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n =
); \
@@ -305,7 +297,6 @@
void* v; \
\
MALLOC_TRACE("calloc(%llu,%llu)", (ULong)nmemb, (ULong)size ); \
- MAYBE_SLOPPIFY(size); \
\
if (!init_done) init(); \
v =3D (void*)VALGRIND_NON_SIMD_CALL2( info.tl_calloc, nmemb, size =
); \
@@ -324,7 +315,6 @@
void* v; \
\
MALLOC_TRACE("realloc(%p,%llu)", ptrV, (ULong)new_size ); \
- MAYBE_SLOPPIFY(new_size); \
\
if (ptrV =3D=3D NULL) \
/* We need to call a malloc-like function; so let's use \
@@ -354,7 +344,6 @@
\
MALLOC_TRACE("memalign(al %llu, size %llu)", \
(ULong)alignment, (ULong)n ); \
- MAYBE_SLOPPIFY(n); \
\
/* Round up to minimum alignment if necessary. */ \
if (alignment < VG_MIN_MALLOC_SZB) \
Modified: trunk/coregrind/vg_scheduler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_scheduler.c 2005-04-05 18:36:05 UTC (rev 3521)
+++ trunk/coregrind/vg_scheduler.c 2005-04-05 20:59:55 UTC (rev 3522)
@@ -1026,8 +1026,6 @@
info->tl___builtin_vec_delete =3D VG_(tdict).malloc___builtin_vec_dele=
te;
=20
info->arena_payload_szB =3D VG_(arena_payload_szB);
- =20
- info->clo_sloppy_malloc =3D VG_(clo_sloppy_malloc);
info->clo_trace_malloc =3D VG_(clo_trace_malloc);
=20
SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless =
*/
Modified: trunk/docs/xml/manual-core.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/docs/xml/manual-core.xml 2005-04-05 18:36:05 UTC (rev 3521)
+++ trunk/docs/xml/manual-core.xml 2005-04-05 20:59:55 UTC (rev 3522)
@@ -907,29 +907,6 @@
and 4096 inclusive, and must be a power of two.</para>
</listitem>
=20
- <listitem>
- <para><computeroutput>--sloppy-malloc=3Dno</computeroutput>
- [default]</para>
- <para><computeroutput>--sloppy-malloc=3Dyes</computeroutput></para>
- <para>When enabled, all requests for malloc/calloc are
- rounded up to a whole number of machine words -- in other
- words, made divisible by 4. For example, a request for 17
- bytes of space would result in a 20-byte area being made
- available. This works around bugs in sloppy libraries which
- assume that they can safely rely on malloc/calloc requests
- being rounded up in this fashion. Without the workaround,
- these libraries tend to generate large numbers of errors when
- they access the ends of these areas.</para>
-
- <para>Valgrind snapshots dated 17 Feb 2002 and later are
- cleverer about this problem, and you should no longer need to
- use this flag. To put it bluntly, if you do need to use this
- flag, your program violates the ANSI C semantics defined for
- <computeroutput>malloc</computeroutput> and
- <computeroutput>free</computeroutput>, even if it appears to
- work correctly, and you should fix it, at least if you hope
- for maximum portability.</para>
- </listitem>
</itemizedlist>
=20
</sect2>
Modified: trunk/include/tool.h.base
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/tool.h.base 2005-04-05 18:36:05 UTC (rev 3521)
+++ trunk/include/tool.h.base 2005-04-05 20:59:55 UTC (rev 3522)
@@ -920,8 +920,6 @@
The tool should call the functions in the appropriate places to give
control over these aspects of Valgrind's version of malloc(). */
=20
-/* Round malloc sizes upwards to integral number of words? default: NO *=
/
-extern Bool VG_(clo_sloppy_malloc);
/* DEBUG: print malloc details? default: NO */
extern Bool VG_(clo_trace_malloc);
/* Minimum alignment in functions that don't specify alignment explicitl=
y.
|