Skip to content

Conversation

@aykevl
Copy link
Member

@aykevl aykevl commented Dec 26, 2020

During a run of interp, some memory (for example, memory allocated
through runtime.alloc) may not have a known LLVM type. This memory is
alllocated by creating an i8 array.
This does not necessarily work, as i8 has no alignment requirements
while the allocated object may have allocation requirements. Therefore,
the resulting global may have an alignment that is too loose.
This works on some microcontrollers but notably does not work on a
Cortex-M0 or Cortex-M0+, as all load/store operations must be aligned.

This commit fixes this by setting the alignment of untyped memory to the
maximum alignment. The determination of "maximum alignment" is not
great but should get the job done on most architectures.


This PR fixes an issue with #1430.

During a run of interp, some memory (for example, memory allocated
through runtime.alloc) may not have a known LLVM type. This memory is
alllocated by creating an i8 array.
This does not necessarily work, as i8 has no alignment requirements
while the allocated object may have allocation requirements. Therefore,
the resulting global may have an alignment that is too loose.
This works on some microcontrollers but notably does not work on a
Cortex-M0 or Cortex-M0+, as all load/store operations must be aligned.

This commit fixes this by setting the alignment of untyped memory to the
maximum alignment. The determination of "maximum alignment" is not
great but should get the job done on most architectures.
@aykevl
Copy link
Member Author

aykevl commented Dec 26, 2020

@deadprogram you might want to restart some of the TinyHCI devices, many appear to be locked up.

@deadprogram
Copy link
Member

The itsybitsy-nrf52840 hci failure is not related to this fix. The other boards are all passing again.

Now merging, thanks for the quick fix @aykevl !

@deadprogram deadprogram merged commit 5917b8b into dev Dec 27, 2020
@deadprogram deadprogram deleted the interp-fix-align branch December 27, 2020 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants