This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package java.lang.invoke; | |
import java.lang.invoke.MethodHandle; | |
import java.lang.invoke.MethodHandles.Lookup; | |
import java.lang.invoke.MethodType; | |
import java.lang.reflect.Method; | |
import java.util.Arrays; | |
import jdk.internal.org.objectweb.asm.ClassWriter; | |
import jdk.internal.org.objectweb.asm.FieldVisitor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The author from SUN provides a general introduction of JSR292(invokedynamic introduction): | |
A dynamic compiler can traverse both representations simultaneously, producing optimized machine code which is the seamless union of both kinds of input. As a final twist, the user-defined linkage of a call site may change, allowing the code to adapt as the application evolves over time. | |
Some of hints are: | |
1, Operand types are collected at message sends and other opportune points, and are captured in inline caches or summarized | |
in a type profile. This information is local to each instruction. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is basic background literature for dynamic language and polymorphic inline cache. | |
The basic idea: | |
1, collect type information by recording all of the receiver types actually used at a given call site. | |
2, The compiler can exploit this type information to generate better code when recompiling a method. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
an analysis model and a framework that enables reducing analysis overhead at runtime through adaptive instrumentation of | |
the base program. Overhead reduction is achieved by removing instrumentation from code locations that are considered unimportant for the analysis results, thereby avoiding execution of analysis code for those locations. | |
=> Hints: 对于MH chains,由于有很多MH,但并不是所有的MH都是有效的或者被调用到的,因此我在运行时候删除部分的不会/很少调用到的MH... | |
But what's the difference between inline cache VS reduction of MHs. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
They use various metrics to characterize the dynamic behavior of a variety of programs written in three dynamic languages (Clojure, Python, and Ruby) executing on the JVM. | |
We have previously presented a comprehensive toolchain [20] for workload characterization across JVM languages2, which was successfully applied in studying the differences. | |
The metrics are: | |
Call-site Polymorphism. | |
Hints at opportunities for optimizations at polymorphic call-sites, e.g. inline caching [13] (based on the number of receiver types), or method inlining [10] (based on the number of target methods). => On average, 98% call site only has one targte method. | |
Field, Object, and Class Immutability. | |
Enables load elimination [3] (replacing repeated accessess to immutable objects with an access to a compiler-generated temporary stored in a register), and identifies objects and side-effectfree data structures amenable to parallelization. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why Nothing Matters: The Impact of Zeroing -OOPSLA’11 |