frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

A glimpse into V8 development for RISC-V

https://riseproject.dev/2025/12/09/a-glimpse-into-v8-development-for-risc-v/
55•floitsch•1d ago

Comments

brucehoult•4w ago
Quote, because unlike on Reddit I couldn't figure out how to do multi para > quotes with code here.

------

Compressed pointers reduce the need for memory by storing pointers as 32-bit unsigned offsets relative to a base register. Decompressing the pointers just consists of adding the offset and register together. As simple as this sounds, it comes with a small complication on our RISC-V 64-bit port. By construction, 32-bit values are always loaded into the 64-bit registers as signed values. This means that we need to zero-extend the 32-bit offset first. Until recently this was done by bit-anding the register with 0xFFFF_FFFF:

    li   t3,1
    slli t3, t3, 32
    addi t3, t3, -1
    and  a0, a0, t3
Now, this code uses the `zext.w` instruction from the Zba extension:

    zext.w a0, a0
-----

This is so strange. Does no one at Google know RISC-V? This has *never* needed more than...

    slli a0, a0, 32
    srli a0, a0, 32
And if they're going to use `Zba`, and zero-extend it and then add it to another register, then why use a separate `zext.w` instruction and `add` instead of ...

    add.uw decompressed, compressed, base
... to zero extend and add in one instruction??

After all, `zext.w` is just an alias for `add.uw` with the `zero` register as the last argument...

They also could have always simply stored the 32 bit offset as signed and pointed the base register 2GB into the memory area instead of using x86/Arm-centric design.

spankalee•1d ago
> Does no one at Google know RISC-V?

These are not current Googlers.

floitsch•12h ago
You are absolutely right, and a follow-up CL fixed the non-Zba code path. At the time of writing of the blog post, the generated code was however still using the 4 instructions instead of just two.

V8 is a huge project and ports almost have to start from backends of existing architectures. Over time we (I recently worked on the RISC-V port) improve the situation.

Note that it's also crucial to stay somehow similar to the x86 and ARM backends as the V8 team frequently makes changes to these and keeping up with them would be a nightmare if the RISC-V backend was too different.

"Does no one at Google know RISC-V" This work wasn't done by Google. Also, you don't hire RISC-V experts, but V8 experts (or other similar VMs) for such a port. I, for example, had never worked with RISC-V before. As such, it can happen that some code of the RISC-V backend is written by engineers that aren't yet experts in RISC-V.

dzaima•12h ago
And, even if not that, the 0x0000_0000_FFFF_FFFF constant could be generated via 2 instrs of

    li    a0, -1
    srli  a0, a0, 32
That said, codegen of constants in RISC-V is a whole insane crazy art-form to do well (especially for a JIT where "try a hundred different strategies" means slow compilation), all to have the hardware rediscover what was already perfectly-known in the first place. (granted, there's a size benefit in cases where there is a good compact form)
jhallenworld•9h ago
>V8 emits a near-jump for all forward jumps. If the target ends up too far away, the near-jump target is adjusted to a jump pool entry that contains a long-jump to the actual target

This sounds weird to me... Why not assume that all jumps need to be long to start with (so that the code is valid), then relax them to short jumps during an N-pass optimization stage- so that you get the smallest possible code?

dzaima•23m ago
Sounds like it's probably emitting the machine code in a single pass (compilation speed matters for a browser JIT), perhaps even together in a single pass with lowering (so don't even know the amount of instructions beforehand), and for such adjusting things afterwards would mean parsing & rewriting bytecode, and adjusting already-hardcoded backwards jump distances.

Project Patchouli: Open-source electromagnetic drawing tablet hardware

https://patchouli.readthedocs.io/en/latest/
233•ffin•6h ago•20 comments

A closer look at a BGP anomaly in Venezuela

https://blog.cloudflare.com/bgp-route-leak-venezuela/
146•ChrisArchitect•4h ago•45 comments

The Napoleon Technique: Postponing things to increase productivity

https://effectiviology.com/napoleon/
92•Khaine•3d ago•40 comments

Kernel bugs hide for 2 years on average. Some hide for 20

