flat assembler
Message board for the users of flat assembler.
![]() |
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.
|
|||
![]() |
|
Azu 02 Sep 2009, 12:37
It fails to compile or it fails to run?
|
|||
![]() |
|
shoorick 02 Sep 2009, 12:40
it fails to compile, but who declares initialized data in local variables?
|
|||
![]() |
|
Azu 02 Sep 2009, 12:43
I think touching will only help for running.. try changing 0 to ? to help it compile..
|
|||
![]() |
|
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. |
|||
![]() |
|
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)
|
|||
![]() |
|
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.
|
|||
![]() |
|
Azu 02 Sep 2009, 17:38
![]() Why does it need 500,000 bytes to make 12,800 movs? Is each mov 39 bytes long? |
|||
![]() |
|
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).
|
|||
![]() |
|
Tomasz Grysztar 02 Sep 2009, 18:03
Yes, there are 51200 MOVs, my mistake, I thought it was "db" there, but it was "dd".
|
|||
![]() |
|
Azu 02 Sep 2009, 18:12
Why not use dword movs for dd?
|
|||
![]() |
|
LocoDelAssembly 02 Sep 2009, 18:43
Quote:
They are dword movs already. |
|||
![]() |
|
Azu 02 Sep 2009, 18:52
Oops x_x my math was all wrong. Sorry.
|
|||
![]() |
|
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. |
|||
![]() |
|
Borsuc 02 Sep 2009, 19:10
It's not the compiler here, it's the macros.
![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.