News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

PROLOGUE YES or NO

Started by Grincheux, January 07, 2016, 03:47:07 AM

Previous topic - Next topic

hutch--

There is yet another technique from the Win3 16 bit days when you had very little stack space. Allocate a set of GLOBAL variables of the right size and pass values in the globals. Again it can only be used safely with leaf procedures but it lives somewhere between the speed of inlined code and a no stack frame procedure.

jj2007

Quote from: hutch-- on January 09, 2016, 04:06:18 AMpass values in the globals. Again it can only be used safely with leaf procedures

Why unsafe?

I use a hybrid: SetGlobals uses the LOCAL somevar:DWORD syntax, but mov eax, somevar is mov eax, [ebx+n] under the hood, where n is -128...+128 (and more). Speed-wise as fast as global variables, but shorter encoding.

Grincheux

You make your heap manager

hutch--

 :biggrin:

Well, there is safe and there is SAFE, try a recursive quick sort that iterated hundreds of thousands of calls deep and you will understand why fixed globals are not the solution. You can have many more fixed globals than registers and they are slightly slower than true FASTCALL but not by much.

Grincheux

I am OK with you Hutch. It is like trying to program a recursive application in FORTRAN.