Re: FastObj update



Hi,

This should obviously work, but it will introduce a new variable which must
be dereferenced. That's why I introduced "ifdef". A (true untyped) constant
would work by being replaced, not referenced (like a macro in C).
And I didn't retain your changes to have them everywhere because it doesn't
matter during initializing. All the ways go to the same MM. Only when speed
is important I tried to use less calls.

Gabriel

"JiYuan Xie" <gdxjy@xxxxxxxxxxx> wrote in message
news:4365af9a@xxxxxxxxxxxxxxxxxxxxxxxxx
> 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)