flat assembler
Message board for the users of flat assembler.
Index
> Windows > big local variable size causes fasm hung |
Author |
|
revolution 02 Sep 2009, 09:18
The problem is that you have to "touch" then stack at runtime else you will get access exception. See this thread for more information.
|
|||
02 Sep 2009, 09:18 |
|
Azu 02 Sep 2009, 12:37
It fails to compile or it fails to run?
|
|||
02 Sep 2009, 12:37 |
|
shoorick 02 Sep 2009, 12:40
it fails to compile, but who declares initialized data in local variables?
|
|||
02 Sep 2009, 12:40 |
|
Azu 02 Sep 2009, 12:43
I think touching will only help for running.. try changing 0 to ? to help it compile..
|
|||
02 Sep 2009, 12:43 |
|
nazha 02 Sep 2009, 14:07
it fails to compile, even add following lines to proc32.inc:
repeat localbytes shr 12 mov byte[esp-%*4096],0 end repeat yes, after change to rd 51200, it can be compiled. above three lines help to run. tks. |
|||
02 Sep 2009, 14:07 |
|
Borsuc 02 Sep 2009, 14:52
Can you do it manually, without using macros, does it still not compile? I guess not right? (I don't use the macros anyway)
|
|||
02 Sep 2009, 14:52 |
|
Tomasz Grysztar 02 Sep 2009, 15:00
It doesn't really hang, it just enters a really long loop of virtual-load directives to generate MOV instructions that initialize the local variables for you. You really shouldn't use initialized locals that big - it generates 12800 MOV instructions (and for each one it virtualizes the whole block - really an overkill, but it's because of the limitations of "load"/"store" directives in fasm 1.x architecture). On my system it took 128 seconds to assemble and generated 500 KB executable.
|
|||
02 Sep 2009, 15:00 |
|
Azu 02 Sep 2009, 17:38
Why does it need 500,000 bytes to make 12,800 movs? Is each mov 39 bytes long? |
|||
02 Sep 2009, 17:38 |
|
Fanael 02 Sep 2009, 17:56
Because there are 51,200 MOVs. 9.77 byte per MOV, so it's possible (there are many MOVs with DWORD displacement and immediate - 8 bytes, and we must remember that there are two bytes more per MOV - one for opcode and one for mod r/m, so, the size of most MOVs is 10 bytes).
|
|||
02 Sep 2009, 17:56 |
|
Tomasz Grysztar 02 Sep 2009, 18:03
Yes, there are 51200 MOVs, my mistake, I thought it was "db" there, but it was "dd".
|
|||
02 Sep 2009, 18:03 |
|
Azu 02 Sep 2009, 18:12
Why not use dword movs for dd?
|
|||
02 Sep 2009, 18:12 |
|
LocoDelAssembly 02 Sep 2009, 18:43
Quote:
They are dword movs already. |
|||
02 Sep 2009, 18:43 |
|
Azu 02 Sep 2009, 18:52
Oops x_x my math was all wrong. Sorry.
|
|||
02 Sep 2009, 18:52 |
|
r22 02 Sep 2009, 19:00
Interesting corner-case flaw, this thread should probably be in Macro or Compiler Internals forum.
The compiler would need extra logic to figure out whether it should generate the MOVs inline or use the REP loop if the number before the DUP is too large, or just use a REP prefix loop all the time. |
|||
02 Sep 2009, 19:00 |
|
Borsuc 02 Sep 2009, 19:10
It's not the compiler here, it's the macros.
|
|||
02 Sep 2009, 19:10 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.