Fixed native word-RAM van Emde Boas code #
The same thirty-two-register structured program dispatches insertion, membership and strict successor. It uses only standard unsigned integer operations, comparisons, loads and stores. The split size and child span are read from the represented memory; no code is generated from the depth, key or word width.
The minimum is stored outside recursive clusters, following Demaine's exposition. The lecture notes credit Michael Bender. The five-word contiguous records and explicit four-word successor return stack are engineering choices, distinguished from the original stratified representation of van Emde Boas, Kaas and Zijlstra.
These definitions alone establish no operation's correctness, execution bound, initialization or space use. Each certified operation must supply actual execution and representation proofs. In particular, a fitting query word may exceed the tree universe; membership rejects queries above the cached maximum before computing a descendant address.
Main definitions #
program: one fixed dispatch over native instructions.memberBody,memberLoop: membership descent with a cached-maximum rejection.insertBody,insertLoop: native insertion descent.successorDescentBody,successorDescent,successorUnwindBody,successorUnwind: native strict-successor descent and return-stack unwinding.
Main results #
program_size: the fixed dispatch has 212 instructions before halt.program_not_readsWidth: no instruction reads the selected word width.
References #
Caller-supplied operation tag: insertion = 0, membership = 1, successor = 2.
Instances For
Caller-supplied key or query word.
Instances For
Returned key or Boolean membership word.
Instances For
Presence flag distinguishing a successor from absence.
Instances For
Persistent base address of the represented tree.
Instances For
Persistent base address of the reserved return stack.
Instances For
Reserved register for initialization depth; the dispatch program does not read it.
Instances For
Reserved register for initialization metadata; the dispatch program does not read it.
Instances For
Register holding zero after setup.
Instances For
Register holding one after setup.
Instances For
Register holding two after setup.
Instances For
Register holding three after setup.
Instances For
Register holding four after setup.
Instances For
Register holding the five-word header size after setup.
Instances For
Current subtree address.
Instances For
Current local query or inserted key.
Instances For
Current node's stored split size.
Instances For
Current node's stored child span.
Instances For
High part of the current key.
Instances For
Low part of the current key.
Instances For
Computed child address.
Instances For
Scratch address for indexed memory operations.
Instances For
Cached presence flag read from the current record.
Instances For
Cached minimum read from a record.
Instances For
Cached maximum read from a record.
Instances For
Scratch arithmetic register.
Instances For
Return-stack cursor.
Instances For
Whether the descent loop continues.
Instances For
Return-frame tag: cluster = 0, summary = 1.
Instances For
Return-frame payload: cluster offset or parent address.
Instances For
Split size loaded from a return frame.
Instances For
Child span loaded from a return frame.
Instances For
Initialize constants, traversal, result and stack registers in twelve instructions.
Instances For
Split the key and compute its cluster address using six arithmetic instructions.
Instances For
Return the cached minimum and stop descent.
Instances For
Return the cached maximum and stop descent.
Instances For
Return absence and stop descent.
Instances For
One native insertion iteration. Empty records and empty destination clusters install their first key directly in the three-word bounds area.
Instances For
Native insertion descent.
Instances For
One native membership iteration. The maximum check rejects large queries before descent.
Instances For
Native membership descent, with one depth decrease for each continuing iteration.
Instances For
Push four words: continuation kind, payload, split and child span.
Instances For
Save a cluster-return continuation and descend into the selected cluster.
Instances For
Save a summary-return continuation and descend into the summary.
Instances For
One native successor-descent iteration. The cached maximum chooses between early termination, cluster descent and summary descent.
Instances For
Native successor descent.
Instances For
Pop the four-word return frame.
Instances For
One native successor-unwind iteration.
Instances For
Reconstruct the answer through cluster and summary return frames.
Instances For
One fixed dispatch program, independent of the universe, query, state and word width.
Instances For
The fixed dispatch has 212 instructions before the final compiled halt.
The dispatch never reads the selected word width.