News for hackers. Stuff that matters.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by BenoitP on Monday January 22, 2024 @09:15AM (#39089727)
The gains seem to not have been high enough to sustain that project. Nowadays CPUs plan, fuse and reorder so much of micro-code that lower-level languages can sort of be considered virtual as well.

But Java and similar languages extract more freedom-of-operation from the programmer to the runtime: no memory address shenanigans, richer types, and to some extent immutability and sealed chunks of code. All these could be picked up and turned into more performance by the hardware; with some help from the compiler. Sort of like SQL being a 4th-gen language, letting the runtime collect statistics and chose the best course of execution (if you squint at it in the dark with colored glasses)

More recent work about this is to be found on the RISC-V J extension [1], still to be formalized and picked up by the industry. Three features could help dynamic languages:

* Pointer masking: you can fit a lot in the unused higher bits of an address. Some GCs use them to annotate memory (refered-to/visited/unvisited/etc.), but you have to mask them. A hardware assisted mask could help a lot.

* Memory tagging: Helps with security, helps with bounds-checking

* More control over instruction caches

It is sort of stale at the moment, and if you track down the people working on it they've been reassigned to the AI-accelerator craze. But it's going to come back, as Moore's law continues to end and Java's TCO will again be at the top of the bean-counter's stack.

[1] https://github.com/riscv/riscv-j-extension

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by funcDropShadow on Monday January 22, 2024 @11:51AM (#39091691)
The Java ecosystems initially started with optimizing Java compilers. That setup could benefit from direct hardware support for Java bytecode. Later, it was discovered that it is more beneficial to remove the optimization from javac in order to provide more context to the JIT compiler. Which enables better optimizations from JIT compilers. By directly running Java bytecode, you would loose so many optimizations done by Hotspot, that it is hard to get on par just by interpreting bytecode in hardware. The story may be different for restricted JVMs that don't have a sophisticated JIT.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by miohtama on Monday January 22, 2024 @12:33PM (#39092401)
The current (largest) end-user Java ecosystem is in practice Android and it ahead-of-time compiling ART.

Java itself got very good. Though Oracle was blocked to leech money, or have return for their investment, depending on the viewpoint.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by kaba0 on Monday January 22, 2024 @01:52PM (#39093626)
I don’t really get your last point - java’s improvements are due to Oracle, not despite it. They have a terrible name, but they have been excellent stewards of the platform.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by miohtama on Monday January 22, 2024 @05:49PM (#39096650)
Android ART would unlikely to exist if Oracle would have been enforcing licensing requirements as they wished.

ART runs on devices for 1B+ users and is more relevant for the world population as Oracle. Although we can speculate likely Android would have switched to something else if Oracle were to win in the court.

Ironically Android more realised Java’s original light client vision “Write once, run everywhere” if you consider “everywhere” as all around the world, by every human, with various device architectures.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by kaba0 on Tuesday January 23, 2024 @02:08AM (#39100420)
I wouldn’t be so quick to dismiss the huge deal of internet services running OpenJDK. Like, AWS itself, Apple’s backends, a huge part of Google’s infrastructure, the whole of Alibaba that is responsible for some crazy amount of transactions, just to mention a few.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by miohtama on Tuesday January 23, 2024 @04:25AM (#39101257)
Java is a light client programming language that found a small niche in server programming.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by kaba0 on Tuesday January 23, 2024 @04:39AM (#39101359)
It doesn’t really make sense to attribute the initial domain of a language to the whole platform. Especially when Java can have so many faces, and that it’s numero 1 use case is backend applications. Android is a comparatively small market.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by funcDropShadow on Wednesday January 24, 2024 @10:50AM (#39118762)
> Java ... found a small niche in server programming.

Lol, virtually all business server applications are running on th e JVM in the corner of the world that I see.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by pjmlp on Tuesday January 23, 2024 @04:45AM (#39101393)
Dalvik runned like shit, was only a basic interpreter at the begining, and it was Sun that was ripped off before Oracle took over.

Google could have acquired Java, after screwing Sun, and decided to take a bet on not doing it.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by toast0 on Monday January 22, 2024 @11:08AM (#39091026)
> Pointer masking: you can fit a lot in the unused higher bits of an address. Some GCs use them to annotate memory (refered-to/visited/unvisited/etc.), but you have to mask them. A hardware assisted mask could help a lot.

If you're building hardware masking, it should be viable for low bits too. If you define all your objects to be n-byte aligned, it frees up low bits for things too, and might not be an imposition, things like to be aligned.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by ithkuil on Monday January 22, 2024 @03:40PM (#39095120)
The sparc ISA had tagged arithmetic instructions so that you could tag integers using LSBs and ignore them
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by pjmlp on Monday January 22, 2024 @10:02AM (#39090168)
As free beer AOT compilers for Java are commonly available, and as shown on Android since version 5, I doubt special opcodes will matter again.

Ironically when one dives into computer archeology, old Assembly languages are occasionally referred as bytecodes, the reason being that in CISC designs with microcoded CPUs they were already seen that way by hardware teams.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by BenoitP on Monday January 22, 2024 @11:31AM (#39091384)
I'm still not decided on AOT vs JIT being the endgame.

In theory JIT should be higher performance, because it benefits from statistics taken at actual runtime. Given a smart enough compiler. But as a piece of code matures and gets more stable, the envelope of executions is better known and programmers can encode that at compile-time. That's the tradeoff taken by Rust: ask for more proofs from the programmers, and Rust is continuing to pick up speed.

That's also what the Leyden project / condensers [1] is about, if I understand correctly. Pick up proofs and guarantees as early as possible and transform the program. For example by constant-propagating a configuration file taken up during build-time.

Something I've pondered over the years: a programmer's job is not to produce code. It is to produce proofs and guarantees (yet another digression/rant: generating code was never a problem. Before LLMs we could copy-paste code from StackOverflow just fine)

In the end it's only about marginal improvements though. These could be superseded by changes of paradigm like RAM getting some compute capabilities; or programs being split into a myriad of specialized instructions. For example filters, rules and parsing going inside the network card; SQL projections and filters going into the SSD controller; or matrix-multiplication going into integrated GPU/TPU/etc just like now.

[1] https://openjdk.org/projects/leyden/notes/03-toward-condense...

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by pjmlp on Monday January 22, 2024 @01:46PM (#39093531)
The best solution isn't AOT vs JIT, rather JIT and AOT, having both available as standard part of the tooling.

Android has learnt to have both, and thanks to PGO being shared across devices via Play Store, the AOT/JIT outcome reaches the ideal optimum for a specific application.

Azul and IBM have similar approaches on their JVMs with a cluster based JIT, and JIT caches as AOT alternative.

Also stuff like GPGPU is a mix of AOT and JIT, and is doing quite alright.

I am not so confident with LLMs, when they get good enough programmers will be left out of the loop, and will have to contend to similar roles as when doing no-code SaaS configs or some form of architects.

A few programmers will remain as the LLMs high priests.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by BenoitP on Monday January 22, 2024 @03:34PM (#39095030)
> A few programmers will remain as the LLMs high priests.

That's interesting.

It's controversial to say that in 2024, but not all opinions have the same value. Some are great, but some are plain dumb. The current corporate right opinion is to praise LLMs as end-all be-all. I've been asked to advise a private banking family office wanting to get into LLMs. For advising their clients' financial decisions. I politely declined. Can there be a worse use case? LLMs are parrots with the brain size of the internet. With thoughts of random origin mixed together randomly. It produces wonderful form, but abysmal analysis.

IMHO as LLMs will begin to be indistinguishable from real users (and internet dogs), there's going to be a resurging need to trace origin to a human; and maybe to also rank their opinions as well. My money is on some form of distributed social proof designating the high priests.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by pjmlp on Monday January 22, 2024 @04:33PM (#39095779)
I see the current state of LLMs are when we read about Assembly programmers being suspicious something like high level languages would ever take off.

When we read about history of Fortran, there are several remarks on the amount of work put into place to win over those developers, as otherwise Fortran would have been yet another failed attempt.

LLMs seem to be at a similar stage, maybe their Fortran moment isn't yet here, parrots as you say, but it will come.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by tenaf0 on Monday January 22, 2024 @02:01PM (#39093774)
I do think, that in the general case, a JIT compiler is required: you can’t make every program fast, without having the ability to synthesize new code based on only-runtime available information. There are many where AOT is more than enough, but not all are such. Note, this doesn’t preclude AOT/hybrid models as pjmlp correctly says.

One stereotypical (but not the best) example would be regexes: you basically want to compile some AST into a mini-program. This can also be done with a tiny interpreter without JIT, which will be quite competitive in speed (I believe that’s what rust has, and it’s indeed one of the fastest - the advantage of the problem/domain here is that you really can have tiny interpreters that efficiently use the caches, having very little overhead on today’s CPUs), but I am quite sure that a “JITted rust” with all the other optimizations/memory layouts could potentially fair better, but of course it’s not a trivial additional complexity.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by funcDropShadow on Wednesday January 24, 2024 @10:55AM (#39118822)
I am sure there will never be the conclusion that AOT is always better or that JIT is always better. E.g. JIT has a large advantage in long running applications that run at different customers with very different configurations. The scenarios where AOT has an advantage are well known, so I won't iterate them.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by vextea on Monday January 22, 2024 @10:07AM (#39090222)
Remember when for a while Azul tried to sell custom CPUs to support features in their JVM (e.g. some garbage collector features that required hardware interrupts and some other extra instructions). Although they dropped it pretty quickly in favor of just working on software

https://www.cpushack.com/2016/05/21/azul-systems-vega-3-54-c...

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by sillywalk on Monday January 22, 2024 @05:50PM (#39096659)
IBM's Z14 (and later I assume) supported Guarded Storage Facility for 'pauseless Java Garbage collection.'
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by pjc50 on Monday January 22, 2024 @11:47AM (#39091632)
One of the few elements left like this is the ARM Javascript instruction: https://news.ycombinator.com/item?id=24808207
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by lionkor on Monday January 22, 2024 @09:43AM (#39089992)
> as Moore's law continues to end

more like Wirths law proving itself still