writeonce/runtime/src/borrow.h
shoney.arickathil 631d277e0c feat(runtime): wovm VM core (Iteration 2)
- 16 tasks complete: arena, object model, borrow word, containers,
  RC + budgeted cycle collector, wob_build, validating loader,
  interpreter core (dual dispatch), object opcodes, drop-map unwinding,
  builtins + DB_STUB + TRAP, ICALL, wovm CLI + just recipes
- 13 test suites × 2 dispatch flavors (ASan+UBSan) + CLI smoke, all green
- .wob v1 format pinned in src/wob.h + docs/plan/oop-vm/00-wob-format.md
- wo-rt.c reference event-loop preserved for sub-project 2

This is Iteration 2 of the OOP milestone; compiler front (Iteration 3)
is in progress on this branch. They meet at Iteration 4 (emitter+e2e).
2026-08-10 09:35:55 +02:00

17 lines
708 B
C

/* borrow.h — the residual-check primitive of the hybrid model (spec §4).
* The header's borrow word counts shared readers; WO_BORROW_EXCL means
* exclusively borrowed. Acquires return 0 or -1 (the VM maps -1 to
* WO_T_BORROW); releases are unconditional — the compiler emits them
* balanced. Small on purpose: this module is the semantic heart of the
* hybrid model and the compiler's emit rules cite it. */
#ifndef WO_BORROW_H
#define WO_BORROW_H
#include "wob.h"
int wo_borrow_shared(wo_hdr *o); /* fails only against exclusive */
int wo_borrow_excl(wo_hdr *o); /* fails unless completely free */
void wo_release_shared(wo_hdr *o);
void wo_release_excl(wo_hdr *o);
#endif /* WO_BORROW_H */