Skip to content

HL-ZASM Passing and returning stack objects. #4

@Yevano

Description

@Yevano

Incorrect code is generated for passing structs and arrays on the stack to functions and for returning them. In the case of passing, the caller just passes the first byte of the array or struct. The callee code is actually generated correctly and would be able to receive the object if it were passed correctly. In the case of returning, the first element of the object is stored in eax and no copying is done.

If the compiler was never meant to have these features, it should at least throw an error rather than passing/returning the first byte of the object.

EDIT: Seems like arrays of structs aren't indexed correctly (index isn't aligned to the size of the struct) and reading arrays of structs won't copy structs onto the stack either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions