and footprint • JEP 243: Java-Level JVM Compiler Interface • JEP 248: Make G1 the Default Garbage Collector • JEP 254: Compact Strings • JEP 280: Indify String Concatenation • JEP 269: Convenience Factory Methods for Collections • JEP 259: Stack-Walking API • New APIs
Code JEP 220: Modular Run-Time Images JEP 261: Module System JEP 275: Modular Java Application Packaging JEP 282: jlink: The Java Linker JEP 295: Ahead-of-Time Compilation
a compiler written in Java to be used by the JVM as a dynamic compiler. Goals • Allow a Java component programmed against the JVMCI to be loaded at runtime and used by the JVM’s compile broker. • Allow a Java component programmed against the JVMCI to be loaded at runtime and used by trusted Java code to install machine code in the JVM that can be called via a Java reference to the installed code.
class StringLayout { public static void main(String[] args) { String value = "Lorem ipsum ... est laborum."; out.println(VM.current().details()); out.println(ClassLayout.parseClass(String.class).toPrintable()); out.println(GraphLayout.parseInstance(value).toFootprint()); } }
char[] data = new char[Integer.MAX_VALUE - 2]; data[0] = '\uD83D'; data[1] = '\uDC7B'; String value = new String(data); System.out.println(value.hashCode()); } } Exception in thread "main" java.lang.OutOfMemoryError: UTF16 String size is 2147483645, should be less than 1073741823 at java.base/java.lang.StringUTF16.newBytesFor(StringUTF16.java:46) at java.base/java.lang.StringUTF16.toBytes(StringUTF16.java:148) at java.base/java.lang.String.<init>(String.java:3023) at java.base/java.lang.String.<init>(String.java:249) at com.vyazelenko.perf.string.StringMaxSize.main(StringMaxSize.java:9)
result = ""; for (int i = 0; i < iterations; i++) { result += (i + " " + log() + "\n"); } return result; } @Benchmark public String proper() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < iterations; i++) { sb.append(i).append(" ").append(log()).append("\n"); } return sb.toString(); } }