Re: FastObj update



Hi again:

Here is the way I came up with to eliminate the usage of the UseFastMM
define:

1,Add the following lines after the declaration of NeedRegisterModuleUnload:

var
GetMem: function (ASize: Integer): Pointer;
FreeMem: function (APointer: Pointer): Integer;
ReallocMem: function (APointer: Pointer; ANewSize: Integer): Pointer;

2,Insert the following lines just after the line of initializtion, before
the line of InitializeCriticalSection(vAcceleratorCS):

asm
sub esp, TYPE TMemoryManager

mov eax, esp
call System.GetMemoryManager

mov eax, [esp].TMemoryManager.GetMem
call GetActualAddress
mov [GetMem], eax

mov eax, [esp].TMemoryManager.FreeMem
call GetActualAddress
mov [FreeMem], eax

mov eax, [esp].TMemoryManager.ReallocMem
call GetActualAddress
mov [ReallocMem], eax

add esp, TYPE TMemoryManager
end;

3,
a,Replace all the references to FastGemMem, System@GetMem with GetMem
b,Replace all the references of FastFreeMem, System@FreeMem to FreeMem,
c,Replace all the references of FastReallocMem, System@ReallocMem to
ReallocMem

4,Modify all the {$ifdef UseFastMM}..{$else}..{$endif} wrapped statements
accorrdingly.

Regards,
JiYuan Xie



.



Relevant Pages

  • Re: FastObj update
    ... > sub esp, TYPE TMemoryManager ... > mov eax,.TMemoryManager.GetMem ... > call GetActualAddress ... > a,Replace all the references to FastGemMem, System@GetMem with GetMem ...
    (borland.public.delphi.language.basm)
  • Re: How to solve this warning?
    ... Enable the source+assembly listing option) ... To get the actual esp which is the return address, ... mov eax, esp ... Note that this code works the same on both Win32 and Win64 platforms. ...
    (microsoft.public.vc.mfc)
  • Re: Spinlocks - trouble with speed
    ... spinlock_ia32* const self ... MOV ECX, [ESP + 4] ... MOV EAX, ...
    (comp.programming.threads)
  • Re: assembly language and reverse engineering
    ... mov eax, ... add esp, 8 ... mov [ebp-4], eax ... not familiar with this "doubleclick" instruction - must be for one of ...
    (alt.lang.asm)