Skip to content
Menu
Open World News Open World News
  • Privacy Policy
Open World News Open World News

Category: Open Source

Andy Wingo: pre-initialization of garbage-collected webassembly heaps

Posted on March 10, 2023 by Michael G

Hey comrades, I just had an idea that I won’t be able to work on in the
next couple months and wanted to release it into the wild. They say if
you love your ideas, you should let them go and see if they come back to
you, right? In that spirit I abandon this idea to the woods.

Basically the idea is Wizer-like pre-initialization of WebAssembly
modules
, but for modules
that store their data on the GC-managed heap instead of just in linear
memory.

Say you have a WebAssembly module with GC
types
.
It might look like this:

(module
  (type $t0 (struct (ref eq)))
  (type $t1 (struct (ref $t0) i32))
  (type $t2 (array (mut (ref $t1))))
  ...
  (global $g0 (ref null eq)
    (ref.null eq))
  (global $g1 (ref $t1)
    (array.new_canon $t0 (i31.new (i32.const 42))))
  ...
  (function $f0 ...)
  ...)

You define some struct and array types, there are some global variables,
and some functions to actually do the work. (There are probably also
tables and other things but I am simplifying.)

If you consider the object graph of an instantiated module, you will
have some set of roots R that point to GC-managed objects. The live
objects in the heap are the roots and any object referenced by a live
object.

Let us assume a standalone WebAssembly module. In that case the set of
types T of all objects in the heap is closed: it can only be one of the
types $t0, $t1, and so on that are defined in the module. These
types have a partial order and can thus be sorted from most to least
specific. Let’s assume that this sort order is just the reverse of the
definition order, for now. Therefore we can write a general type
introspection function for any object in the graph:

(func $introspect (param $obj anyref)
  (block $t2 (ref $t2)
    (block $t1 (ref $t1)
      (block $t0 (ref $t0)
        (br_on_cast $t2 (local.get $obj))
        (br_on_cast $t1 (local.get $obj))
        (br_on_cast $t0 (local.get $obj))
        (unreachable))
      ;; Do $t0 things...
      (return))
    ;; Do $t1 things...
    (return))
  ;; Do $t2 things...
  (return))

In particular, given a WebAssembly module, we can generate a function to
trace edges in an object graph of its types. Using this, we can
identify all live objects, and what’s more, we can take a snapshot of
those objects:

(func $snapshot (result (ref (array (mut anyref))))
  ;; Start from roots, use introspect to find concrete types
  ;; and trace edges, use a worklist, return an array of
  ;; all live objects in topological sort order
  )

Having a heap snapshot is interesting for introspection purposes, but my
interest is in having fast start-up. Many programs have a kind of
“initialization” phase where they get the system up and running, and
only then proceed to actually work on the problem at hand. For example,
when you run python3 foo.py, Python will first spend some time parsing
and byte-compiling foo.py, importing the modules it uses and so on,
and then will actually run foo.py‘s code. Wizer lets you snapshot the
state of a module after initialization but before the real work begins,
which can save on startup time.

For a GC heap, we actually have similar possibilities, but the mechanism
is different. Instead of generating an array of all live objects, we
could generate a serialized state of the heap as bytecode, and another
function to read the bytecode and reload the heap:

(func $pickle (result (ref (array (mut i8))))
  ;; Return an array of bytecode which, when interpreted,
  ;; can reconstruct the object graph and set the roots
  )
(func $unpickle (param (ref (array (mut i8))))
  ;; Interpret the bytecode, building object graph in
  ;; topological order
  )

The unpickler is module-dependent: it will need one case to construct
each concrete type $tN in the module. Therefore the bytecode
grammar would be module-dependent too.

What you would get with a bytecode-based $pickle/$unpickle pair
would be the ability to serialize and reload heap state many times. But
for the pre-initialization case, probably that’s not precisely what you
want: you want to residualize a new WebAssembly module that, when
loaded, will rehydrate the heap. In that case you want a function like:

(func $make-init (result (ref (array (mut i8))))
  ;; Return an array of WebAssembly code which, when
  ;; added to the module as a function and invoked, 
  ;; can reconstruct the object graph and set the roots.
  )

Then you would use binary tools to add that newly generated function to
the module.

In short, there is a space open for a tool which takes a WebAssembly+GC
module M and produces M’, a module which contains a $make-init
function. Then you use a WebAssembly+GC host to load the module and
call the $make-init function, resulting in a WebAssembly function
$init which you then patch in to the original M to make M”, which is
M pre-initialized for a given task.

Optimizations

Some of the object graph is constant; for example, an instance of a
struct type that has no mutable fields. These objects don’t have to
be created in the init function; they can be declared as new constant
global variables, which an engine may be able to initialize more
efficiently.

The pre-initialized module will still have an initialization phase in
which it builds the heap. This is a constant function and it would be
nice to avoid it. Some WebAssembly hosts will be able to run
pre-initialization and then snapshot the GC heap using lower-level facilities (copy-on-write mappings, pointer compression and relocatable cages, pre-initialization on an internal level…). This would potentially decrease latency and may allow for cross-instance memory sharing.

Limitations

There are five preconditions to be able to pickle and unpickle the GC
heap:
1. The set of concrete types in a module must be closed.
2. The roots of the GC graph must be enumerable.
3. The object-graph edges from each live object must be enumerable.
4. To prevent cycles, we have to know when an object has been visited:
objects must have identity.
5. We must be able to create each type in a module.

I think there are three limitations to this pre-initialization idea in
practice.

One is externref; these values come from the host and are by
definition not introspectable by WebAssembly. Let’s keep the
closed-world assumption and consider the case where the set of external
reference types is closed also. In that case if a module allows for
external references, we can perhaps make its pickling routines call out
to the host to (2) provide any external roots (3) identify edges on
externref values (4) compare externref values for identity and (5)
indicate some imported functions which can be called to re-create
exernal objects.

Another limitation is funcref. In practice in the current state of
WebAssembly and GC, you will only have a funcref which is created by
ref.func, and which (3) therefore has no edges and (5) can be
re-created by ref.func. However neither WebAssembly nor the JS API
has no way of knowing which function index corresponds to a given
funcref. Including function references in the graph would therefore
require some sort of host-specific API. Relatedly, function references
are not comparable for equality (func is not a subtype of eq), which
is a little annoying but not so bad considering that function references
can’t participate in a cycle. Perhaps a solution though would be to
assume (!) that the host representation of a funcref is constant: the
JavaScript (e.g.) representations of (ref.func 0) and (ref.func 0)
are the same value (in terms of ===). Then you could compare a given
function reference against a set of known values to determine its index.
Note, when function references are expanded to include closures, we will
have more problems in this area.

Finally, there is the question of roots. Given a module, we can
generate a function to read the values of all reference-typed globals
and of all entries in all tables. What we can’t get at are any
references from the stack, so our object graph may be incomplete.
Perhaps this is not a problem though, because when we unpickle the graph
we won’t be able to re-create the stack anyway.

OK, that’s my idea. Have at it, hackers!

VPN trust requires free software

Posted on March 10, 2023 by Michael G

VPNs have become popular and are often touted as a tool to improve privacy.
While this is sometimes true, it is important to tread carefully when
choosing an VPN. A good place to start is looking at which VPN providers
meet the
requirements
for running a trustworthy VPN service. A trustworthy VPNs must be free
software, that is non-negotiable. First, inspection is required in order
trust software. Having the source is the only way to see all the things the
software is doing. F-Droid reviews the apps that we ship on this website,
which lets us spot potential issues and anti-features. And we are happy to
hear that reputable VPN providers make the effort to get their apps on
f-droid.org to build trust with their users. From there, Reproducible
Builds
provides a strong link
between the source code and the actual app binaries that run on the device.

The best VPNs are the ones that use free software both for the client app,
and for running the services. Indeed all OpenVPN, Shadowsocks, and
WireGuard VPNs are based on free software since those standards are defined
by free software projects. F-Droid looks into this as part of the reviews,
and marks apps with relevant Anti-Features, like the Non-Free Network
Services
mark if the
server side is not free software. And there are a number of free software
projects that make it a lot easier to setup and run a VPN or proxy
services. Here are some that are on f-droid.org:

  • Bitmask is a
    generic client for the LEAP VPN setup which powers
    Calyx VPN, Riseup
    VPN
    , and more.
  • eduVPN is a VPN client for
    Let’s Connect VPN setup which powers
    eduVPN.
  • OpenVPN for Android is
    a generic OpenVPN client for any VPN provider that offers it.
  • Outline is an
    offering designed to let anyone run their own VPN based on Shadowsocks.
  • WireGuard is a
    generic WireGuard client for any provider
    that offers it.

So far, none of the VPN providers have taken the plunge into fully
supporting reproducible builds. There is some progress: some of the releases
of WireGuard,
Tailscale, and
Mysterium VPN
have been reproduced on our verification server. But these apps are not
setup for the full reproducible publishing setup, which confirms that the
f-droid.org version matches the upstream developer’s version exactly, then
publishes with the upstream signature. The F-Droid community is helping
more and more apps achieve reproducible builds, which VPN app will be the
first?

There are also a number of apps that are dedicated to a given provider.
Although there are generic clients available, there are good reasons for a
free software provider to ship a custom app. First, it can make
configuration dead simple. Calyx VPN and Riseup VPN have no accounts at
all, so just install the app, and turn on the VPN. Second, it allows the
provider to include multiple methods of connecting and automatically switch
between them, depending on what works best. We decide which apps to include
based on what is best for the users. A VPN client that offers no additional
functionality and just serves as a rebrand of an existing client does not
serve users well. In order for an app from a specific provider to be
included, it must provide real value to our users. Here is a list of some
related examples:

  • IVPN
  • Lavabit Encrypted
    Proxy
  • Mullvad VPN
  • Mysterium VPN
  • ProtonVPN
  • Purism Librem Tunnel

We also get lots of direct messages asking us to include various proprietary
VPN apps, or promote various VPN services for a fee. That is of course a
non-starter. The first step is free software.

