source: proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/prefetchheap.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 563 bytes
Line 
1/* -*- C++ -*- */
2
3#ifndef _PREFETCHHEAP_H_
4#define _PREFETCHHEAP_H_
5
6#define prefetcht0                                        __asm _emit 0x0f __asm _emit 0x18 __asm _emit 0x08
7
8
9template <class Super>
10class PrefetchHeap : public Super {
11public:
12 
13  inline void * malloc (size_t sz) {
14    void * Address = Super::malloc (sz);
15#ifdef _M_IX86
16      // Prefetch this ptr before we return.
17      __asm
18        {
19          mov   eax,Address    // Load Address.
20          prefetcht0    // Prefetch into the L1.
21        }
22#endif
23    return Address;
24  }
25 
26  inline void free (void * ptr) {
27    Super::free (ptr);
28  }
29};
30
31#endif
Note: See TracBrowser for help on using the repository browser.