SPVM::D...:System(3)

๐Ÿ“ฆ version 0.990125, in alpine 3.24

๐Ÿ’– Name ๐Ÿ’–

Bestie, welcome to SPVM::Document::Language::System(3) โ€” the System Setting in the SPVM Language page from the User Contributed Perl Documentation. This is the manual page for system settings in the SPVM language, and we're about to make it make sense. ๐Ÿ’…โœจ

๐ŸŒธ Description ๐ŸŒธ

This document describes system setting in the SPVM language. That's the whole description, bestie โ€” short and sweet, but the rest of the page is where the details live. ๐Ÿซถ

๐Ÿฆ‹ System Setting ๐Ÿฆ‹

Okay so here's the system setting section. Buckle up. ๐ŸŒˆ

๐ŸŒŠ Standard Streams ๐ŸŒŠ

SPVM opens its own standard input, standard output, and standard error for a runtime just after a runtime is built. Fresh runtime, fresh streams, no cap. โœจ

Their open modes are set to binary mode (https://learn.microsoft.com/en-us/cpp/c-runtime-library/text-and-binary-mode-file-i-o?view=msvc-170) on Windows. Yes, that's the exact link. ๐ŸชŸ

Then the operators do their thing:

  • print operator โ€” outputs to this SPVM's standard output. ๐Ÿ’–
  • say operator โ€” outputs to this SPVM's standard output. Same energy, still iconic. ๐ŸŒŸ
  • warn operator โ€” outputs to this SPVM's standard error. โš ๏ธ

๐Ÿงต Thread Safety ๐Ÿงต

The SPVM language has some thread-safe features. Not every feature, but some โ€” and here's the breakdown. ๐Ÿ’€

๐Ÿฅž Runtime Stack ๐Ÿฅž

When a new thread is created โ€” such as an OS native thread โ€” or a coroutine such as a goroutine is created, a new runtime stack should be created for the new thread. The exact line is:

SPVM_VALUE* new_stack = env->new_stack(env);

This runtime stack has thread-specific data, such as the value of the exception variable, as well as method-specific data, such as arguments and a return value. Very "main character with her own storage" of it. ๐Ÿ‘‘

When the new thread finished, the new runtime stack must be released. Like, for real, release it:

env->free_stack(env, new_stack);

Currently, user data cannot be got and set in a runtime stack. That's just the situation. ๐Ÿ™ˆ

If thread-specific user data is needed, the thread ID is got by the Thread#get_id method, and this thread ID can be a key of a hash for thread-specific user data. In this case, the Hash class is not thread safe, so a lock using a mutex is needed. Lowkey crucial, bestie. ๐Ÿ”

โš›๏ธ Atomic Operations โš›๏ธ

This section describes atomic operations. ๐Ÿ”ฅ

Generally speaking, when using OS native threads with SPVM, the following atomic operations can result in severe performance degradation. Severe performance degradation. So the advice is to minimize object creations and object assignments in newly created OS native threads. Big "keep it light" energy. ๐Ÿ“

Coroutine threads such as goroutines don't have to worry about things like this because these are synchronized. Slay for synchronized coroutines. ๐Ÿงš

๐Ÿงฎ Updating Memory Blocks Count ๐Ÿงฎ

Updating the count of allocated memory blocks is an atomic operation and thread safe. It is protected by a mutex. ๐Ÿ”’

The count of all allocated memory blocks in a runtime is managed and is got by get_memory_blocks_count native API. That's the exact native API name, iykyk. ๐Ÿ‘‘

๐Ÿ—‚๏ธ Updating Runtime Cache ๐Ÿ—‚๏ธ

Updating a runtime cache data is an atomic operation and thread safe. It is protected by a mutex. ๐Ÿ’…

๐Ÿ› ๏ธ Compilation ๐Ÿ› ๏ธ

A compilation is an atomic operation and thread safe. It is protected by a mutex. Periodt. โœจ

๐Ÿ”ข Updating Reference Count ๐Ÿ”ข

Updating the reference count of an object is an atomic operation and thread safe. It is protected by a mutex. Keep that reference count safe, bestie. ๐Ÿ’–

๐Ÿ‘€ See Also ๐Ÿ‘€

Go peek at these, no cap:

  • SPVM::Document::Language::Operators
  • SPVM::Document::Language
  • SPVM::Document

Copyright (c) 2023 Yuki Kimoto

MIT License

That's the copyright and license info, exactly as it appears. ๐ŸŽ€


And that's the whole page! It comes from perl v5.42.2, dated 2026-02-03 โ€” cute little footer sign-off delivered with a bow. ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from