Changeset 8fe650 in git for omalloc


Ignore:
Timestamp:
May 2, 2006, 1:39:03 PM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
fc11f4583f0780c252a03d9b7079efbb0029dbce
Parents:
c551fdc7a02e90492400d97decfdc027e6af25a9
Message:
*hannes: 64bit port, part 1


git-svn-id: file:///usr/local/Singular/svn/trunk@9082 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
omalloc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • omalloc/omAllocDecl.h

    rc551fdc r8fe650  
    44 *  Author:  obachman (Olaf Bachmann)
    55 *  Created: 11/99
    6  *  Version: $Id: omAllocDecl.h,v 1.8 2001-04-30 09:02:00 Singular Exp $
     6 *  Version: $Id: omAllocDecl.h,v 1.9 2006-05-02 11:38:43 Singular Exp $
    77 *******************************************************************/
    88#ifndef OM_ALLOC_DECL_H
    99#define OM_ALLOC_DECL_H
     10
     11#ifdef OM_NDEBUG
     12#if (SIZEOF_LONG == 8)
     13#define OM_T_FREE1
     14#define OM_T_FREE3
     15#define OM_T_STR
     16#define OM_T_ALLOC
     17#define OM_T_REALLOC
     18#endif
     19#endif
    1020
    1121
     
    1929#endif
    2030
    21 #if !defined(OM_EMULATE_OMALLOC) && !defined(OM_NDEBUG) && (defined(OM_CHECK) || (defined(OM_HAVE_TRACK) && defined(OM_TRACK)))
     31#if (!defined(OM_EMULATE_OMALLOC) && !defined(OM_NDEBUG) && (defined(OM_CHECK) || (defined(OM_HAVE_TRACK) && defined(OM_TRACK)))) || defined(OM_T1)
    2232
    2333/*******************************************************************
     
    3949#endif
    4050
     51#if !defined(OM_T_ALLOC)
    4152#define omTypeAllocBin(type,addr,bin)           addr=(type)_omDebugAlloc(bin,OM_FBIN|_OM_FKEEP,OM_CTFL)
    4253#define omTypeAlloc0Bin(type,addr,bin)          addr=(type)_omDebugAlloc(bin,OM_FBIN|OM_FZERO|_OM_FKEEP,OM_CTFL)
     
    4960#define omAlloc0(size)                          _omDebugAlloc((void*)(size),OM_FSIZE|OM_FZERO|_OM_FKEEP,OM_CTFL)
    5061
     62#define omalloc(size)   _omDebugAlloc((void*)(size),OM_FSIZE|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
     63#define omalloc0(size)  _omDebugAlloc((void*)(size),OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
     64#define omcalloc(n,size)_omDebugAlloc((void*) ((size)*n),OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
     65
     66#else
     67#define omTypeAllocBin(type,addr,bin)           __omTypeAllocBin(type,addr,bin)
     68#define omTypeAlloc0Bin(type,addr,bin)          __omTypeAlloc0Bin(type,addr,bin)
     69#define omAllocBin(bin)                         _omAllocBin(bin)
     70#define omAlloc0Bin(bin)                        _omAlloc0Bin(bin)
     71
     72#define omTypeAlloc(type,addr,size)             __omTypeAlloc(type,addr,size)
     73#define omTypeAlloc0(type,addr,size)            __omTypeAlloc0(type,addr,size)
     74#define omAlloc(size)                           _omAlloc(size)
     75#define omAlloc0(size)                          _omAlloc0(size)
     76
     77#define omalloc(size)   _omalloc(size)
     78#define omalloc0(size)  _omalloc0(size)
     79#define omcalloc(n,size)_omalloc0(n*size)
     80
     81#endif
     82
     83#if !defined(OM_T_REALLOC)
    5184#define omTypeReallocBin(o_addr,o_bin,type,addr,bin)            addr=(type)_omDebugRealloc(o_addr,o_bin,bin,OM_FBIN|_OM_FKEEP,OM_FBIN|_OM_FKEEP,OM_CTFL)
    5285#define omTypeRealloc0Bin(o_addr,o_bin,type,addr,bin)           addr=(type)_omDebugRealloc(o_addr,o_bin,bin,OM_FBIN|_OM_FKEEP,OM_FBIN|OM_FZERO|_OM_FKEEP,OM_CTFL)
     
    6497#define omRealloc0(addr,size)                                   _omDebugRealloc(addr,NULL,(void*)(size),_OM_FKEEP,OM_FSIZE|OM_FZERO,OM_CTFL)
    6598
    66 #define omFreeBinAddr(addr)     _omDebugFree(addr,NULL,OM_FBINADDR|_OM_FKEEP,OM_CFL)
    67 #define omFreeBin(addr,bin)     _omDebugFree(addr,bin,OM_FBIN|_OM_FKEEP,OM_CFL)
    68 #define omFreeSize(addr,size)   _omDebugFree(addr,(void*)(size),OM_FSIZE|_OM_FKEEP,OM_CFL)
    69 #define omFree(addr)            _omDebugFree(addr,0,0,OM_CFL)
    70 
    71 
    72 #define omalloc(size)   _omDebugAlloc((void*)(size),OM_FSIZE|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
    73 #define omalloc0(size)  _omDebugAlloc((void*)(size),OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
    74 #define omcalloc(n,size)_omDebugAlloc((void*) ((size)*n),OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
    75 
    7699#define omreallocSize(addr,o_size,size) _omDebugRealloc(addr,(void*)(o_size),(void*)(size),OM_FSIZE|OM_FSLOPPY|_OM_FKEEP,OM_FSIZE|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
    77100#define omrealloc0Size(addr,o_size,size)_omDebugRealloc(addr,(void*)(o_size),(void*)(size),OM_FSIZE|OM_FSLOPPY|_OM_FKEEP,OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
     
    79102#define omrealloc0(addr,size)           _omDebugRealloc(addr,NULL,(void*)(size),OM_FSLOPPY|_OM_FKEEP,OM_FSIZE|OM_FZERO|OM_FSLOPPY|OM_FALIGN|_OM_FKEEP,OM_CTFL)
    80103
     104#else
     105#define omTypeReallocBin(o_addr,o_bin,type,addr,bin)            __omTypeReallocBin(o_addr,o_bin,type,addr,bin)
     106#define omTypeRealloc0Bin(o_addr,o_bin,type,addr,bin)           __omTypeRealloc0Bin(o_addr,o_bin,type,addr,bin)
     107#define omReallocBin(o_addr,o_bin,bin)                          _omReallocBin(o_addr,o_bin,bin)
     108#define omRealloc0Bin(o_addr,o_bin,bin)                         _omRealloc0Bin(o_addr,o_bin,bin)
     109
     110#define omTypeReallocSize(o_addr,o_size,type,addr,size)         __omTypeReallocSize(o_addr,o_size,type,addr,size)
     111#define omTypeRealloc0Size(o_addr,o_size,type,addr,size)        __omTypeRealloc0Size(o_addr,o_size,type,addr,size)
     112#define omReallocSize(addr,o_size,size)                         _omReallocSize(addr,o_size,size)
     113#define omRealloc0Size(addr,o_size,size)                        _omRealloc0Size(addr,o_size,size)
     114
     115#define omTypeRealloc(o_addr,type,addr,size)                    __omTypeRealloc(o_addr,type,addr,size)
     116#define omTypeRealloc0(o_addr,type,addr,size)                   __omTypeRealloc0(o_addr,type,addr,size)
     117#define omRealloc(addr,size)                                    _omRealloc(addr,size)
     118#define omRealloc0(addr,size)                                   _omRealloc0(addr,size)
     119
     120#define omreallocSize(addr,o_size,size) _omreallocSize(addr,o_size,size)
     121#define omrealloc0Size(addr,o_size,size)_omrealloc0Size(addr,o_size,size)
     122#define omrealloc(addr,size)            _omrealloc(addr, size)
     123#define omrealloc0(addr,size)           _omrealloc0(addr, size)
     124
     125#endif
     126
     127#if !defined(OM_T_FREE1)
     128#define omFreeBinAddr(addr)     _omDebugFree(addr,NULL,OM_FBINADDR|_OM_FKEEP,OM_CFL)
     129#define omFreeBin(addr,bin)     _omDebugFree(addr,bin,OM_FBIN|_OM_FKEEP,OM_CFL)
     130#else
     131#define omFreeBinAddr(addr)     __omFreeBinAddr(addr)
     132#define omFreeBin(addr,bin)     __omFreeBinAddr(addr)
     133#endif
     134
     135#if !defined(OM_T_FREE2)
     136#define omFreeSize(addr,size)   _omDebugFree(addr,(void*)(size),OM_FSIZE|_OM_FKEEP,OM_CFL)
    81137#define omfreeSize(addr,size)   _omDebugFree(addr,(void*)(size),OM_FSIZE|OM_FSLOPPY|_OM_FKEEP,OM_CFL)
     138#else
     139#define omFreeSize(addr,size)   __omFreeSize(addr,size)
     140#define omfreeSize(addr,size)   do {if (addr && size) omFreeSize(addr, size);} while (0)
     141#endif
     142
     143#if !defined(OM_T_FREE3)
     144#define omFree(addr)            _omDebugFree(addr,0,0,OM_CFL)
    82145#define omfree(addr)            _omDebugFree(addr,NULL,OM_FSLOPPY|_OM_FKEEP,OM_CFL)
    83 
     146#else
     147#define omFree(addr)            __omFree(addr)
     148#define omfree(addr)            do {if (addr) omFree(addr);} while (0)
     149#endif
     150
     151#if !defined(OM_T_STR)
    84152#define omStrDup(s)                             _omDebugStrDup(s,OM_TFL)
    85153#define omMemDup(addr)                          _omDebugMemDup(addr,_OM_FKEEP,OM_CTFL)
     154#else
     155#define omStrDup(s)         _omStrDup(s)
     156#define omMemDup(s)         _omMemDup(s)
     157#endif
    86158
    87159#define omDebugBinAddr(addr)                 _omDebugAddr(addr,NULL,OM_FBINADDR,OM_CFL)
  • omalloc/omAllocPrivate.h

    rc551fdc r8fe650  
    55 *  Author:  obachman (Olaf Bachmann)
    66 *  Created: 11/99
    7  *  Version: $Id: omAllocPrivate.h,v 1.7 2003-06-20 16:40:58 Singular Exp $
     7 *  Version: $Id: omAllocPrivate.h,v 1.8 2006-05-02 11:39:02 Singular Exp $
    88 *******************************************************************/
    99#ifndef OM_ALLOC_PRIVATE_H
     
    123123do                                              \
    124124{                                               \
    125   if ((page)->used_blocks > 0)                  \
     125  if ((page)->used_blocks > 0L)                 \
    126126  {                                             \
    127127    *((void**) (addr)) = (page)->current;       \
     
    283283do                                                          \
    284284{                                                           \
    285   if (size <= OM_MAX_BLOCK_SIZE || omIsBinPageAddr(addr))  \
     285  if ((size <= OM_MAX_BLOCK_SIZE) || omIsBinPageAddr(addr)) \
    286286  {                                                         \
    287     __omFreeBinAddr(addr);                                     \
     287    __omFreeBinAddr(addr);                                  \
    288288  }                                                         \
    289289  else                                                      \
  • omalloc/om_Alloc.c

    rc551fdc r8fe650  
    44 *  Author:  obachman@mathematik.uni-kl.de (Olaf Bachmann)
    55 *  Created: 11/99
    6  *  Version: $Id: om_Alloc.c,v 1.2 2001-04-30 09:02:12 Singular Exp $
     6 *  Version: $Id: om_Alloc.c,v 1.3 2006-05-02 11:39:03 Singular Exp $
    77 *******************************************************************/
    88#ifndef OM_ALLOC_C
     
    167167{
    168168  omBin bin;
    169   omAssume(page->used_blocks <= 0);
     169  omAssume(page->used_blocks <= 0L);
    170170
    171171#ifdef OM_HAVE_TRACK
    172   if (page->used_blocks < 0)
     172  if (page->used_blocks < 0L)
    173173  {
    174174    omFreeTrackAddr(addr);
     
    178178
    179179  bin = omGetBinOfPage(page);
    180   if (page->current != NULL || bin->max_blocks <= 1)
     180  if ((page->current != NULL) || (bin->max_blocks <= 1))
    181181  {
    182182    // all blocks of page are now collected
Note: See TracChangeset for help on using the changeset viewer.