Goasm don't support more than 3 nested structures

Started by Baboon, December 31, 2008, 01:18:58 AM

Previous topic - Next topic

Baboon

I'm working on a code with a lot of nested structures and goasm don't support it :

CST STRUCT
    Size                db       
    Value UNION
        d              dd
        b              db
        w              dw
    ENDS
ENDS

CPLX STRUCT
    [...]
    reg                  dd 
    const               CST
ENDS

ARG STRUCT
    TypeOfArg           db
    Arg UNION
        r               dd
        c               CST
        cplx            CPLX
    ENDS
ENDS

BDStruct STRUCT
[...]
Arg1                   ARG
Arg2                   ARG
ENDS


with those structure i can use this instruction :
mov eax , [ebx + CPLX.const.Value.d]
but i can't use :
mov eax , [ebx + ARG.Arg.cplx.const.Value.d] or any longer chain of structure members

I can't either use the Arg2 member of the structure or any other member declared below the Arg1 declaration.
(i can't do lea eax , [ebx + BDStruct.Arg2] )

I wish this bug will be fixed as soon as possible or i'll have to recode all my project in C or to use an other assembler


jorgon

Hi Baboon

By design GoAsm's current limit is 5 nested structures/unions which I think you have reached with your code.  Presumably you get the error message informing you of this.  I can enlarge this easily, so I'll come back to you soon with an update.

Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

Baboon

I haven't got any error like "too much nested structures" just the problems I've listed above

Thank you for your fast answer, now I'm waiting for the update version ;)

jorgon

QuoteI haven't got any error like "too much nested structures" just the problems I've listed above

This is strange because when you use the structure in the data section for example with
Hello2009 DBStruct

then GoAsm picks up the excess of nested structures/unions and gives an error message.

Anyway, in the attached version of GoAsm (Version 0.56.4m) I have enlarged the permitted nesting to ten instead of five.  Let me know if you need any more.

The other problems you mention may be related to the fact that you haven't actually used the structure.  If so then there are no symbols created.  However, maybe you are trying to use the structure labels to provide displacement values etc. which can be done even if the structure is not used.  Forgive me if I am looking at this too simply.





[attachment deleted by admin]
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

Baboon

Quote from: jorgon on December 31, 2008, 04:06:28 PM
The other problems you mention may be related to the fact that you haven't actually used the structure.  If so then there are no symbols created.  However, maybe you are trying to use the structure labels to provide displacement values etc. which can be done even if the structure is not used.  Forgive me if I am looking at this too simply.

you are right, the structure is never used in data declaration, I'm develloping a library and the structure is passed in the stack so I don't need to declare any BDStruct instance i just need the displacement values

With the new version all is all right :D
Thank you very much and happy new year ;)



ecube

why would you limit nested structures at all? what happens if you use a windowsapi function that uses #unknown amount of nested structures?

jorgon

Hi E^cube

Quotewhy would you limit nested structures at all? what happens if you use a windowsapi function that uses #unknown amount of nested structures?

Well, GoAsm needs to keep 64 bytes of information on each structure/union.  Currently it keeps that information in "data" as opposed to on the stack, which is why it is limited.  It was just easier to write the source that way.  I suppose that each time a new nest is encountered each nest could reserve on the stack 64 bytes for its own information, but I think you would still need to keep a pointer to each 64-byte block somewhere which was accessible at all times.  So if those pointers were kept in "data" you would still need to set a limit.  I suppose the answer would be to establish a chain of pointers kept on the stack, but then this is adding complication which is not really necessary.

As it is, if you attempt to "use" a structure (and you would do if you needed to call a particular windows api) and it had more than 10 nests, you get an error.  Then you would need to post a message here and I would enlarge the limit.  Do you think 10 is too small?

Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

ecube

#7
Hello jorgonl,

Yes I believe 10 is to small