* . *
  • About
  • Advertise
  • Privacy & Policy
  • Contact
Friday, July 25, 2025
Earth-News
  • Home
  • Business
  • Entertainment
    Black Box Players presents ‘The Three Musketeers’ – CBS 19 News

    Experience the Adventure: Black Box Players Bring ‘The Three Musketeers’ to Life!

    AP Entertainment SummaryBrief at 1:51 p.m. EDT – Channel 3000

    Entertainment Highlights: Key Updates You Can’t Miss

    ‘Devil Wears Prada 2’ casts Anne Hathaway’s love interest replacing Adrian Grenier’s Nate – Entertainment Weekly

    Devil Wears Prada 2′ Casts New Love Interest for Anne Hathaway, Replacing Adrian Grenier’s Nate

    12 ‘Late Show’ Moments Proving Stephen Colbert Can’t Be Replaced – The Mountaineer

    12 Unforgettable ‘Late Show’ Moments That Prove Stephen Colbert Is Truly One of a Kind

    Canes owner Tom Dundon’s real estate firm eyes entertainment complex near RDU – The Business Journals

    Canes Owner Tom Dundon’s Real Estate Firm Unveils Plans for Thrilling New Entertainment Complex Near RDU

    Inspired Entertainment, Inc.’s (NASDAQ:INSE) Price Is Right But Growth Is Lacking After Shares Rocket 29% – simplywall.st

    Inspired Entertainment Soars 29% but Growth Momentum Falls Short

  • General
  • Health
  • News

    Cracking the Code: Why China’s Economic Challenges Aren’t Shaking Markets, Unlike America’s” – Bloomberg

    Trump’s Narrow Window to Spread the Truth About Harris

    Trump’s Narrow Window to Spread the Truth About Harris

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Science
  • Sports
  • Technology
    Google Cloud Announced as a Key Technology Partner for Odoo Connect 2025 in San Francisco – GlobeNewswire

    Google Cloud Announced as a Key Technology Partner for Odoo Connect 2025 in San Francisco – GlobeNewswire

    Behind the Screens: The Impact of Technology on Real Estate – TRREB

    Behind the Screens: How Technology is Transforming the Future of Real Estate

    Sustainserv and Palau Announce Technology Partnership to Leverage Innovative AI Platform to Advance Sustainability Reporting – Business Wire

    Sustainserv and Palau Team Up to Transform Sustainability Reporting with Breakthrough AI Technology

    Morgan Adamski Joins PwC in Newly Created Cyber, Data & Technology Risk Division – HSToday

    Morgan Adamski Leads the Charge in PwC’s Cutting-Edge Cyber, Data & Technology Risk Division

    Transformative technology, support for food entrepreneurs spotlighted – University of Hawaii System

    How Cutting-Edge Technology and Strong Support Are Revolutionizing Food Entrepreneurs’ Success

    Cold Weather Alloy Opens New Possibilities for Space Technology – Universe Today

    Revolutionary Cold Weather Alloy Unlocks New Frontiers in Space Technology

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
  • Home
  • Business
  • Entertainment
    Black Box Players presents ‘The Three Musketeers’ – CBS 19 News

    Experience the Adventure: Black Box Players Bring ‘The Three Musketeers’ to Life!

    AP Entertainment SummaryBrief at 1:51 p.m. EDT – Channel 3000

    Entertainment Highlights: Key Updates You Can’t Miss

    ‘Devil Wears Prada 2’ casts Anne Hathaway’s love interest replacing Adrian Grenier’s Nate – Entertainment Weekly

    Devil Wears Prada 2′ Casts New Love Interest for Anne Hathaway, Replacing Adrian Grenier’s Nate

    12 ‘Late Show’ Moments Proving Stephen Colbert Can’t Be Replaced – The Mountaineer

    12 Unforgettable ‘Late Show’ Moments That Prove Stephen Colbert Is Truly One of a Kind

    Canes owner Tom Dundon’s real estate firm eyes entertainment complex near RDU – The Business Journals

    Canes Owner Tom Dundon’s Real Estate Firm Unveils Plans for Thrilling New Entertainment Complex Near RDU

    Inspired Entertainment, Inc.’s (NASDAQ:INSE) Price Is Right But Growth Is Lacking After Shares Rocket 29% – simplywall.st

    Inspired Entertainment Soars 29% but Growth Momentum Falls Short

  • General
  • Health
  • News

    Cracking the Code: Why China’s Economic Challenges Aren’t Shaking Markets, Unlike America’s” – Bloomberg

    Trump’s Narrow Window to Spread the Truth About Harris

    Trump’s Narrow Window to Spread the Truth About Harris

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Science
  • Sports
  • Technology
    Google Cloud Announced as a Key Technology Partner for Odoo Connect 2025 in San Francisco – GlobeNewswire

    Google Cloud Announced as a Key Technology Partner for Odoo Connect 2025 in San Francisco – GlobeNewswire

    Behind the Screens: The Impact of Technology on Real Estate – TRREB

    Behind the Screens: How Technology is Transforming the Future of Real Estate

    Sustainserv and Palau Announce Technology Partnership to Leverage Innovative AI Platform to Advance Sustainability Reporting – Business Wire

    Sustainserv and Palau Team Up to Transform Sustainability Reporting with Breakthrough AI Technology

    Morgan Adamski Joins PwC in Newly Created Cyber, Data & Technology Risk Division – HSToday

    Morgan Adamski Leads the Charge in PwC’s Cutting-Edge Cyber, Data & Technology Risk Division

    Transformative technology, support for food entrepreneurs spotlighted – University of Hawaii System

    How Cutting-Edge Technology and Strong Support Are Revolutionizing Food Entrepreneurs’ Success

    Cold Weather Alloy Opens New Possibilities for Space Technology – Universe Today

    Revolutionary Cold Weather Alloy Unlocks New Frontiers in Space Technology

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
Earth-News
No Result
View All Result
Home Technology

