00001
00002
00003 #ifndef _PREFETCHHEAP_H_
00004 #define _PREFETCHHEAP_H_
00005
00006 #define prefetcht0 __asm _emit 0x0f __asm _emit 0x18 __asm _emit 0x08
00007
00008
00009 template <class Super>
00010 class PrefetchHeap : public Super {
00011 public:
00012
00013 inline void * malloc (size_t sz) {
00014 void * Address = Super::malloc (sz);
00015 #ifdef _M_IX86
00016
00017 __asm
00018 {
00019 mov eax,Address
00020 prefetcht0
00021 }
00022 #endif
00023 return Address;
00024 }
00025
00026 inline void free (void * ptr) {
00027 Super::free (ptr);
00028 }
00029 };
00030
00031 #endif