if (parent_ldt == NULL) {
/* Allocate a new zeroed-out one. */
- ldt = (VgLdtEntry*)VG_(arena_calloc)(VG_AR_CORE, VG_MIN_MALLOC_SZB,
- nbytes, 1);
+ ldt = (VgLdtEntry*)VG_(arena_calloc)(VG_AR_CORE, nbytes, 1);
} else {
ldt = (VgLdtEntry*)VG_(arena_malloc)(VG_AR_CORE, nbytes);
for (i = 0; i < VG_M_LDT_ENTRIES; i++)
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, SizeT alignment,
+extern void* VG_(arena_calloc) ( ArenaId arena,
SizeT nmemb, SizeT bytes_per_memb );
-extern void* VG_(arena_realloc) ( ArenaId arena, void* ptr, SizeT alignment,
- SizeT size );
+extern void* VG_(arena_realloc) ( ArenaId arena, void* ptr, SizeT size );
extern void* VG_(arena_malloc_aligned) ( ArenaId aid, SizeT req_alignB,
SizeT req_pszB );
#define malloc(s) VG_(arena_malloc) (VG_AR_DEMANGLE, s)
#define free(p) VG_(arena_free) (VG_AR_DEMANGLE, p)
-#define realloc(p,s) VG_(arena_realloc)(VG_AR_DEMANGLE, p, VG_MIN_MALLOC_SZB, s)
+#define realloc(p,s) VG_(arena_realloc)(VG_AR_DEMANGLE, p, s)
#endif
/* If CP_DEMANGLE_DEBUG is defined, a trace of the grammar evaluation,
#define xstrdup(ptr) VG_(arena_strdup) (VG_AR_DEMANGLE, ptr)
#define free(ptr) VG_(arena_free) (VG_AR_DEMANGLE, ptr)
#define xmalloc(size) VG_(arena_malloc) (VG_AR_DEMANGLE, size)
-#define xrealloc(ptr, size) VG_(arena_realloc)(VG_AR_DEMANGLE, ptr, \
- VG_MIN_MALLOC_SZB, size)
+#define xrealloc(ptr, size) VG_(arena_realloc)(VG_AR_DEMANGLE, ptr, size)
#define abort() vg_assert(0)
#undef strstr
#ifndef STANDALONE
#define malloc(s) VG_(arena_malloc) (VG_AR_DEMANGLE, s)
#define free(p) VG_(arena_free) (VG_AR_DEMANGLE, p)
-#define realloc(p,s) VG_(arena_realloc)(VG_AR_DEMANGLE, p, VG_MIN_MALLOC_SZB, s)
+#define realloc(p,s) VG_(arena_realloc)(VG_AR_DEMANGLE, p, s)
#endif
/* If this file is being compiled for inclusion in the C++ runtime
*fnames = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof (UInt) * 2);
else
*fnames = VG_(arena_realloc)(
- VG_AR_SYMTAB, *fnames, VG_MIN_MALLOC_SZB,
- sizeof(UInt)
- * (state_machine_regs.last_file_entry + 1));
+ VG_AR_SYMTAB, *fnames,
+ sizeof(UInt) * (state_machine_regs.last_file_entry + 1));
(*fnames)[state_machine_regs.last_file_entry] = VG_(addStr) (si,name, -1);
data += VG_(strlen) ((char *) data) + 1;
read_leb128 (data, & bytes_read, 0);
fnames = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof (UInt) * 2);
else
fnames = VG_(arena_realloc)(VG_AR_SYMTAB, fnames,
- VG_MIN_MALLOC_SZB,
sizeof(UInt)
* (state_machine_regs.last_file_entry + 1));
data += VG_(strlen) ((Char *) data) + 1;
/*--- Services layered on top of malloc/free. ---*/
/*------------------------------------------------------------*/
-void* VG_(arena_calloc) ( ArenaId aid, SizeT alignB, SizeT nmemb,
- SizeT bytes_per_memb )
+void* VG_(arena_calloc) ( ArenaId aid, SizeT nmemb, SizeT bytes_per_memb )
{
SizeT size;
UChar* p;
size = nmemb * bytes_per_memb;
vg_assert(size >= nmemb && size >= bytes_per_memb);// check against overflow
- if (alignB == VG_MIN_MALLOC_SZB)
- p = VG_(arena_malloc) ( aid, size );
- else
- p = VG_(arena_malloc_aligned) ( aid, alignB, size );
+ p = VG_(arena_malloc) ( aid, size );
VG_(memset)(p, 0, size);
}
-void* VG_(arena_realloc) ( ArenaId aid, void* ptr,
- SizeT req_alignB, SizeT req_pszB )
+void* VG_(arena_realloc) ( ArenaId aid, void* ptr, SizeT req_pszB )
{
Arena* a;
SizeT old_bszB, old_pszB;
return ptr;
}
- if (req_alignB == VG_MIN_MALLOC_SZB)
- p_new = VG_(arena_malloc) ( aid, req_pszB );
- else {
- p_new = VG_(arena_malloc_aligned) ( aid, req_alignB, req_pszB );
- }
-
+ p_new = VG_(arena_malloc) ( aid, req_pszB );
+
VG_(memcpy)(p_new, ptr, old_pszB);
VG_(arena_free)(aid, ptr);
void* VG_(calloc) ( SizeT nmemb, SizeT bytes_per_memb )
{
- return VG_(arena_calloc) ( VG_AR_TOOL, VG_MIN_MALLOC_SZB, nmemb,
- bytes_per_memb );
+ return VG_(arena_calloc) ( VG_AR_TOOL, nmemb, bytes_per_memb );
}
void* VG_(realloc) ( void* ptr, SizeT size )
{
- return VG_(arena_realloc) ( VG_AR_TOOL, ptr, VG_MIN_MALLOC_SZB, size );
+ return VG_(arena_realloc) ( VG_AR_TOOL, ptr, size );
}
void* VG_(malloc_aligned) ( SizeT req_alignB, SizeT req_pszB )
VexGuestX86SegDescr* VG_(alloc_zeroed_x86_GDT) ( void )
{
- Int nbytes
- = VEX_GUEST_X86_GDT_NENT * sizeof(VexGuestX86SegDescr);
- return
- VG_(arena_calloc)(VG_AR_CORE, VG_MIN_MALLOC_SZB, nbytes, 1);
+ Int nbytes = VEX_GUEST_X86_GDT_NENT * sizeof(VexGuestX86SegDescr);
+ return VG_(arena_calloc)(VG_AR_CORE, nbytes, 1);
}
/* Create a zeroed-out LDT. */
VexGuestX86SegDescr* VG_(alloc_zeroed_x86_LDT) ( void )
{
- Int nbytes
- = VEX_GUEST_X86_LDT_NENT * sizeof(VexGuestX86SegDescr);
- return
- VG_(arena_calloc)(VG_AR_CORE, VG_MIN_MALLOC_SZB, nbytes, 1);
+ Int nbytes = VEX_GUEST_X86_LDT_NENT * sizeof(VexGuestX86SegDescr);
+ return VG_(arena_calloc)(VG_AR_CORE, nbytes, 1);
}
/* Free up an LDT or GDT allocated by the above fns. */