def bpf_check.go

bend-osdev-bpf@0.1.0.0 · validate.bend:111

import bend-osdev-bpf@0.1.0.0/validate.bend as Validate
import Base
import bend-osdev-bpf@0.1.0.0/insn.bend as I

111# the same as a tail call: ok is the verdict so far, and n counts the
112# instructions from pc on; the loop stops at the instruction after a failure
113def bpf_check.go(xs: List<&2, I.BpfOp>, +pc: Nat, ok: Result<&2, &2, I.BpfError, Unit>, n: Nat) -> Result<&2, &2, I.BpfError, Unit>:
114  match xs:
115    case Nil{}:
116      ok
117    case Con{op, t}:
118      match ok:
119        case Fail{e}:
120          Fail{e}
121        case Done{u}:
122          match n:
123            case 0n:
124              bpf_check.go(t, 1n+pc, bpf_check.op(op, pc, 0n), 0n)
125            case 1n+(+r):
126              bpf_check.go(t, 1n+pc, bpf_check.op(op, pc, r), r)

Uses (7)

Used by (5)