The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: hutch-- on June 30, 2005, 12:54:06 PM

Title: "Quick" call macros and example
Post by: hutch-- on June 30, 2005, 12:54:06 PM
I don't know how useful this is but it appears to be reliable. Instead of push call syntax, it writes the arguments directly to the stack with MOV, corrects the stack then calls the procedure. It produces larger code than using PUSH when the arg is a memory operand but with no pushes through the code in the example, its probably faser in some contexts.

[attachment deleted by admin]
Title: Re: "Quick" call macros and example
Post by: AeroASM on June 30, 2005, 03:06:05 PM
Three things:

1. Does it handle LOCAL variables?
2. Does it generate a warning when it overwrites eax?
3. CAn you make it so instead of writing to eax every time it uses another one like ecx or edx if eax is being used?
Title: Re: "Quick" call macros and example
Post by: hutch-- on July 01, 2005, 03:17:40 AM
Aero,

Locals work like normal, there is a seperate macro for stack variables which are written sequentially so one return of eax does not overwrite the next. Using another register just shifts the problem somewhere else where EAX is by convention transient. It will still have the problem of trying to use EAX directly but invoke does not do this any better.

The idea was to produce a different form of code that was PUSH free as MOV is usually faster particularly when it is called sequentially. When I get in front I will write up a benchmark to test the idea out. At least it seems to work at the moment with no real problems.

LATER :

Sad to say I benchmarked the technique and its about 10% slower than the normal invoke so while it was an interesting idea, there is no speed gain by using it. (shrug etc ...).