Bytecode VMs in Surprising Places

April 30, 2024
in Technology
Bytecode VMs in Surprising Places
Share on FacebookShare on Twitter

April 30, 2024

In response to a question on Twitter1, Richard Hipp wrote about why SQLite uses a bytecode VM for executing SQL statements.

Most people probably associate bytecode VMs with general-purpose programming languages, like JavaScript or Python. But sometimes they appear in surprising places! Here are a few that I know about.

eBPF

Did you know that inside the Linux kernel, there’s an extension mechanism that includes a bytecode interpreter and a JIT compiler?

I had no idea. Well, it’s called eBPF, and it’s pretty interesting: a register-based VM with ten general-purpose registers and over a hundred different opcodes.

The “BPF” in eBPF stands for Berkeley packet filter, and the basic idea is described in a 1993 USENIX paper:

Many versions of Unix provide facilities for user-level packet capture, making possible the use of general purpose workstations for network monitoring. Because network monitors run as user-level processes, packets must be copied across the kernel/user-space protection boundary. This copying can be minimized by deploying a kernel agent called a packet filter, which discards unwanted packets as early as possible. The original Unix packet filter was designed around a stack-based filter evaluator that performs sub-optimally on current RISC CPUs. The BSD Packet Filter (BPF) uses a new, register-based filter evaluator that is up to 20 times faster than the original design.

So it was originally designed for a pretty restricted use case: a directed, acyclic control flow graph representing a filter function for network packets. And for a long time, the Linux implementation was equally simple: two general-purpose registers, a switch-style interpreter, and no backwards branches.

A patch in 2011 added a JIT compiler for x86-64. In 2012, the first non-networking use case appeared. Then, in 2014, the BPF implementation was substantially extended on its way to becoming the universal in-kernel virtual machine:

It expands the set of available registers from two to ten, adds a number of instructions that closely match real hardware instructions, implements 64-bit registers, makes it possible for BPF programs to call a (rigidly controlled) set of kernel functions, and more. Internal BPF is more readily compiled into fast machine code and makes it easier to hook BPF into other subsystems.

DWARF expressions

DWARF is a file format used by compilers like GCC and LLVM to include debug information in compiled binaries. Say you’re trying to debug the following C++ code:

void add_two(int x)
{
int ans=x + 2;
return ans + 2; // Oops!
}

In a debugger, you might want to print the value of the ans variable. But depending on the compiler and the code, this could be surprisingly difficult! It could be in a register, on the stack, or it might have been optimized away (to name just a few possibilities).

The solution is allow the compiler to specify an expression that will compute the value of the local variable. So the DWARF spec includes an expression language:

2.5 DWARF Expressions

DWARF expressions describe how to compute a value or specify a location. They are expressed in terms of DWARF operations that operate on a stack of values.

A DWARF expression is encoded as a stream of operations, each consisting of an opcode followed by zero or more literal operands. The number of operands is implied by the opcode.

It’s up to the debugger to evaluate the expressions. GDB and LLDB both have a switch-based interpreter for DWARF expressions.2

GDB agent expressions

But it turns out that GDB has another bytecode interpreter!

Using GDB’s trace and collect commands, the user can specify locations in the program, and arbitrary expressions to evaluate when those locations are reached.

When GDB is debugging a remote target, the GDB agent code running on the target computes the values of the expressions itself. To avoid having a full symbolic expression evaluator on the agent, GDB translates expressions in the source language into a simpler bytecode language, and then sends the bytecode to the agent; the agent then executes the bytecode, and records the values for GDB to retrieve later.

The bytecode language is simple; there are forty-odd opcodes, the bulk of which are the usual vocabulary of C operands (addition, subtraction, shifts, and so on) and various sizes of literals and memory reference operations. The bytecode interpreter operates strictly on machine-level values — various sizes of integers and floating point numbers — and requires no information about types or symbols; thus, the interpreter’s internal data structures are simple, and each bytecode requires only a few native machine instructions to implement it. The interpreter is small, and strict limits on the memory and time required to evaluate an expression are easy to determine, making it suitable for use by the debugging agent in real-time applications.

(From Debugging with GDB, Appendix F: The GDB Agent Expression Mechanism)

WinRAR

WinRAR3 is a file compression utility for Windows with a proprietary file format. Tavis Ormandy, a vulnerability researcher at Google, discovered that the RAR format includes a bytecode encoding for data transformation:

Believe it or not, RAR files can contain bytecode for a simple x86-like virtual machine called the RarVM. This is designed to provide filters (preprocessors) to perform some reversible transformation on input data to increase redundancy, and thus improve compression.

His rarvmtools repo includes some details on the architecture:

Familiarity with x86 (and preferably intel assembly syntax) would be an advantage.

RarVM has 8 named registers, called r0 to r7. r7 is used as a stack pointer for stack related operations (such as push, call, pop, etc). However, as on x86, there are no restrictions on setting r7 to whatever you like, although if you do something stack related it will be masked to fit within the address space for the duration of that operation.

Some others:

The TrueType font specification includes a set of over 200 instructions used for glyph rendering and hinting.
PostScript is not only a page description language, but a relatively powerful stack-based programming language. PostScript files are plain text, so a PostScript renderer doesn’t necessarily use bytecode, but the spec also includes a binary encoding.

👉 Discuss on Hacker News.

>>> Read full article>>>
Copyright for syndicated content belongs to the linked Source : Hacker News – https://dubroy.com/blog/bytecode-vms-in-surprising-places/

Tags: Bytecodesurprisingtechnology
Previous Post

Show HN: I made a CLI tool to create web extensions with no build configuration

Next Post

Pyinfra: Automate Infrastructure Using Python

AdvaMed in Action: Digital Health in the Spotlight at The MedTech Conference 2025 – AdvaMed® – Advanced Medical Technology Association®

Digital Health Takes Center Stage at The MedTech Conference 2025

July 25, 2025
Netanyahu, weighing in on New York mayoral race, rips Mamdani’s proposals as ‘stupid’ – CNN

Netanyahu, weighing in on New York mayoral race, rips Mamdani’s proposals as ‘stupid’ – CNN

July 25, 2025
Google Cloud Announced as a Key Technology Partner for Odoo Connect 2025 in San Francisco – GlobeNewswire

Google Cloud Announced as a Key Technology Partner for Odoo Connect 2025 in San Francisco – GlobeNewswire

July 24, 2025
The year of the women’s-sports bar – The Economist

The year of the women’s-sports bar – The Economist

July 24, 2025
Threat reduction must be coupled with targeted recovery programmes to conserve global bird diversity – Nature

Threat reduction must be coupled with targeted recovery programmes to conserve global bird diversity – Nature

July 24, 2025
Three Recent Texas Science Graduates Receive Fulbright U.S. Student Awards – College of Natural Sciences

Three Texas Science Graduates Honored with Prestigious Fulbright U.S. Student Awards

July 24, 2025
An Extra Sense May Connect Gut Bacteria With Our Brain – ScienceAlert

An Extra Sense May Connect Gut Bacteria With Our Brain – ScienceAlert

July 24, 2025
Nutrition and lifestyle hold the key to overcoming obesity risk – The Hans India

Unlock the Secret to Beating Obesity: How Nutrition and Lifestyle Transform Your Health

July 24, 2025
He ‘found his place in the world’ through football. Then came 15 years of suffering – The New York Times

From Football Dreams to 15 Years of Unyielding Struggle: One Man’s Journey to Finding His Place in the World

July 24, 2025
How Nuclear Fusion Could Revive This State’s Startup Economy – Inc.com

How Nuclear Fusion Could Spark a Revival in This State’s Startup Scene

July 24, 2025

Categories

Archives

July 2025
MTWTFSS
 123456
78910111213
14151617181920
21222324252627
28293031 
« Jun    
Earth-News.info

The Earth News is an independent English-language daily published Website from all around the World News

Browse by Category

  • Business (20,132)
  • Ecology (737)
  • Economy (760)
  • Entertainment (21,642)
  • General (16,082)
  • Health (9,799)
  • Lifestyle (768)
  • News (22,149)
  • People (762)
  • Politics (770)
  • Science (15,976)
  • Sports (21,258)
  • Technology (15,743)
  • World (743)

Recent News

AdvaMed in Action: Digital Health in the Spotlight at The MedTech Conference 2025 – AdvaMed® – Advanced Medical Technology Association®

Digital Health Takes Center Stage at The MedTech Conference 2025

July 25, 2025
Netanyahu, weighing in on New York mayoral race, rips Mamdani’s proposals as ‘stupid’ – CNN

Netanyahu, weighing in on New York mayoral race, rips Mamdani’s proposals as ‘stupid’ – CNN

July 25, 2025
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2023 earth-news.info

No Result
View All Result

© 2023 earth-news.info

No Result
View All Result

© 2023 earth-news.info

Go to mobile version