Skip to content

Make verified portable x64 the canonical CLI path - #19

Draft
Papishushi wants to merge 1 commit into
feat/semantic-binary-verifier-v0from
feat/canonical-portable-x64-cli-v0
Draft

Papishushi wants to merge 1 commit into
feat/semantic-binary-verifier-v0from
feat/canonical-portable-x64-cli-v0

Conversation

@Papishushi

@Papishushi Papishushi commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Makes verified indexed UBCM the canonical/default x64 compilation route and migrates the existing Linux module/isolation consumers onto that boundary without silent fallback to direct source -> x64 codegen.

This PR remains stacked on #18 (feat/semantic-binary-verifier-v0).

source
  -> semantic frontend
  -> indexed UBCM + boundary contracts
  -> independent semantic verifier
  -> typed decoder
  -> x64 backend
  -> verified-UBCM-driven ABI/runtime adapters

Canonical CLI route

Invoking ubytec <source.ubc> now uses PortableSourceX64Pipeline by default. --portable-x64 remains a compatibility alias. --legacy-source-x64 is the only explicit opt-in to the deprecated direct source -> x64 path, and conflicting pipeline flags fail deterministically.

--portable-module persists the exact UBCM bytes consumed by native code generation.

Portable library ABI

Library exports no longer require source names inside PortableX64Backend. The backend remains index-only (ubytec_binary_*). After verification, PortableSystemVLibraryAbi derives System V thunks from the verified UBCM export table.

--host-export Function=ubytec_host_symbol is now portable: the requested export is inserted before UBCM serialization, verified with the module, then bound to native ABI only after the verifier boundary.

Structured control and tail calls

Indexed executable v0 normalizes structured source control into portable LOOP / IF / BREAK / END operations and the x64 backend validates scope transitions and balanced function scopes.

--tail-calls is also supported by the canonical x64 route. PortableX64TailCallOptimizer operates only on verified indexed CALL + RETURN pairs and compatible UBCM signatures. It remains explicit because frame reuse changes physical frame lifetime.

Other source-backend optimization switches remain legacy-only until they have portable/backend contracts.

Runtime services and module contracts

ModuleInvoke, HostRead and HostWrite are represented as reserved ubytec.runtime imports inside UBCM. Post-verification binding maps their ImportIndex labels to the supervisor bridges; the core backend never resolves source aliases.

Source import / export declarations retain their loader-facing aliases and grant-slot metadata in the critical UBCM ContractManifest. PortableX64ModuleContractAbi parses that verified manifest, cross-checks it against the verified ImportIndex/ExportIndex tables, emits the native .ubytec_contract section and generates the corresponding ubytec_bridge_call, ubytec_bridge_many and ubytec_host_contract_* adapters. The manifest describes slots/contracts only; authority grants remain supervisor-owned.

Isolation migration exercised by this PR

The Isolation integration now runs through the canonical portable path rather than depending implicitly on the legacy source backend. The current head passes the complete Isolation mechanism prototypes workflow, including:

  • compiled Ubytec containment
  • independent module loading and tail-recursive module tests
  • calls originating in Ubytec modules
  • source imports/exports and independent permissions
  • libft module chains
  • typed scalars and LoanRead / LoanWrite
  • stateful HostIO text workloads
  • bounded allocator and incremental text
  • scoped/generic arena loans
  • arena benchmark and sustained same-caller recovery/stress

Full productionization of the capability/isolation runtime remains the next dedicated PR; this PR only ensures the canonical UBCM -> x64 route can carry and execute the existing contracts faithfully.

Legacy compatibility

Direct source -> x64 compilation remains temporarily available behind --legacy-source-x64. There is no implicit fallback from the portable route when a feature is unsupported.

Comment thread Ubytec/CommandLineDriver.cs Fixed
Comment thread Ubytec/CommandLineDriver.cs Fixed
internal string? PortableModulePath { get; set; }
internal bool EmitMetadata { get; set; } = true;
internal bool PortableX64 { get; set; } = true;
internal bool PortableX64Requested { get; set; }
@codacy-production

codacy-production Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium · 1 minor

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
BestPractice 1 medium
1 minor

View in Codacy

🟢 Metrics 283 complexity · 2 duplication

Metric Results
Complexity 283
Duplication 2

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@Papishushi
Papishushi changed the base branch from main to feat/semantic-binary-verifier-v0 October 15, 2026 14:28
@Papishushi Papishushi self-assigned this Oct 15, 2026
@Papishushi
Papishushi changed the base branch from feat/semantic-binary-verifier-v0 to main October 15, 2026 17:06
@Papishushi
Papishushi changed the base branch from main to feat/semantic-binary-verifier-v0 October 15, 2026 17:06
@Papishushi
Papishushi changed the base branch from feat/semantic-binary-verifier-v0 to main October 15, 2026 17:09
@Papishushi
Papishushi changed the base branch from main to feat/semantic-binary-verifier-v0 October 15, 2026 17:09
@Papishushi
Papishushi changed the base branch from feat/semantic-binary-verifier-v0 to main October 15, 2026 17:37
@Papishushi
Papishushi changed the base branch from main to feat/semantic-binary-verifier-v0 October 15, 2026 17:38
@Papishushi
Papishushi added this pull request to stack #13 October 15, 2026 19:34
@Papishushi
Papishushi force-pushed the feat/canonical-portable-x64-cli-v0 branch from a8622ec to 0194d1b Compare October 15, 2026 21:44
Comment thread Ubytec/Program.cs
@@ -1,3 +1,6 @@
[assembly: System.CLSCompliant(true)]
@Papishushi
Papishushi force-pushed the feat/canonical-portable-x64-cli-v0 branch from 0194d1b to 82c8714 Compare October 15, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants