RaggieScript v1.3.0
Browse Table of Contents (17 chapters)
Getting Started (2)
Language Reference (4)
Core Standard Library (3)
Windows, MSI SQL & Native FFI (3)
Wizard UI & Studio Sandboxes (3)
Diagnostics & Bytecode ISA (2)
Master Symbol Index
4 min read Module: raggiesoft.raggiescript F1: IDH_RSSC_BYTECODE (0x2010)

RSWBC2 Linear Stack Bytecode ISA & .rsw-rollback.jnl Specification

This reference documents the binary layout of RaggieScript's RSWBC2 bytecode container (RsscBytecodeIsa.hpp) and the on-disk transactional rollback journal (RaggieScriptSdk.hpp).

RSWBC2 Binary Container Header (48 Bytes + Sections)

OffsetSizeFieldDescription
0x006 bytesMagicASCII "RSWBC2" (RaggieScriptVm also loads "RSWBC1" transparently).
0x062 bytesIsaVersionLittle-endian uint16 (0x0100 = ISA v1.0).
0x084 bytesFlagsBit 0: RSW701 Wizard Verified; Bit 1: RSW702 Sandboxed Profile.
0x0C4 bytesPayloadLengthByte length of the serialized metadata + constant pool + chunk table.
0x1032 bytesSha256Digestbcrypt.dll SHA-256 digest over all PayloadLength bytes (RSW704 verified before load!).
0x30PayloadLengthSectionsPackage header metadata, struct/enum/param/feature/payload descriptors, deduplicated Constant Pool, and Linear Instruction Chunks.

Linear Stack VM Instruction Set (OpCode)

Each instruction is a fixed compact tuple (op: uint8, a: uint32, b: int32, srcLine: uint32):

OpcodeOperandsStack EffectSemantics
NOP—0No operation.
PUSH_NULL—+1Pushes null.
PUSH_BOOLb (0/1)+1Pushes false or true.
PUSH_INTa (const idx)+1Pushes 64-bit int from constant pool.
PUSH_FLOATa (const idx)+1Pushes 64-bit float from constant pool.
PUSH_STRa (const idx)+1Pushes UTF-8 string from constant pool.
PUSH_VERa (const idx)+1Pushes 4-part SemVer version.
POP—-1Discards top of stack.
LOAD_VARa (name idx)+1Resolves lexical local -> closure upvalue -> global variable.
DECL_VARa (name), b (isConst)-1Declares variable in current lexical frame with popped initializer.
STORE_VARa (name), b (assign op)0 (-1 + push)Mutates existing mutable binding (enforcing RSW713 CLI hard-locks!).
MAKE_REFa (name idx)+1Pushes two-way mutable RefVar handle for Wizard bind: / TaskDialog slots.
MAKE_ARRAYa (count)-(count) + 1Pops count elements into a new array.
MAKE_MAPa (pairCount)-(2*pairCount) + 1Pops (key, val) pairs into a map.
MAKE_STRUCTa (struct idx), b (pairCount)-(2*pairCount) + 1Hydrates struct defaults and applies explicit field initializers.
MAKE_CLOSUREa (chunk idx)+1Captures lexical environment into a first-class callable closure value.
GET_MEMBER / SET_MEMBERa (prop idx)0 / -1Reads or writes map/struct/enum/namespace property.
GET_INDEX / SET_INDEX—-1 / -2Reads or writes arr[idx] / map[key].
UNARY_OP / BINARY_OPb (op code)0 / -1Executes !, -, +, /, ==, <, SemVer compare, etc.
JUMP / JUMP_IF_FALSE / JUMP_IF_TRUE / JUMP_IF_NOT_NULLa (target IP)0 / -1Structured control-flow, short-circuit &&/||, ??, and match arms.
CALL_HOSTa (ns.method), b (argc)-(2*argc) + 1Pops named/positional (argName, argVal) pairs and invokes the 21-namespace C++20 Stdlib.
CALL_VALUEb (argc)-(2*argc)Invokes user fn, global builtin, or first-class closure value!
WIZ_STEP_BEGIN / WIZ_STEP_ENDa (step name)0Registers declarative Wizard step boundaries with RsscWizardUiEngine.
DEFER_PUSHa (defer chunk idx)0Pushes a lexical cleanup closure onto the current frame's LIFO defer stack (executed on RET or THROW).
RETURN / EXIT_SETUP / THROW—-1Runs frame defer stack in LIFO order, then returns from chunk, exits setup, or raises catchable exception.

Transactional Rollback Ledger (.rsw-rollback.jnl)

Before the first mutating operation inside install { ... }, RaggieScriptVm opens <installDir>\.rsw-rollback.jnl (with automatic fallback to %TEMP% before <installDir> exists) and flushes each pre-image record to disk before performing the OS mutation:

  1. New File / Extracted Payload (FILE_CREATED): Records path; deleted on rollback.
  2. Overwritten File / .ini / .xml / .json (FILE_OVERWRITTEN): Copies original bytes to <file>.<seq>.rswbak; restored atomically over <file> on rollback, or deleted cleanly upon commit!
  3. Created Directory (DIR_CREATED): Recorded in creation order; removed in reverse leaf-first LIFO order if empty on rollback.
  4. Registry Value (REG_CREATED / REG_OVERWRITTEN): Captures prior REG_SZ/REG_EXPAND_SZ/REG_DWORD/REG_MULTI_SZ type and bytes + RegView (64 vs 32); restores exact prior type/bytes or deletes newly added values on rollback.
  5. Services, Shortcuts, Firewall Rules & PATH Entries: Journals exact inverse removal/restoration commands—and reuses the exact same journal model inside <InstallDir>\Uninstall.rswm so Uninstall.exe leaves zero orphan keys or PATH cruft!