zaskar9 / oberon-lang

An LLVM frontend for the Oberon programming language
MIT License
20 stars 3 forks source link

Add missing FLT, PACK and UNPK procedures and expand unittests. #48

Closed tenko closed 6 months ago

tenko commented 6 months ago

Added support for FLT, PACK and UNPK procedures. Added unittests covering all procedures.

The behaviour is now chosen to be in line with OBNC regarding undefined behaviour as LLVM follow the C/C++ language model. Project Oberon has one place where a negative LSL shift value is used. For most CPU platforms this is undefined behaviour.

This should be ready for merging if you could take a quick look and tests.

NOTE : For the future I will create own branch for changes. I see it creates a bit of a mess without.

zaskar9 commented 6 months ago

Hey, this is great work in terms of filling the gaps and making these built-in functions bullet-proof and conforming to other implementations! 🙏🏻 I really appreciate the work, especially as I cannot devote at lot of time to this project. Just let me know when you feel it's ready to merge. I've also added you as a contributor to the repository and maybe that means that you can merge the pull request yourself!

tenko commented 6 months ago

That is very nice of you to grant access, but it seems that I cannot merge this myself alone. I will give you a message when it is ready. Still in the process of doing some more checking against Project Oberon.

For the future I was thinking to use the Github CI solution, so that all pull request get automatic tested against a defined number of platforms. This should not be too difficult to set up.

It could even be used to build downloadable releases when it detect a git tagged version and so on.

I will take a look at this when this pull request is merged. Believe this will make it less time consuming to decide on merging pull requests.

tenko commented 6 months ago

This should be ready for merging if you could take a quick look and tests.

tenko commented 6 months ago

Yes,

There are 5 tests which should fail according to behavior of OBNC/Native Oberon:

  1. builtin_asr_2.mod : fail with negative shift value (literal only)
  2. builtin_lsl_2.mod : fail with negative shift value (literal only)
  3. builtin_rol_2.mod : fail with negative roll value (literal only)
  4. builtin_ror_2.mod : fail with negative roll value (literal only)
  5. builtin_short_2.mod : fail with constant literal value

Otherwise tests should pass, which it seems it does.