|
|
Log in / Subscribe / Register

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Posted Mar 26, 2022 22:13 UTC (Sat) by foom (subscriber, #14868)
In reply to: Beingessner: Rust's Unsafe Pointer Types Need An Overhaul by ncm
Parent article: Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Apple only enables the x86-like TSO mode in their CPU when running emulated x86 code. It uses the usual ARM memory ordering guarantees otherwise.


to post comments

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Posted Mar 28, 2022 17:13 UTC (Mon) by MrWim (subscriber, #47432) [Link]

I wonder what the performance impact of this being enabled is?

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Posted Mar 29, 2022 10:58 UTC (Tue) by nye (guest, #51576) [Link] (4 responses)

I find it fascinating that they've designed their hardware specifically to make it easier to emulate a different architecture. Is this sort of thing done a lot?

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Posted Mar 29, 2022 11:46 UTC (Tue) by excors (subscriber, #95769) [Link] (1 responses)

Maybe Nvidia's Denver counts? From early descriptions, it sounds like it was designed with a native ISA that closely matches its microarchitecture (in-order, very superscalar, etc), and it emulates the ARM ISA via both a hardware ARM instruction decoder (low latency but poor utilisation of the unusual microarchitecture) and a firmware-based dynamic ARM-to-native translator (high latency but can heavily optimise hot loops). And it would have also emulated x86 if not for patent licensing issues.

Denver reportedly provides sequential consistency (https://threedots.ovh/blog/2021/02/cpus-with-sequential-c...) so it's even stronger than x86, regardless of what mode it's running in - maybe that made sense when they were originally planning to support x86, because it'd be cheaper than emulating x86 on a weaker model, and simpler than exactly implementing x86's weird TSO model.

On the other hand, that doesn't sound terribly different to all modern CPUs, where the ARM/x86/etc instructions are heavily translated into microarchitecture-specific micro-ops - you could view them all as essentially emulating ARM/x86, and their microarchitectures are designed to do that emulation efficiently. The main difference is just that they're designed for a single ISA (or a related pair like A32 and A64), whereas Denver and Apple M1 were designed for both ARM and x86 (even if Denver only ever shipped as ARM).

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Posted Mar 30, 2022 9:53 UTC (Wed) by nye (guest, #51576) [Link]

Quite different but very interesting, especially with the firmware caching translated code in main memory; thanks for the pointer. Apparently they had some former Transmeta employees on the team, which makes sense.

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Posted Apr 4, 2022 2:41 UTC (Mon) by ncm (guest, #165) [Link] (1 responses)

It is absolutely the norm, going back to the early 1960s.

The current Intel chips emulate all previous Pentiums, both 64 and 32 bits, which emulated the 486, which emulated the 386, which emulated the 286, which emulated the 8086, which was jimmied to emulate 8080, which emulated 8008. The Z-80 also emulated 8080. IBM z emulates 370, which emulates 360, which could emulate 1401, which I think emulated 701. The DEC Alpha was able to emulate x86 faster than any native x86 of the time could run.

So, emulating is almost the norm. There are said to be businesses running programs from the '60s on machines emulating five levels deep.

But that Apple turns off x86-style bus ordering when not emulating suggests they can run faster without it. It is usually said that Intel avoids a speed penalty for their memory model by throwing way more transistors at the problem than seems reasonable to other makers. So, this looks complicated.

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Posted Apr 11, 2022 16:22 UTC (Mon) by flussence (guest, #85566) [Link]

Most of that's right, but it's worth noting new Intel chips are actually starting to pull up the 80xx compatibility ladder behind them. While OSes have long since grown past the need for 40-year-old quirks (and userspace emulation is more than good enough to not care any more), the BIOS was still a major holdout until recently.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds