----- Mail original -----
> De: "Claes Redestad" <[email protected]>
> À: "Remi Forax" <[email protected]>
> Cc: "core-libs-dev" <[email protected]>
> Envoyé: Vendredi 29 Mai 2020 18:10:40
> Objet: Re: RFR: 8246152: Improve String concat bootstrapping
> 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!
yes, thanks.
>
> /Claes
Rémi