Basis-Universal-Transcoders icon indicating copy to clipboard operation
Basis-Universal-Transcoders copied to clipboard

[proposal] Refactor bitreverse routines

Open MaxGraey opened this issue 5 years ago • 4 comments

Replace it to builtin intrinsics after landing https://github.com/AssemblyScript/assemblyscript/pull/1474

MaxGraey avatar Sep 27 '20 13:09 MaxGraey

Couple thoughts after looking into the proposal.

  • Using those intrinsics here would require careful -- memoryBase handling to prevent REV_LUT from overwriting used memory. Moreover, some future standard library update may potentially break these assumptions.
  • In general, we'd prefer to avoid non-trivial external functions that may make porting this project to other languages or platforms more complicated. This particular change looks straightforward enough, though.

lexaknyazev avatar Sep 27 '20 20:09 lexaknyazev

__heap_base already depend on optimization level, also, not only memory.data write to data section, it also happening for constant strings and other things. So it required changes in any way. Probably you don't affect to any issue due to your starting offset much bigger than 1024, but may happening in future.

MaxGraey avatar Sep 27 '20 21:09 MaxGraey

Another option you could just leave everithing "as is" and don't use newly builtin bitrev intrinsic. This issue is just one more suggestion

MaxGraey avatar Sep 27 '20 22:09 MaxGraey

Using __heap_base seems fine. I somehow missed it in the docs.

lexaknyazev avatar Sep 27 '20 22:09 lexaknyazev