Pass by reference: final and effectively final parameters and qualifying return types
forax at univ-mlv.fr
Tue Jan 5 09:12:10 UTC 2021
----- Mail original -----
> De: "Suminda Sirinath Salpitikorala Dharmasena" <sirinath1978m at gmail.com>
> À: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Mardi 5 Janvier 2021 08:45:55
> Objet: Pass by reference: final and effectively final parameters and qualifying return types
> Java unlike C# does not have `ref` parameters. Reference parameters
> contribute to some of the recent speedups as highlighted in this post:
> So is it possible to automatically convert qualifying parameters and return
> types in refs.
> Final and effectively final parameters and also certain return types can
> also be converted into refs.
> A language change is not needed as this is done by the compiler/JVM, though
> further language change can be done to accommodate this.
reference parameters, out parameters, are hard to optimize because of pointer aliasing .
C# inherits them from the COM runtime model, so has to deal with them.
Java does not have them by design. Java uses a pass by value semantics which leads to better code.
More information about the valhalla-dev