Blaise v0.13.0 β Concurrency, Closures, and a Second Operating System π #178
graemeg
announced in
Announcements
Replies: 2 comments 4 replies
-
|
@graeme Now that |
Beta Was this translation helpful? Give feedback.
4 replies
-
|
Really interesting project! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
v0.13.0 is our biggest cycle yet β 266 commits since v0.12.0 β and it moves
Blaise from "a self-hosting Pascal compiler" towards "a self-hosting Pascal
compiler you can build real networked, concurrent software with". Three
themes carry the release: a fibre-based async runtime with an Indy-class
networking stack, anonymous methods and closures, and a second target
operating system, FreeBSD. All of it is verified by our four self-hosting
fixpoints and a suite that has grown to 4275 tests.
π§΅ A fibre runtime and a full networking stack
The headline of the cycle. Blaise now has a proper asynchronous runtime built
on stackful fibres β cheap, cooperatively-scheduled tasks β layered from the
ground up: a context-switch primitive (L0), a single- then multi-worker
work-stealing scheduler with structured-concurrency nurseries (L1), an
epoll readiness reactor (L2), fibre-aware I/O primitives (L3), and a TLS
provider over OpenSSL memory BIOs (L4).
On top of that sits an Indy-class networking library (L5):
Net.Tcp,Net.Tls,Net.Uri, an HTTP/1.1 client and keep-alive server, RFC 6455WebSockets (client and server), and a full sweep of internet protocol
clients β SMTP, POP3, IMAP4rev1, FTP (with a passive-mode server), and NNTP
(client and server). Every one is fibre-native, so thousands of connections
share a handful of OS threads.
Structured concurrency means you spawn a group of tasks and the nursery waits
for β and cancels β them as a unit, with a fibre-root exception frame so a
failing task unwinds cleanly.
πͺ Anonymous methods and closures
Blaise gained first-class anonymous methods across ten implementation
phases:
reference tofunction/procedure types, closures that capture outerlocals (strongly, with a
[Weak Self]escape hatch), per-iteration capture inloops, and composition with generics.
We also added terse
->lambdas and a small LINQ-lite vocabulary onTList<T>, so filtering and transforming collections reads naturally:π‘ FreeBSD is now a first-class target
Blaise self-hosts on FreeBSD x86_64 β and cross-compiles between Linux and
FreeBSD in either direction using no external tools or packages. The internal
assembler and linker emit the foreign binary directly, and the byte-for-byte
self-hosting fixpoint is verified on both operating systems in CI. Target
selection is driven by
--target, which picks the per-OS RTL layout, syscallleaves, and conditional-compilation defines.
ποΈ Static members and richer units
Classes and records gained static (class-level) members β
static var,static function, and static properties β with full cross-unit support:Unit handling matured too: unit-qualified references (
UnitName.Symbol),cross-unit "last-in-uses wins" for types, consts and vars, type-directed
resolution of bare and qualified enum members, forward class/interface
declarations, and named integer subranges as array index types. Custom
attributes are now reified with method-level attributes and constructor
arguments, and there is an inline assembler (
asm β¦ endroutine bodies).π§± One binary, no archive β and libc-free static binaries
We completed the RTL unification: the runtime now lives in the compiler's
own source tree and is built from source on every link path, assembled by
Blaise's internal assembler. The legacy
blaise_rtl.aarchive is no longeron any self-host link line. (If you build from source via the opt-in QBE
backend, see the updated README β link the loose RTL objects with
build-rtl-objects.sh --exclude-defined-by, not the archive.)Blaise can also now emit fully static, libc-free binaries on Linux via
direct syscalls β a freestanding
_start, syscall-backed libc leaves, andstatic TLS β the same foundation that made the FreeBSD port possible.
π‘οΈ Hardening
95 fixes landed this cycle. A large batch tightened ARC correctness
(transient releases, static-array-of-interface elements, nested-proc capture of
var-param records) and codegen on both backends (float/integer width at
store sites, unsigned zero-extension, record-return ABI, itab dispatch of
record-returning methods). Two recent, community-reported issues are fixed:
a clear error for the legacy bare-
beginunit body (#172), and the QBEbuild-from-source link that failed with duplicate
TRtlPlatformsymbols(#174).
π§ͺ Real programs, not just tests
Two standalone Blaise projects landed alongside the compiler this cycle β both
are on GitHub, both build with v0.13.0:
blaise-microservice-demo β
a port of the Java Virtual Threads "API aggregator" demo. An HTTP server whose
/aggregateendpoint fans out three downstream calls (2 s each) that completein ~2 s wall-clock, not 6 s, using the fibre
TTaskGroupnursery and theM:N scheduler. It ships with a mini-Gatling load generator that ramps to
6000 concurrent virtual users on a handful of OS threads β no framework, no
GC, an instant-start ~3 MB native binary. The README puts the Blaise and Java
versions side by side; the code reads exactly like blocking code.
luhmann β a
Zettelkasten note server written
entirely in Blaise. It turns a directory of AsciiDoc notes into a linked web
of pages served over HTTP, with an interactive note graph and a JSON API β
and renders the whole collection concurrently at start-up, so even a large
Zettelkasten is ready in a second or two.
Both are great starting points if you want to see the async stack and stdlib
used in anger.
π By the numbers
Grab the release from the GitHub releases page, and see
here for the full technical detail.
Thank you to everyone who filed issues and tried the builds this cycle β the
FreeBSD port and many fixes came straight from community testing.
Onwards to v0.14.0! π
Built with β€ for the Pascal community.
Beta Was this translation helpful? Give feedback.
All reactions