News for hackers. Stuff that matters.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by bombcar on Monday January 22, 2024 @10:20AM (#39090363)
IIRC people didn't "really believe" that Java could actually be performant because they assumed that since it has a JIT layer, it would never even get close to native code.

But the reality was that JIT allows code to get faster over time, as the JIT improves.

Things like Jazelle let chip manufacturers paper over a paper objection.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by PaulHoule on Monday January 22, 2024 @10:56AM (#39090821)
Specialized hardware has been losing out against general for years.

There were those "LISP machines" in the early 1980s but when Common Lisp was designed they made sure it could be implemented efficiently on emerging 32-bit machines.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by bombcar on Monday January 22, 2024 @11:06AM (#39090979)
Part of the reason is anytime a specialized hardware is found that works, the generalized hardware steals the feature that makes it faster - basically the story of all the extensions to x86 like SSE, etc.
Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by o11c on Monday January 22, 2024 @12:45PM (#39092613)
> But the reality was that JIT allows code to get faster over time, as the JIT improves.

Ehh .. PGO is only somewhat better for JIT than AOT. More often for purely-numerical code the win is because the AOT doesn't do per-machine `-march=native`. It's the memory model that kills JVM performance for any nontrivial app though.

Re:Jazelle DBX: Allow ARM processors to execute Java bytecod... by tenaf0 on Monday January 22, 2024 @02:15PM (#39093977)
Well, code size is another interesting aspect here. A JIT compiler can effectively create any number of versions for a hot method, based on even very aggressive assumptions (an easy one would be that a given object is non-null, or that the interface only has a single instance loaded). The checks for these are cheap (e.g. it could be encoded as trapping an invalid page address in case of NPEs), and invalidation’s cost is amortized.

Contrast this with the problem of specialization in AOT languages, which can easily result in bloated binaries (PGO does help here quite a lot, that much is true). For example, generics might output a completely new function for every type it gets instantiated with - if the function is not that hot, it actually makes sense to rather try to handle more cases with the same code.