https://pebblebed.com/blog/kernel-bugs
177•kmavm•9h ago•68 comments

Open Infrastructure Map

https://openinframap.org
190•efskap•7h ago•40 comments

Eat Real Food

https://realfood.gov
865•atestu•18h ago•1179 comments

Anyone have experiences with Audio Induction Loops?

https://en.wikipedia.org/wiki/Audio_induction_loop
20•evolve2k•3d ago•3 comments

Lessons from Hash Table Merging

https://gist.github.com/attractivechaos/d2efc77cc1db56bbd5fc597987e73338
26•attractivechaos•5d ago•6 comments

Shipmap.org

https://www.shipmap.org/
632•surprisetalk•20h ago•101 comments

Go.sum is not a lockfile

https://words.filippo.io/gosum/
84•pabs3•7h ago•27 comments

Tailscale state file encryption no longer enabled by default

https://tailscale.com/changelog
298•traceroute66•15h ago•117 comments

ChatGPT Health

https://openai.com/index/introducing-chatgpt-health/
299•saikatsg•15h ago•357 comments

The Q, K, V Matrices

https://arpitbhayani.me/blogs/qkv-matrices/
131•yashsngh•1d ago•53 comments

Play Aardwolf MUD

https://www.aardwolf.com/
134•caminanteblanco•11h ago•66 comments

GLSL Web CRT Shader

https://blog.gingerbeardman.com/2026/01/04/glsl-web-crt-shader/
66•msephton•3d ago•14 comments

AI misses nearly one-third of breast cancers, study finds

https://www.emjreviews.com/radiology/news/ai-misses-nearly-one-third-of-breast-cancers-study-finds/
105•Liquidity•4h ago•52 comments

LaTeX Coffee Stains (2021) [pdf]

https://ctan.math.illinois.edu/graphics/pgf/contrib/coffeestains/coffeestains-en.pdf
342•zahrevsky•20h ago•79 comments

The virtual AmigaOS runtime (a.k.a. Wine for Amiga:)

https://github.com/cnvogelg/amitools/blob/main/docs/vamos.md
74•doener•10h ago•17 comments

Musashi: Motorola 680x0 emulator written in C

https://github.com/kstenerud/Musashi
76•doener•10h ago•7 comments

NPM to implement staged publishing after turbulent shift off classic tokens

https://socket.dev/blog/npm-to-implement-staged-publishing
175•feross•16h ago•56 comments

How Google got its groove back and edged ahead of OpenAI

https://www.wsj.com/tech/ai/google-ai-openai-gemini-chatgpt-b766e160
141•jbredeche•18h ago•158 comments

US will ban Wall Street investors from buying single-family homes

https://www.reuters.com/world/us/us-will-ban-large-institutional-investors-buying-single-family-h...
876•kpw94•16h ago•892 comments

Reading Without Limits or Expectations

https://www.carolinecrampton.com/reading-without-limits-or-expectations/
42•herbertl•2d ago•12 comments

Notion AI: Unpatched data exfiltration

https://www.promptarmor.com/resources/notion-ai-unpatched-data-exfiltration
175•takira•15h ago•27 comments

Claude Code CLI was broken

https://github.com/anthropics/claude-code/issues/16673
134•sneilan1•15h ago•121 comments

Health care data breach affects over 600k patients, Illinois agency says

https://www.nprillinois.org/illinois/2026-01-06/health-care-data-breach-affects-600-000-patients-...
193•toomuchtodo•18h ago•66 comments

Creators of Tailwind laid off 75% of their engineering team

https://github.com/tailwindlabs/tailwindcss.com/pull/2388
1259•kevlened•19h ago•717 comments

A4 Paper Stories

https://susam.net/a4-paper-stories.html
354•blenderob•22h ago•161 comments

“Stop Designing Languages. Write Libraries Instead” (2016)

https://lbstanza.org/purpose_of_programming_languages.html
248•teleforce•22h ago•247 comments

Show HN: Open database of link metadata for large-scale analysis

https://github.com/rumca-js/RSS-Link-Database-2025
6•renegat0x0•4d ago•1 comments