Recap/Summary of the Digital Market Act workshop in Brussels

Posted on March 10, 2023 by Michael G
Recap/Summary of the Digital Market Act workshop in Brussels

This Monday, I was in Brussels to attend a stakeholder workshop for the Digital Market…

Tanshi VM | Stereo Hearts X Zaalima | Rishi Tanuja | Kasam Tere Pyaar Ki | SN Queen Official

Posted on March 9, 2023 by Michael G

Video by via Dailymotion Source (To watch more vms / watch all the previous SN Queen vms , request vms etc)Click on the below link and join my DIscord Server! My discord Server Link https://www.discord.gg/cBMghA3 (Check About section of my Channel as well) ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯ My Instagram Account https://www.instagram.com/sn.queen.nadeesha/ ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃ Which couple(s) is/are your favorite(s)? COMMENT…

Toggle Switch for Dark Mode using HTML, CSS & JavaScript

Posted on March 9, 2023 by Michael G

Video by via Dailymotion Source This tutorial demonstrates how to create a toggle switch button that allows users to switch between dark and light modes on a website. The tutorial will typically cover the steps involved in using HTML to create the toggle switch button, CSS to style the button and toggle the background color,…

Letônia envia veículos apreendidos à Ucrânia

Posted on March 9, 2023 by Michael G

Video by via Dailymotion Source Parlamentares da Letônia tiveram uma nova ideia para reduzir a direção sob efeito de bebida alcoólica no país – ao mesmo tempo em que aumentam o apoio do país à Ucrânia. Assista ao Jornal da Manhã completo: https://www.youtube.com/watch?v=-WOAO3LLasQ Baixe o app Panflix: https://www.panflix.com.br/ Baixe o AppNews Jovem Pan na Google…

Minecraft Battle_ NOOB vs PRO vs HACKER vs GOD_ DEEPEST TUNNEL HOUSE BUILD CHALLENGE _ Animation

Posted on March 9, 2023 by Michael G

Video by via Dailymotion Source Welcome to TEN – Minecraft Animations!On this channel you will find tons of Minecraft Noob vs Pro vs Hacker vs God and Herobrine videos. Build Battle and Building Tutorials!Subscribe and leave a like bro for more noob vs pro animation Go to Source

ARY News Headlines | 5 PM | 9th March 2023

Posted on March 9, 2023 by Michael G

Video by via Dailymotion Source #ImranKhan #MaryamNawaz #PEMRA #ARYNewsHeadlines – LHC suspends PEMRA notification banning Imran Khan’s speeches. – Staff level agreement with IMF expected in next two days: Dar -Misguided elements cannot shake Baloch people’s resolve: COAS -Punjab Assembly elections on April 30: ECP ARY News is a leading Pakistani news channel that promises…

BREAKING: Muhyiddin arrested by MACC

Posted on March 9, 2023 by Michael G

Video by via Dailymotion Source Former prime minister Muhyiddin Yassin has been arrested by the Malaysian Anti-Corruption Commission (MACC) at its headquarters. Read More: https://www.freemalaysiatoday.com/category/nation/2023/03/09/muhyiddin-arrested-by-macc/ Laporan Lanjut: https://www.freemalaysiatoday.com/category/bahasa/tempatan/2023/03/09/muhyiddin-ditahan/ Free Malaysia Today is an independent, bi-lingual news portal with a focus on Malaysian current affairs. Subscribe to our channel – http://bit.ly/2Qo08ry ——————————————————————————————————————————————————Check us out at https://www.freemalaysiatoday.comFollow…

आजची News Live: फडणवीसांच्या बजेटमधून कोणाला काय मिळालं? Maharashtra Budget 2023

Posted on March 9, 2023 by Michael G

Video by via Dailymotion Source आजची News Live: फडणवीसांच्या बजेटमधून कोणाला काय मिळालं? Maharashtra Budget 2023 #MahaBudget2023 #budget2023 #maharashtranews #lokmat Subscribe to Our Channel https://www.youtube.com/user/LokmatNews?sub_confirmation=1 आमचा video आवडल्यास धन्यवाद. Like, Share and Subscribe करायला विसरू नका! मित्रांसोबत गप्पा मारताना विश्वसनीय, संशोधनावर आधारीत माहिती सादर करायची असेल तर लोकमतचे चॅनल सबस्क्राईब करा. कारण या चॅनलवर तुम्हाला…

  • Previous
  • 1
  • …
  • 1,148
  • 1,149
  • 1,150
  • 1,151
  • 1,152
  • 1,153
  • 1,154
  • …
  • 1,529
  • Next

Recent Posts

  • SmartEsq has launched an AI-powered MFN Election tool
  • Open Source email Clients
  • When and how to use benchmarking
  • How Plotly AI revolutionizes the dashboard development process
  • [TUT] LoRa & LoRaWAN – MikroTik wAP LR8 kit mit The Things Network verbinden [4K | DE]

Categories

  • Android
  • Linux
  • News
  • Open Source
©2025 Open World News | Powered by Superb Themes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT