qBeta for Mac Apple Silicon – ARM

image_pdfimage_print

This page contains documentation for the implementation of qBeta for the ARM processor as in Apple Silicon.

Status

As of sept 22, 2026 some of the basic mechanisms have ben implemented:

  • Binary and unaryiary expressions
  • Invocation/instantiation of patterns
  • Inner
  • if:then, if:then:else, leave and restart in local block (OD)
  • Arrays (repetitions), String arrays
  • Assignment of primitive values and references
  • Parameters being primitive values and references

The following issues need to be handled:

  • Temporary data-items for complex expressions
    • May run out of registers
    • Invocations/instantiations during evaluation of actual parameters
    • Perhaps invocations during store of parameters
  • Leave/restart out of blocks
  • Coroutines
  • Value objects
  • Floating point data-items
  • Garbage collection
  • Object layout and extension of the ODtemplate, see below
  • Errors and unknown issues;-)

Object layout

Currently all objects have the following layout:

0/0:return register – lr
1/8:caller object – x28
2/16:pointer to VDT_table
3/24:not used
4/32:Data-item 1
5/40:Data-item 2
6/48:Data-item 3

VDT-table

Currently the ObjectDescriptor-template (ODtemplate) is simple; it has the name of the pattern/OD and the virtuals bindings of the OD

0:offSet to asciiz string
8:pointer to code for virtual binding
16:
asciiz string Name of pattern/OD

The VDT-table must be extended to a full OD-template with additional information

  • Size of the objects – perhaps
  • Pointer to OD-template for super
  • Garbage collection info
  • The kind of the objects: plain, indexed (array), ObjStructure (for pattern variables)

Future object kinds

We currently work on marking the various ODs depending on what they are used for:

isDataUsed as a type for a data-item
isOnlyDataisData and no statements
hasParamshas in / out parameters
isLocalExehas statements but on invocations
hasAllocCodehas data-items that need alloc code
isCoroutinea coroutine object that mya be suspend and resumed
codeExistshasParams or hasAllocCode or isLocalExe or isCoroutine

The above markings may overlap.

We may need to add a property identifying a method:

  • not isData and not isOnlyData and not isCoroutine [and codeExists ? ]

Register usage

The table below shows the usage of registers

stack pointer – not used by qBetax31
link register – lrx30
HeapTop – HT
ARM conventions is frame pointer
x29
thisObjx28
references
used for passing reference parameters
x15, x16, … x26
values
used for passing primitive value parameters
x0, x1, … x14

The ARM convention is that x19-x28 are callee-saved registers

All other registers may be modified by a given callee

We do not adhere to the ARM conventions.

We may have to adjust to some of the conventions, perhaps have HT as a calle-saved register.