Up to Main Index                          Up to Journal for December, 2023

                    JOURNAL FOR MONDAY 11TH DECEMBER, 2023
______________________________________________________________________________

SUBJECT: New features and bug fixes coming soon
   DATE: Mon 11 Dec 20:36:08 GMT 2023

It’s been a few weeks since Mere ICE[1] was updated to v0.0.9 for people to
play with. December has since snuck up on us and I’ve been busy doing the
Advent of Code[2]. All of my solutions I’ve been writing in Mere — I thought
it a good test to see how capable my little language was in actual use.

Solving the Advent of Code problems proved to be a good distraction. So far
it’s shed light on two issues. The first issue involved a discrepancy in float
to uint conversions on ARM64 platforms. The second issue involved the wrong
labels being generated for break and continue statements when a loop followed
another loop and both were nested in a loop…


    for x …
      for y …
      next
      for z …
        // a break or continue with optional int in this loop
        // thinks this loop is nested in the 'y' loop
      next
    next


I’ve also fixed an egregious error in the implementation of range-next loops
over arrays and maps with more than a few thousand elements. I had written
some simple temporary code to get things working, and forgot to go back and
implement things properly. I discovered this working on an advent of code
solution that was taking way too long for what it was doing. Fixed the issue
by writing the proper implementation and the performance of range-next loops
are almost on par with for-next loops.

It’s always fun trying to debug problems like this. Is the issue in the code
you are writing or in the implementation!? It can drive one insane :s

By popular request, I’ve added three new tilde operators to Mere:


    ~l Lowercase regular expression matches
    ~u Uppercase regular expression matches
    ~j Join string array elements together with a separator between them


For example, consider:


    println "CAT" ~l `(?:.(..))`              // displays "Cat"
    println "the quick brown fox" ~u `(\b\w)` // displays "The Quick Brown Fox"

    sa := []string "c" "a" "t"
    println sa ~j ", "          // displays "c, a, t"
    println sa ~j ""            // displays "cat"


While ~j does not use regular expressions like the other tilde operators, it
seemed a natural fit to make it a tilde operator as it works well with them:


    println "A:B:C" ~l `\w` ~c ":" ~j "," // displays: a,b,c


Somewhere along the line I missed out compound assignment for the bit-wise
shift operators. These have now been implemented:


    i := 16; i <<= 2    // i is now 64
    i := 32; i >>= 2    // i is now 8


Bug fixes, new tilde operators and compound assignment for shift operators
should be out as v0.0.10 in a day or so.

Recently I switched to Go 1.21.5 for most of my machines. However, it seems
the original Raspberry Pi Zero W is having some issues:


  >time GOCACHE=~/tmp GOTMPDIR=~/tmp TMPDIR=~/tmp ./all.bash
  Building Go cmd/dist using /home/user/go1.17.13. (go1.17.13 linux/arm)
  Building Go toolchain1 using /home/user/go1.17.13.
  Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
  go tool dist: FAILED: /home/user/go1.21.5/pkg/tool/linux_arm/compile -std
  -pack -o /home/user/tmp/go-tool-dist-1621814424/internal/godebugs/_go_.a
  -p internal/godebugs -importcfg
  /home/user/tmp/go-tool-dist-1621814424/internal/godebugs/importcfg
  /home/user/go1.21.5/src/internal/godebugs/table.go: signal: illegal
  instruction

  real    25m50.144s
  user    22m37.539s
  sys     1m9.030s


Illegal instruction? Hrm… I’ve been seeing a few illegal instruction issues on
various Raspberry Pi recently. A Raspberry Pi 4 (4Gb RAM) running 32-bit
Raspberry Pi OS has been quite problematic. At least the failure was only 25
minutes into a 9½ hour build.

I remembered an article by Rachel by the bay[3] I read when previously hunting
down illegal instruction errors. Grabbing Go by the lapels I told it to “build
for ARMv5, punk” :) Not happy about building for ARMv5 instead of ARMv6 all of
a sudden, but at least it’s working[4]. More investigation needed…

--
Diddymus

  [1] The annexed works: /annex/

  [2] Advent of Code: https://adventofcode.com/

  [3] Rachel by the bay; clang now makes binaries an original Pi B+ can’t run:
        https://rachelbythebay.com/w/2023/11/30/armv6/

  [4] Trying to test the bug fixes and new features on pure 32-bit ARM unlike
      the Pi4 running a 32-bit OS on a 64-bit capable CPU — which has its own
      problems *sigh*


  Up to Main Index                          Up to Journal for December, 2023