RFR: 8246152: Improve String concat bootstrapping

Claes Redestad claes.redestad at oracle.com
Fri May 29 16:10:40 UTC 2020


Hi,

will deal with your suggestions soon, separately. :-)

On 2020-05-29 17:51, Remi Forax wrote:
> 
> Can you explain me, what rebind is exactly ?
> 

MH.rebind() wraps any kind of MH as a BoundMethodHandle, which
is necessary to subject it to transforms.

     /** Require this method handle to be a BMH, or else replace it with 
a "wrapper" BMH.
      *  Many transforms are implemented only for BMHs.
      *  @return a behaviorally equivalent BMH
      */
     abstract BoundMethodHandle rebind();

On the DMHs we lookup rebind() will return a very simple BMH, which will
return itself on the rebind() that will happen when doing transforms,
e.g. in insertArguments (don't mind the "makeReinvoker": complex BMHs
create chains from one another so that each partial expression doesn't
grow too unwieldy):

     @Override
     BoundMethodHandle rebind() {
         if (!tooComplex()) {
             return this;
         }
         return makeReinvoker(this);
     }

For those cases where we're caching a MH that will always be used in a
transform - like most of the things we use when building up the MH tree
in SCF - doing the rebind() pre-emptively means we move an allocating
rebind from the common path to the once-per-MH setup step, while the
subsequent rebinds will be trivial and non-allocating.

Hope this makes sense!

/Claes


More information about the core-libs-dev mailing list