Преглед изворни кода

--- Merging r14197 into '.':
U rtl/inc/heap.inc

# revisions: 14197
------------------------------------------------------------------------
r14197 | jonas | 2009-11-16 01:18:34 +0100 (Mon, 16 Nov 2009) | 3 lines
Changed paths:
M /trunk/rtl/inc/heap.inc

* added some prefetch commands based on profile information about
l2 misses

------------------------------------------------------------------------

git-svn-id: branches/fixes_2_4@15047 -

marco пре 15 година
родитељ
комит
98c5cfdf3b
1 измењених фајлова са 6 додато и 2 уклоњено
  1. 6 2
      rtl/inc/heap.inc

+ 6 - 2
rtl/inc/heap.inc

@@ -911,14 +911,15 @@ begin
         exit(nil);
       poc := poschunk(pointer(pmc)-fixedfirstoffset);
     end;
+  prefetch(poc^.used);
   { get a pointer to the block we should return }
   result := pointer(pmc)+sizeof(tmemchunk_fixed_hdr);
   { update freelist }
   pmc_next := pmc^.next_fixed;
   loc_freelists^.fixedlists[chunkindex] := pmc_next;
+  prefetch((pointer(@chunksize)-4)^);
   if assigned(pmc_next) then
     pmc_next^.prev_fixed := nil;
-  inc(poc^.used);
   { statistics }
   with loc_freelists^.internal_status do
   begin
@@ -931,6 +932,7 @@ begin
 {$endif}        
     end;
   end;
+  inc(poc^.used);
 end;
 
 function SysGetMem_Var(size: ptruint): pointer;
@@ -1120,6 +1122,8 @@ var
   size: sizeint;
 {$endif}
 begin
+  pmc := pmemchunk_fixed(p-sizeof(tmemchunk_fixed_hdr));
+  prefetch(pmc^.size);
   if p=nil then
     begin
       result:=0;
@@ -1132,8 +1136,8 @@ begin
   else
     dec(sizeusage[size shr sizeusageshift]);
 {$endif}
+  { loc_freelists is a threadvar, so it can be worth it to prefetch }
   loc_freelists := @freelists;
-  pmc := pmemchunk_fixed(p-sizeof(tmemchunk_fixed_hdr));
   { check if this is a fixed- or var-sized chunk }
   if (pmc^.size and fixedsizeflag) = 0 then
     result := sysfreemem_var(loc_freelists, pmemchunk_var(p-sizeof(tmemchunk_var_hdr)))