VirtualBox

Changeset 11020 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jul 30, 2008 10:48:35 PM (16 years ago)
Author:
vboxsync
Message:

iprt: Added a RT_NO_THROW macro for wrapping up the throw() stuff, applying it to mem.h and rand.h to try make RTMemAutoPtr work as efficiently as the pure C version of the stuff.

Location:
trunk/src/VBox/Runtime/r3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/freebsd/alloc-freebsd.cpp

    r8245 r11020  
    5151 * @param   cb      Size in bytes of the memory block to allocate.
    5252 */
    53 RTDECL(void *) RTMemExecAlloc(size_t cb)
     53RTDECL(void *) RTMemExecAlloc(size_t cb) RT_NO_THROW
    5454{
    5555    /*
     
    8282 * @param   pv      Pointer to memory block.
    8383 */
    84 RTDECL(void)    RTMemExecFree(void *pv)
     84RTDECL(void)    RTMemExecFree(void *pv) RT_NO_THROW
    8585{
    8686    return RTMemPageFree(pv);
     
    9595 * @param   cb  Size of the memory block. Will be rounded up to page size.
    9696 */
    97 RTDECL(void *) RTMemPageAlloc(size_t cb)
     97RTDECL(void *) RTMemPageAlloc(size_t cb) RT_NO_THROW
    9898{
    9999    cb = RT_ALIGN_Z(cb, PAGE_SIZE);
     
    113113 * @param   cb  Size of the memory block. Will be rounded up to page size.
    114114 */
    115 RTDECL(void *) RTMemPageAllocZ(size_t cb)
     115RTDECL(void *) RTMemPageAllocZ(size_t cb) RT_NO_THROW
    116116{
    117117    cb = RT_ALIGN_Z(cb, PAGE_SIZE);
     
    129129 *                  NULL will be ignored.
    130130 */
    131 RTDECL(void) RTMemPageFree(void *pv)
     131RTDECL(void) RTMemPageFree(void *pv) RT_NO_THROW
    132132{
    133133    if (pv)
     
    144144 * @param   fProtect    The new protection, a combination of the RTMEM_PROT_* defines.
    145145 */
    146 RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect)
     146RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW
    147147{
    148148    /*
  • trunk/src/VBox/Runtime/r3/posix/alloc-posix.cpp

    r8245 r11020  
    4646#if !defined(RT_USE_MMAP) && (defined(RT_OS_LINUX))
    4747# define RT_USE_MMAP
    48 #endif 
     48#endif
    4949
    5050/*******************************************************************************
     
    5252*******************************************************************************/
    5353#ifdef RT_USE_MMAP
    54 /** 
     54/**
    5555 * RTMemExecAlloc() header used when using mmap for allocating the memory.
    5656 */
     
    6363# if ARCH_BITS == 32
    6464    uint32_t    Alignment[2];
    65 # endif 
     65# endif
    6666} RTMEMEXECHDR, *PRTMEMEXECHDR;
    6767
     
    8282 * @param   cb      Size in bytes of the memory block to allocate.
    8383 */
    84 RTDECL(void *) RTMemExecAlloc(size_t cb)
     84RTDECL(void *) RTMemExecAlloc(size_t cb) RT_NO_THROW
    8585{
    8686    AssertMsg(cb, ("Allocating ZERO bytes is really not a good idea! Good luck with the next assertion!\n"));
     
    9191     */
    9292    size_t cbAlloc = RT_ALIGN_Z(cb + sizeof(RTMEMEXECHDR), PAGE_SIZE);
    93     void *pv = mmap(NULL, cbAlloc, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS 
     93    void *pv = mmap(NULL, cbAlloc, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS
    9494#if defined(RT_ARCH_AMD64) && defined(MAP_32BIT)
    9595                    | MAP_32BIT
     
    140140 * @param   pv      Pointer to memory block.
    141141 */
    142 RTDECL(void)    RTMemExecFree(void *pv)
     142RTDECL(void)    RTMemExecFree(void *pv) RT_NO_THROW
    143143{
    144144    if (pv)
     
    152152#else
    153153        free(pv);
    154 #endif 
     154#endif
    155155    }
    156156}
     
    164164 * @param   cb  Size of the memory block. Will be rounded up to page size.
    165165 */
    166 RTDECL(void *) RTMemPageAlloc(size_t cb)
     166RTDECL(void *) RTMemPageAlloc(size_t cb) RT_NO_THROW
    167167{
    168168#if 0 /** @todo huh? we're using posix_memalign in the next function... */
     
    185185 * @param   cb  Size of the memory block. Will be rounded up to page size.
    186186 */
    187 RTDECL(void *) RTMemPageAllocZ(size_t cb)
     187RTDECL(void *) RTMemPageAllocZ(size_t cb) RT_NO_THROW
    188188{
    189189    void *pv;
     
    204204 *                  NULL will be ignored.
    205205 */
    206 RTDECL(void) RTMemPageFree(void *pv)
     206RTDECL(void) RTMemPageFree(void *pv) RT_NO_THROW
    207207{
    208208    if (pv)
     
    219219 * @param   fProtect    The new protection, a combination of the RTMEM_PROT_* defines.
    220220 */
    221 RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect)
     221RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW
    222222{
    223223    /*
  • trunk/src/VBox/Runtime/r3/solaris/alloc-solaris.cpp

    r8245 r11020  
    5454 * @param   cb      Size in bytes of the memory block to allocate.
    5555 */
    56 RTDECL(void *) RTMemExecAlloc(size_t cb)
     56RTDECL(void *) RTMemExecAlloc(size_t cb) RT_NO_THROW
    5757{
    5858    /*
     
    9292 * @param   pv      Pointer to memory block.
    9393 */
    94 RTDECL(void)    RTMemExecFree(void *pv)
     94RTDECL(void)    RTMemExecFree(void *pv) RT_NO_THROW
    9595{
    9696    if (pv)
     
    106106 * @param   cb  Size of the memory block. Will be rounded up to page size.
    107107 */
    108 RTDECL(void *) RTMemPageAlloc(size_t cb)
     108RTDECL(void *) RTMemPageAlloc(size_t cb) RT_NO_THROW
    109109{
    110110    return valloc(RT_ALIGN_Z(cb, PAGE_SIZE));
     
    119119 * @param   cb  Size of the memory block. Will be rounded up to page size.
    120120 */
    121 RTDECL(void *) RTMemPageAllocZ(size_t cb)
     121RTDECL(void *) RTMemPageAllocZ(size_t cb) RT_NO_THROW
    122122{
    123123    cb = RT_ALIGN_Z(cb, PAGE_SIZE);
     
    135135 *                  NULL will be ignored.
    136136 */
    137 RTDECL(void) RTMemPageFree(void *pv)
     137RTDECL(void) RTMemPageFree(void *pv) RT_NO_THROW
    138138{
    139139    if (pv)
     
    150150 * @param   fProtect    The new protection, a combination of the RTMEM_PROT_* defines.
    151151 */
    152 RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect)
     152RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW
    153153{
    154154    /*
  • trunk/src/VBox/Runtime/r3/win/alloc-win.cpp

    r8245 r11020  
    5454 * @param   cb      Size in bytes of the memory block to allocate.
    5555 */
    56 RTDECL(void *) RTMemExecAlloc(size_t cb)
     56RTDECL(void *) RTMemExecAlloc(size_t cb) RT_NO_THROW
    5757{
    5858    /*
     
    9292 * @param   pv      Pointer to memory block.
    9393 */
    94 RTDECL(void)    RTMemExecFree(void *pv)
     94RTDECL(void)    RTMemExecFree(void *pv) RT_NO_THROW
    9595{
    9696    if (pv)
     
    106106 * @param   cb  Size of the memory block. Will be rounded up to page size.
    107107 */
    108 RTDECL(void *) RTMemPageAlloc(size_t cb)
     108RTDECL(void *) RTMemPageAlloc(size_t cb) RT_NO_THROW
    109109{
    110110#ifdef USE_VIRTUAL_ALLOC
     
    125125 * @param   cb  Size of the memory block. Will be rounded up to page size.
    126126 */
    127 RTDECL(void *) RTMemPageAllocZ(size_t cb)
     127RTDECL(void *) RTMemPageAllocZ(size_t cb) RT_NO_THROW
    128128{
    129129#ifdef USE_VIRTUAL_ALLOC
     
    148148 *                  NULL will be ignored.
    149149 */
    150 RTDECL(void) RTMemPageFree(void *pv)
     150RTDECL(void) RTMemPageFree(void *pv) RT_NO_THROW
    151151{
    152152    if (pv)
     
    170170 * @param   fProtect    The new protection, a combination of the RTMEM_PROT_* defines.
    171171 */
    172 RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect)
     172RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW
    173173{
    174174    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette