简体   繁体   中英

VxWorks Stack Frame Unusually Large

I'm looking at some optimized assembly code targeting the x86 (32 bit) platform and VxWorks 6.8. I have five local variables (aside from the three passed parameters) and these five variables are typed as follows: char[200], char*, int, int, fd_set . The three passed variables are typed as int, int, bool . When I look at the disassembly, the stack frame is created as:

push ebp
mov ebp,esp
push edi
push esi
push ebx
sub esp,0x10fc

What I'm curious about is the last line as it allocates 4348 bytes on the stack for the five locals, which seems like far too much space. Also: the second local ( char* ) is used to walk each byte in the first local ( char[200] ). Any insight into why so much space is allocated would be greatly appreciated.

The fd_set typically contains 1024 bits, or 128 bytes.

Chances are you are passing fd_set by value to some other functions, creating unnamed temporaries in the process.

You can compile the source with -fdump-tree-all , and examine resulting output files. You should be able to see all the temporaries GCC created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM