亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? heap.h

?? newos is new operation system
?? H
字號:
///-*-C++-*-////////////////////////////////////////////////////////////////////// Hoard: A Fast, Scalable, and Memory-Efficient Allocator//        for Shared-Memory Multiprocessors// Contact author: Emery Berger, http://www.cs.utexas.edu/users/emery//// Copyright (c) 1998-2000, The University of Texas at Austin.//// This library is free software; you can redistribute it and/or modify// it under the terms of the GNU Library General Public License as// published by the Free Software Foundation, http://www.fsf.org.//// This 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// Library General Public License for more details./////////////////////////////////////////////////////////////////////////////////*  heap.h  ------------------------------------------------------------------------  hoardHeap, the base class for threadHeap and processHeap.  ------------------------------------------------------------------------  @(#) $Id: heap.h,v 1.69 2001/03/22 22:10:36 emery Exp $  ------------------------------------------------------------------------  Emery Berger                    | <http://www.cs.utexas.edu/users/emery>  Department of Computer Sciences |             <http://www.cs.utexas.edu>  University of Texas at Austin   |                <http://www.utexas.edu>  ========================================================================*/#ifndef _HEAP_H_#define _HEAP_H_#include "config.h"//include <assert.h>//#include <math.h>#include "arch-specific.h"#include "superblock.h"#include "heapstats.h"class processHeap; // forward declarationclass hoardHeap {public:  hoardHeap (void);  // A superblock that holds more than one object must hold at least  // this many bytes.  enum { SUPERBLOCK_SIZE = 8192 };  // A thread heap must be at least 1/EMPTY_FRACTION empty before we  // start returning superblocks to the process heap.  enum { EMPTY_FRACTION = SUPERBLOCK_FULLNESS_GROUP - 1 };  // Reset value for the least-empty bin.  The last bin  // (SUPERBLOCK_FULLNESS_GROUP-1) is for completely full superblocks,  // so we use the next-to-last bin.  enum { RESET_LEAST_EMPTY_BIN = SUPERBLOCK_FULLNESS_GROUP - 2 };  // The number of empty superblocks that we allow any thread heap to  // hold once the thread heap has fallen below 1/EMPTY_FRACTION  // empty.  enum { MAX_EMPTY_SUPERBLOCKS = EMPTY_FRACTION };  // The maximum number of thread heaps we allow.  (NOT the maximum  // number of threads -- Hoard imposes no such limit.)  This must be  // a power of two! NB: This number is twice the maximum number of  // PROCESSORS supported by Hoard.  enum { MAX_HEAPS = 128 };  // ANDing with this rounds to MAX_HEAPS.  enum { MAX_HEAPS_MASK = MAX_HEAPS - 1 };  //  // The number of size classes.  This combined with the  // SIZE_CLASS_BASE determine the maximum size of an object.  //  // NB: Once this is changed, you must execute maketable.cpp and put  // the generated values into heap.cpp.#if MAX_INTERNAL_FRAGMENTATION == 2  enum { SIZE_CLASSES = 115 };#elif MAX_INTERNAL_FRAGMENTATION == 6  enum { SIZE_CLASSES = 46 };#elif MAX_INTERNAL_FRAGMENTATION == 10  enum { SIZE_CLASSES = 32 };#else#error "Undefined size class base."#endif  // Every object is aligned so that it can always hold a double.  enum { ALIGNMENT = sizeof(double) };  // ANDing with this rounds to ALIGNMENT.  enum { ALIGNMENT_MASK = ALIGNMENT - 1};  // Used for sanity checking.  enum { HEAP_MAGIC = 0x0badcafe };  // Get the usage and allocated statistics.  inline void getStats (int sizeclass, int& U, int& A);#if HEAP_STATS  // How much is the maximum ever in use for this size class?  inline int maxInUse (int sizeclass);  // How much is the maximum memory allocated for this size class?  inline int maxAllocated (int sizeclass);#endif  // Insert a superblock into our list.  void insertSuperblock (int sizeclass,			 superblock * sb,			 processHeap * pHeap);  // Remove the superblock with the most free space.  superblock * removeMaxSuperblock (int sizeclass);  // Find an available superblock (i.e., with some space in it).  inline superblock * findAvailableSuperblock (int sizeclass,					       block *& b,					       processHeap * pHeap);  // Lock this heap.  inline void lock (void);  // Unlock this heap.  inline void unlock (void);  // Set our index number (which heap we are).  inline void setIndex (int i);  // Get our index number (which heap we are).  inline int getIndex (void);  // Free a block into a superblock.  // This is used by processHeap::free().  // Returns 1 iff the superblock was munmapped.  int freeBlock (block *& b,		 superblock *& sb,		 int sizeclass,		 processHeap * pHeap);  //// Utility functions ////  // Return the size class for a given size.  inline static int sizeClass (const size_t sz);  // Return the size corresponding to a given size class.  inline static size_t sizeFromClass (const int sizeclass);  // Return the release threshold corresponding to a given size class.  inline static int getReleaseThreshold (const int sizeclass);  // Return how many blocks of a given size class fit into a superblock.  inline static int numBlocks (const int sizeclass);  // Align a value.  inline static size_t align (const size_t sz);private:  // Disable copying and assignment.  hoardHeap (const hoardHeap&);  const hoardHeap& operator= (const hoardHeap&);  // Recycle a superblock.  inline void recycle (superblock *);  // Reuse a superblock (if one is available).  inline superblock * reuse (int sizeclass);  // Remove a particular superblock.  void removeSuperblock (superblock *, int sizeclass);  // Move a particular superblock from one bin to another.  void moveSuperblock (superblock *,		       int sizeclass,		       int fromBin,		       int toBin);  // Update memory in-use and allocated statistics.  // (*UStats = just update U.)  inline void incStats (int sizeclass, int updateU, int updateA);  inline void incUStats (int sizeclass);  inline void decStats (int sizeclass, int updateU, int updateA);  inline void decUStats (int sizeclass);  //// Members ////#if HEAP_DEBUG  // For sanity checking.  const unsigned long _magic;#else  #define _magic HEAP_MAGIC#endif  // Heap statistics.  heapStats	_stats[SIZE_CLASSES];  // The per-heap lock.  hoardLockType _lock;  // Which heap this is (0 = the process (global) heap).  int _index;  // Reusable superblocks.  superblock *	_reusableSuperblocks;  int		_reusableSuperblocksCount;  // Lists of superblocks.  superblock *	_superblocks[SUPERBLOCK_FULLNESS_GROUP][SIZE_CLASSES];  // The current least-empty superblock bin.  int	_leastEmptyBin[SIZE_CLASSES];  // The lookup table for size classes.  static size_t	_sizeTable[SIZE_CLASSES];  // The lookup table for release thresholds.  static size_t	_threshold[SIZE_CLASSES];public:  // A little helper class that we use to define some statics.  class _initNumProcs {  public:  	_initNumProcs(void);  };  friend class _initNumProcs;protected:  // number of CPUs, cached  static int _numProcessors;  static int _numProcessorsMask;};void hoardHeap::incStats (int sizeclass, int updateU, int updateA) {  assert (_magic == HEAP_MAGIC);  assert (updateU >= 0);  assert (updateA >= 0);  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  _stats[sizeclass].incStats (updateU, updateA);}void hoardHeap::incUStats (int sizeclass) {  assert (_magic == HEAP_MAGIC);  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  _stats[sizeclass].incUStats ();}void hoardHeap::decStats (int sizeclass, int updateU, int updateA) {  assert (_magic == HEAP_MAGIC);  assert (updateU >= 0);  assert (updateA >= 0);  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  _stats[sizeclass].decStats (updateU, updateA);}void hoardHeap::decUStats (int sizeclass){  assert (_magic == HEAP_MAGIC);  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  _stats[sizeclass].decUStats();}void hoardHeap::getStats (int sizeclass, int& U, int& A) {  assert (_magic == HEAP_MAGIC);  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  _stats[sizeclass].getStats (U, A);}#if HEAP_STATSint hoardHeap::maxInUse (int sizeclass) {  assert (_magic == HEAP_MAGIC);  return _stats[sizeclass].getUmax();}int hoardHeap::maxAllocated (int sizeclass) {  assert (_magic == HEAP_MAGIC);  return _stats[sizeclass].getAmax();}#endifsuperblock * hoardHeap::findAvailableSuperblock (int sizeclass,						 block *& b,						 processHeap * pHeap){  assert (this);  assert (_magic == HEAP_MAGIC);  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  superblock * sb = NULL;  int reUsed = 0;  // Look through the superblocks, starting with the almost-full ones  // and going to the emptiest ones.  The Least Empty Bin for a  // sizeclass is a conservative approximation (fixed after one  // iteration) of the first bin that has superblocks in it, starting  // with (surprise) the least-empty bin.  for (int i = _leastEmptyBin[sizeclass]; i >= 0; i--) {    sb = _superblocks[i][sizeclass];    if (sb == NULL) {      if (i == _leastEmptyBin[sizeclass]) {	// There wasn't a superblock in this bin,	// so we adjust the least empty bin.	_leastEmptyBin[sizeclass]--;      }    } else if(sb->getNumAvailable() > 0){      assert (sb->getOwner() == this);      break;    }    sb = NULL;  }#if 1  if (sb == NULL) {    // Try to reuse a superblock.    sb = reuse (sizeclass);    if (sb) {      assert (sb->getOwner() == this);      reUsed = 1;    }  }#endif  if (sb != NULL) {    // Sanity checks:    //   This superblock is 'valid'.    assert (sb->isValid());    //   This superblock has the right ownership.    assert (sb->getOwner() == this);    int oldFullness = sb->getFullness();    // Now get a block from the superblock.    // This superblock must have space available.    b = sb->getBlock();    assert (b != NULL);    // Update the stats.    incUStats (sizeclass);    if (reUsed) {      insertSuperblock (sizeclass, sb, pHeap);      // Fix the stats (since insert will just have incremented them      // by this amount).      decStats (sizeclass,		sb->getNumBlocks() - sb->getNumAvailable(),		sb->getNumBlocks());    } else {      // If we've crossed a fullness group,      // move the superblock.      int fullness = sb->getFullness();      if (fullness != oldFullness) {	// Move the superblock.	moveSuperblock (sb, sizeclass, oldFullness, fullness);      }    }  }  // Either we didn't find a superblock or we did and got a block.  assert ((sb == NULL) || (b != NULL));  // Either we didn't get a block or we did and we also got a superblock.  assert ((b == NULL) || (sb != NULL));  return sb;}int hoardHeap::sizeClass (const size_t sz) {  // Find the size class for a given object size  // (the smallest i such that _sizeTable[i] >= sz).  int sizeclass = 0;  while (_sizeTable[sizeclass] < sz)    {      sizeclass++;      assert (sizeclass < SIZE_CLASSES);    }  return sizeclass;}size_t hoardHeap::sizeFromClass (const int sizeclass) {  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  return _sizeTable[sizeclass];}int hoardHeap::getReleaseThreshold (const int sizeclass) {  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  return _threshold[sizeclass];}int hoardHeap::numBlocks (const int sizeclass) {  assert (sizeclass >= 0);  assert (sizeclass < SIZE_CLASSES);  const size_t s = sizeFromClass (sizeclass);  assert (s > 0);  const int blksize = align (sizeof(block) + s);  // Compute the number of blocks that will go into this superblock.  int nb = MAX (1, ((SUPERBLOCK_SIZE - sizeof(superblock)) / blksize));  return nb;}void hoardHeap::lock (void){  assert (_magic == HEAP_MAGIC);  hoardLock (_lock);}void hoardHeap::unlock (void) {  assert (_magic == HEAP_MAGIC);  hoardUnlock (_lock);}size_t hoardHeap::align (const size_t sz){  // Align sz up to the nearest multiple of ALIGNMENT.  // This is much faster than using multiplication  // and division.  return (sz + ALIGNMENT_MASK) & ~ALIGNMENT_MASK;}void hoardHeap::setIndex (int i){  _index = i;}int hoardHeap::getIndex (void){  return _index;}void hoardHeap::recycle (superblock * sb){  assert (sb != NULL);  assert (sb->getOwner() == this);  assert (sb->getNumBlocks() > 1);  assert (sb->getNext() == NULL);  assert (sb->getPrev() == NULL);  assert (hoardHeap::numBlocks(sb->getBlockSizeClass()) > 1);  sb->insertBefore (_reusableSuperblocks);  _reusableSuperblocks = sb;  ++_reusableSuperblocksCount;  // printf ("count: %d => %d\n", getIndex(), _reusableSuperblocksCount);}superblock * hoardHeap::reuse (int sizeclass){  if (_reusableSuperblocks == NULL) {    return NULL;  }  // Make sure that we aren't using a sizeclass  // that is too big for a 'normal' superblock.  if (hoardHeap::numBlocks(sizeclass) <= 1) {    return NULL;  }  // Pop off a superblock from the reusable-superblock list.  assert (_reusableSuperblocksCount > 0);  superblock * sb = _reusableSuperblocks;  _reusableSuperblocks = sb->getNext();  sb->remove();  assert (sb->getNumBlocks() > 1);  --_reusableSuperblocksCount;  // Reformat the superblock if necessary.  if (sb->getBlockSizeClass() != sizeclass) {    decStats (sb->getBlockSizeClass(),	      sb->getNumBlocks() - sb->getNumAvailable(),	      sb->getNumBlocks());    sb = new ((char *) sb) superblock (numBlocks(sizeclass), sizeclass, this);    incStats (sizeclass,	      sb->getNumBlocks() - sb->getNumAvailable(),	      sb->getNumBlocks());  }  assert (sb->getOwner() == this);  assert (sb->getBlockSizeClass() == sizeclass);  return sb;}#endif // _HEAP_H_

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲天堂精品视频| 亚洲与欧洲av电影| 欧洲国产伦久久久久久久| 韩国欧美一区二区| 免费成人性网站| 天堂在线一区二区| 国内成人精品2018免费看| 午夜精品久久一牛影视| 久久精品国产99| 国产一区二区精品久久91| 欧美网站一区二区| 国产一区二区在线观看免费| 亚洲福利视频导航| 国产欧美一区二区精品性色超碰| 激情国产一区二区| 五月婷婷综合激情| 国内久久精品视频| 91麻豆精品视频| 成人免费小视频| 精品电影一区二区| 日本久久电影网| 成人av手机在线观看| 国产综合色精品一区二区三区| 欧美军同video69gay| 在线视频国内一区二区| 成人h动漫精品一区二| 欧美大片日本大片免费观看| 国产大陆精品国产| 不卡在线视频中文字幕| 蜜臀av一区二区| 蜜臀av一级做a爰片久久| 久久99热这里只有精品| 国产精品久久久久影院亚瑟| 亚洲一区在线播放| 国产精品自产自拍| 日本久久一区二区三区| 日韩欧美一级精品久久| 2024国产精品| 三级在线观看一区二区| 国产不卡视频在线观看| 欧美日韩一区中文字幕| 精品久久久久av影院| 成人在线综合网| 欧美日韩一区三区| 日本一区二区三区久久久久久久久不| 国产精品国产三级国产有无不卡 | 91福利在线导航| 欧美日本韩国一区| 一区二区三区免费网站| 成人黄色电影在线 | 一区二区三区在线视频播放| 国产永久精品大片wwwapp| 91精品在线观看入口| 蜜臀av在线播放一区二区三区| zzijzzij亚洲日本少妇熟睡| 欧美一区二区三区喷汁尤物| 亚洲男同性恋视频| 波多野洁衣一区| 国产精品麻豆99久久久久久| 麻豆精品一二三| 久久先锋影音av鲁色资源| 国产精品综合在线视频| 久久久久亚洲综合| 不卡一区二区三区四区| 欧美在线高清视频| 婷婷久久综合九色综合伊人色| 91国偷自产一区二区开放时间| 国产·精品毛片| 亚洲国产日韩综合久久精品| 欧美猛男男办公室激情| 三级久久三级久久| 日韩精品一区二区在线| 国产精品一级二级三级| 91精品国产91综合久久蜜臀| 国产成人亚洲综合a∨猫咪| 制服.丝袜.亚洲.中文.综合| 国产精品影视网| 亚洲福利电影网| 亚洲美女淫视频| 久久新电视剧免费观看| 欧美日韩免费观看一区二区三区 | 国产欧美一区二区精品性色超碰| 99精品国产99久久久久久白柏| 蜜臀av在线播放一区二区三区| 国产欧美日韩久久| 日韩精品中文字幕在线一区| 欧美性欧美巨大黑白大战| 菠萝蜜视频在线观看一区| 日韩中文字幕1| 亚洲成人福利片| 日韩免费观看2025年上映的电影| 成人涩涩免费视频| 奇米在线7777在线精品| 亚洲精品第1页| 亚洲摸摸操操av| 91浏览器在线视频| 日本在线播放一区二区三区| 国产精品88av| 7777精品久久久大香线蕉| 久久精品男人天堂av| 日韩精品亚洲专区| 成人免费视频播放| 精品国内片67194| 亚洲高清一区二区三区| 国产激情偷乱视频一区二区三区| fc2成人免费人成在线观看播放| 91麻豆精品国产无毒不卡在线观看| 久久久三级国产网站| 精品中文字幕一区二区小辣椒| 在线免费观看日韩欧美| 亚洲欧美日韩国产成人精品影院| 国产麻豆精品theporn| 337p亚洲精品色噜噜| 丝袜诱惑亚洲看片| 欧美伦理影视网| 蜜臀av一区二区三区| 久久久精品日韩欧美| 从欧美一区二区三区| 一区二区三区欧美| 欧美体内she精高潮| 午夜激情综合网| 精品免费国产一区二区三区四区| 日本少妇一区二区| 久久久精品免费免费| 色94色欧美sute亚洲线路一久| 一区二区三区四区av| 日韩欧美亚洲国产精品字幕久久久| 免费在线视频一区| 久久精品一区二区| 色婷婷久久久综合中文字幕| 日韩精品一区第一页| 亚洲国产精品99久久久久久久久| 成人免费精品视频| 青椒成人免费视频| 国产精品久久一卡二卡| 欧美成人一区二区三区在线观看| 成人激情黄色小说| 另类欧美日韩国产在线| 日韩毛片视频在线看| 精品va天堂亚洲国产| 欧美美女一区二区三区| 成人久久视频在线观看| 美女视频免费一区| 日韩av电影免费观看高清完整版| 日韩久久精品一区| 亚洲欧美一区二区三区孕妇| 91精品国产乱| 欧美丝袜丝交足nylons图片| 成人免费视频免费观看| 久久精品国产亚洲高清剧情介绍 | 亚洲色图另类专区| 国产调教视频一区| 久久在线免费观看| 91精品国产乱码| 日韩三区在线观看| 91精品久久久久久蜜臀| 日韩免费高清av| 精品不卡在线视频| 国产精品成人一区二区艾草| 国产精品久久久久久久久搜平片| 亚洲欧美另类久久久精品2019| 一区二区三区日韩| 日韩综合在线视频| 国产九色精品成人porny| www.亚洲免费av| 欧美体内she精视频| 久久免费午夜影院| 亚洲gay无套男同| 成人动漫一区二区| 欧美精品18+| 中文字幕日韩一区| 久久精品国产成人一区二区三区 | 国产欧美一区二区三区鸳鸯浴| 日韩美女视频一区| 国产综合久久久久久鬼色| 色综合久久精品| 欧美大度的电影原声| 亚洲愉拍自拍另类高清精品| 国产黄人亚洲片| 欧美午夜片在线观看| 国产亚洲一区二区三区四区| 日本麻豆一区二区三区视频| 成人精品免费看| 26uuuu精品一区二区| 国产精品中文字幕一区二区三区| 夜色激情一区二区| 国产一区二区三区在线观看免费视频| 色噜噜狠狠色综合欧洲selulu| 国产欧美日韩激情| 久久国产综合精品| 亚洲精品一区二区三区香蕉| 丝袜亚洲另类丝袜在线| 欧美一区二区日韩| 麻豆91精品视频| 国产亚洲成aⅴ人片在线观看| 日韩视频一区二区三区在线播放 | 精品区一区二区| 国内久久精品视频| 国产精品乱子久久久久| 91麻豆福利精品推荐|