fix: variable-sized values, heap-allocated arrays (and printCharArray) #28

Merged
gk1623 merged 6 commits from asm-gen-arrays into asm-gen 2025-02-27 18:50:12 +00:00
gk1623 commented 2025-02-27 14:47:41 +00:00 (Migrated from gitlab.doc.ic.ac.uk)
  • Stack moved to a separate file and now keeps track of sizes of items in the stack.
  • MemLocation now requires an explicit size, to ensure we always think about it rather than blindly accessing memory.
  • Full implementation for arrays:
    • Layout in memory is [size(4 bytes), elems(elemSize)...]
      • Where elemSize is the MINIMUM required memory for a type (so 4 bytes for int, 1 byte for char and bool, 8 bytes for ptr (arrays and pairs), e.t.c.)
      • If the type is a Pair, we assume elemSize is 8 bytes because we might not be 100% sure what the type is (erased pairs).
    • Malloc built-in implementation.
    • PrintCharArray built-in for print char arrays.
- Stack moved to a separate file and now keeps track of sizes of items in the stack. - `MemLocation` now requires an explicit size, to ensure we always think about it rather than blindly accessing memory. - Full implementation for arrays: - Layout in memory is `[size(4 bytes), elems(elemSize)...]` - Where `elemSize` is the MINIMUM required memory for a type (so 4 bytes for int, 1 byte for char and bool, 8 bytes for ptr (arrays and pairs), e.t.c.) - If the type is a Pair, we assume `elemSize` is 8 bytes because we might not be 100% sure what the type is (erased pairs). - `Malloc` built-in implementation. - `PrintCharArray` built-in for print char arrays.
gk1623 commented 2025-02-27 14:48:30 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

added 1 commit

  • 4ffe85be - fix: variable-sized values, heap-allocated arrays (and printCharArray)

Compare with previous version

added 1 commit <ul><li>4ffe85be - fix: variable-sized values, heap-allocated arrays (and printCharArray)</li></ul> [Compare with previous version](/lab2425_spring/WACC_37/-/merge_requests/28/diffs?diff_id=154989&start_sha=fef9b709c214cfb94d47e4ebb7e74f4688b3d027)
gk1623 commented 2025-02-27 14:48:45 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

changed title from fix: variable-sized {-items in stack and heap, fully functional-} heap-allocated arrays (and printCharArray) to fix: variable-sized {+values,+} heap-allocated arrays (and printCharArray)

changed title from **fix: variable-sized {-items in stack and heap, fully functional-} heap-allocated arrays (and printCharArray)** to **fix: variable-sized {+values,+} heap-allocated arrays (and printCharArray)**
gk1623 commented 2025-02-27 14:48:54 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

changed the description

changed the description
gk1623 commented 2025-02-27 14:52:51 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

changed the description

changed the description
gk1623 commented 2025-02-27 18:15:09 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

added 3 commits

  • 82a3d606 - fix: zero-out sub-32 bit expressions
  • e740641a - fix: reserve return pointer and RBP on stack for user func bodies
  • 58ad849f - test: fix input handling for IOLoop example

Compare with previous version

added 3 commits <ul><li>82a3d606 - fix: zero-out sub-32 bit expressions</li><li>e740641a - fix: reserve return pointer and RBP on stack for user func bodies</li><li>58ad849f - test: fix input handling for IOLoop example</li></ul> [Compare with previous version](/lab2425_spring/WACC_37/-/merge_requests/28/diffs?diff_id=155219&start_sha=4ffe85be91b0a2b6d3338575ce1dac0475b607c3)
gk1623 commented 2025-02-27 18:15:55 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

added 7 commits

  • bdee6ba7 - 1 commit from branch asm-gen
  • 808a59f5 - feat: almost implemented arrays
  • 58df1d7b - refactor: extract Stack, proper register naming and sizes
  • 887b9823 - fix: variable-sized values, heap-allocated arrays (and printCharArray)
  • 507cb7dd - fix: zero-out sub-32 bit expressions
  • c472c7a6 - fix: reserve return pointer and RBP on stack for user func bodies
  • ea924bb6 - test: fix input handling for IOLoop example

Compare with previous version

added 7 commits <ul><li>bdee6ba7 - 1 commit from branch <code>asm-gen</code></li><li>808a59f5 - feat: almost implemented arrays</li><li>58df1d7b - refactor: extract Stack, proper register naming and sizes</li><li>887b9823 - fix: variable-sized values, heap-allocated arrays (and printCharArray)</li><li>507cb7dd - fix: zero-out sub-32 bit expressions</li><li>c472c7a6 - fix: reserve return pointer and RBP on stack for user func bodies</li><li>ea924bb6 - test: fix input handling for IOLoop example</li></ul> [Compare with previous version](/lab2425_spring/WACC_37/-/merge_requests/28/diffs?diff_id=155222&start_sha=58ad849fe816383f6efa17f73fd198a5b7503b54)
gk1623 commented 2025-02-27 18:25:30 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

added 1 commit

  • c0f2473d - test: fix input handling for IOLoop example

Compare with previous version

added 1 commit <ul><li>c0f2473d - test: fix input handling for IOLoop example</li></ul> [Compare with previous version](/lab2425_spring/WACC_37/-/merge_requests/28/diffs?diff_id=155230&start_sha=ea924bb60eea1294d12c6aae822baf438ccb9b01)
gk1623 commented 2025-02-27 18:50:12 +00:00 (Migrated from gitlab.doc.ic.ac.uk)

mentioned in commit ada53e518b

mentioned in commit ada53e518b3114157101aac860e78e59a8d5f660
gk1623 (Migrated from gitlab.doc.ic.ac.uk) merged commit ada53e518b into asm-gen 2025-02-27 18:50:12 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Imperial-MEng/WACC_37#28
No description provided.