On Wed, 22 Mar 2023 at 14:46, René Jansen <[email protected]> wrote:
[...]
> So I am setting up a few benchmarks, and I will report back. But the first 
> question is, how does it work?
> Java does not have a normal compiler backend, where we can tell it to compile 
> for a certain ISA
> (or default to the one it is on - but non-Java workloads are seldom compiled 
> on the same LPAR) .

A good part of this has been open sourced by IBM. But it's
unbelievably huge and complex.

> We cannot have a driver that decides which fork of the code to take, 
> depending on the hardware.
> The instructions are actually coughed up by the JIT whenever it is decided 
> that it would benefit, which
> means they would be faster than interpreting. It could be, of course, that 
> the runtime of the Java libraries,
> is already precompiled in the right instruction. That is probably where I am 
> going to look first.
> But if most of it is called from libraries, it cannot inline the 
> instructions, which would get rid of a lot of the
> performance gains. I hope this is documented somewhere apart from the source 
> code, which might not even be open.

Not my area of expertise, but it seems like a hard problem to me.
Since the Java language (and bytecode stream) has no way to express
the notion of decimal floating point, any compiling (whether JIT or
otherwise) would presumably have to infer what some Java FP class is
doing from its behaviour, in order to decide to generate DFP
instructions. I don't know what inputs are available to this decision
- maybe if things like well-known class names can be passed through,
or there is a mechanism for passing hints all the way through from
highest to lowest levels...?

I remember discussing simple versions of this kind of issue decades
ago in the C/C++ context. How can the C programmer hint to the
compiler that there are limits on an array index range or string
length, where the language provides not only no concept of such
limits, but has no defined hinting mechanism? Well for example you can
use char rather than int for the variable, and even though the
semantics may promote char to int, a smart compiler can see the
original text and remember that in this case the limit is 255, and
generate a single MVC rather then some run-time test and then maybe
MVCL or an MVC loop. But I have some trouble seeing such trickery
being able to pass the notion of decimal FP through like that.

Another way of looking at it is to think of the compiling decisions as
needing an AI (= extreme pattern matching). And of course there's
nothing to say that decimal FP instructions are not the best way to
implement something that turns out not to involve decimal FP at all at
the high level.

Tony H.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to