Navigation Menu

Skip to content

Commit

Permalink
JET2016 - The night before
Browse files Browse the repository at this point in the history
  • Loading branch information
simonis committed Nov 17, 2016
1 parent 591879b commit 064ae5b
Show file tree
Hide file tree
Showing 28 changed files with 16,329 additions and 227 deletions.
12 changes: 6 additions & 6 deletions examples/.history_agents
@@ -1,6 +1,6 @@
java -XX:+JavaZone -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y org.simonis.HelloWorld
java -XX:-JavaZone -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y org.simonis.HelloWorld
java -XX:+JavaZone -agentpath:traceMethodAgent.so=org/simonis org.simonis.HelloWorld
java -XX:-JavaZone -agentpath:traceMethodAgent.so=org/simonis org.simonis.HelloWorld
java -XX:+JavaZone -javaagent:MethodInstrumentationAgent.jar=org/simonis --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED org.simonis.HelloWorld
java -XX:-JavaZone -javaagent:MethodInstrumentationAgent.jar=org/simonis --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED org.simonis.HelloWorld
java -XX:+JETConf -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y org.simonis.HelloWorld
java -XX:-JETConf -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y org.simonis.HelloWorld
java -XX:+JETConf -agentpath:traceMethodAgent.so=org/simonis org.simonis.HelloWorld
java -XX:-JETConf -agentpath:traceMethodAgent.so=org/simonis org.simonis.HelloWorld
java -XX:+JETConf -javaagent:MethodInstrumentationAgent.jar=org/simonis --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED org.simonis.HelloWorld
java -XX:-JETConf -javaagent:MethodInstrumentationAgent.jar=org/simonis --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED org.simonis.HelloWorld
14 changes: 7 additions & 7 deletions examples/.history_arraycopy
@@ -1,7 +1,7 @@
java -XX:+PrintCompilation org.simonis.ArrayCopy0 100000
java -XX:CompileCommand="print org.simonis.ArrayCopy1::arraycopy" org.simonis.ArrayCopy1 100000 | less
java -XX:+PrintCompilation -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations -XX:-EliminateAllocations org.simonis.ArrayCopy1 100000
java -XX:+PrintCompilation -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations org.simonis.ArrayCopy1 100000
java -XX:+PrintCompilation org.simonis.ArrayCopy1 100000
java org.simonis.ArrayCopy1 1
java org.simonis.ArrayCopy0 1
java -XX:+PrintCompilation -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations -XX:-EliminateAllocations -XX:CompileCommand="option org.simonis.ArrayCopy::arraycopy PrintOptoAssembly" org.simonis.ArrayCopy 99999 | less
java -XX:+PrintCompilation -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations -XX:CompileCommand="option org.simonis.ArrayCopy::arraycopy PrintOptoAssembly" org.simonis.ArrayCopy 99999 | less
java -XX:+PrintCompilation -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations -XX:-EliminateAllocations org.simonis.ArrayCopy 100000
java -XX:+PrintCompilation -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations org.simonis.ArrayCopy 100000
java -XX:+PrintCompilation org.simonis.ArrayCopy 100000
java org.simonis.ArrayCopy 100000
java org.simonis.ArrayCopy 1000
2 changes: 1 addition & 1 deletion examples/.history_hello
@@ -1,4 +1,4 @@
javac -d . ../src/org/simonis/HelloWorld.java
emacs -nw -r -q ../src/org/simonis/HelloWorld.java
java -Xint -XX:+JavaZone org.simonis.HelloWorld
java -Xint -XX:+JETConf org.simonis.HelloWorld
java -Xint org.simonis.HelloWorld
6 changes: 3 additions & 3 deletions examples/.history_loop
@@ -1,3 +1,3 @@
time java -XX:+PrintCompilation -XX:+PrintInlining -XX:-InlineMathNatives -Xint org.simonis.Loop 0 1 10000000
time java -XX:+PrintCompilation -XX:+PrintInlining -XX:-InlineMathNatives org.simonis.Loop 0 1 10000000
time java -XX:+PrintCompilation -XX:+PrintInlining org.simonis.Loop 0 1 10000000
time java -XX:+PrintCompilation -XX:+PrintInlining -XX:-InlineMathNatives -Xint org.simonis.Loop 10000000
time java -XX:+PrintCompilation -XX:+PrintInlining -XX:-InlineMathNatives org.simonis.Loop 10000000
time java -XX:+PrintCompilation -XX:+PrintInlining org.simonis.Loop 10000000
4 changes: 2 additions & 2 deletions examples/.history_loop_print
@@ -1,2 +1,2 @@
time java -XX:+PrintCompilation -XX:+PrintInlining -XX:-InlineMathNatives -XX:CompileCommand="print,org.simonis.Loop::compute" org.simonis.Loop 0 1 10000000 | less
time java -XX:+PrintCompilation -XX:+PrintInlining -XX:CompileCommand="print,org.simonis.Loop::compute" org.simonis.Loop 0 1 10000000 | less
time java -XX:+PrintCompilation -XX:+PrintInlining -XX:-InlineMathNatives -XX:CompileCommand="print,org.simonis.Loop::compute" org.simonis.Loop 10000000 | less
time java -XX:+PrintCompilation -XX:+PrintInlining -XX:CompileCommand="print,org.simonis.Loop::compute" org.simonis.Loop 10000000 | less
5 changes: 3 additions & 2 deletions examples/.history_loop_with_gc
@@ -1,2 +1,3 @@
time java -verbose:gc -XX:+InlineMathNatives org.simonis.LoopWithGC 0 1 100000000
time java -verbose:gc -XX:-InlineMathNatives org.simonis.LoopWithGC 0 1 100000000
time java -verbose:gc -XX:+InlineMathNatives -XX:+UseCountedLoopSafepoints org.simonis.LoopWithGC 100000000
time java -verbose:gc -XX:-InlineMathNatives org.simonis.LoopWithGC 100000000
time java -verbose:gc -XX:+InlineMathNatives org.simonis.LoopWithGC 100000000
4 changes: 4 additions & 0 deletions examples/.history_random_print
@@ -1,2 +1,6 @@
java -XX:+PrintCompilation -XX:+PrintInlining -XX:CompileCommand="print,org.simonis.Random::foo" -XX:DisableIntrinsic=_nextInt org.simonis.Random 1000000 2>&1 | less
java -XX:+PrintCompilation -XX:+PrintInlining -XX:CompileCommand="print,org.simonis.Random::foo" org.simonis.Random 1000000 2>&1 | less
java -XX:CompileCommand="option org.simonis.Random::foo PrintAssembly" org.simonis.Random 1000000 2>&1 | less
java -XX:CompileCommand="option org.simonis.Random::foo PrintOptoAssembly" org.simonis.Random 1000000 2>&1 | less
java -XX:+PrintCompilation -XX:+PrintInlining -XX:DisableIntrinsic=_nextInt org.simonis.Random 1000000 2>&1 | less
java -XX:+PrintCompilation -XX:+PrintInlining org.simonis.Random 1000000 2>&1 | less
6 changes: 4 additions & 2 deletions examples/create_demo_shell.sh
Expand Up @@ -5,11 +5,13 @@ export PATH=/share/output-jdk9-hs-comp-dbg/images/jdk/bin:$PATH

export _JAVA_OPTIONS='-Xbatch -XX:-UseCompressedOops -XX:+UseSerialGC -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:+UnlockDiagnosticVMOptions -XX:-CheckIntrinsics -XX:-LogVMOutput -XX:CICompilerCount=2'

#export LD_LIBRARY_PATH=/share/OpenJDK/hsdis
if [ "$1" == "random_print" ]; then
export LD_LIBRARY_PATH=/share/OpenJDK/hsdis
fi

alias javac=/share/output-jdk9-hs-comp-opt/images/jdk/bin/javac

cd /c/Users/D046063/public_html/hotspot/JavaZone2016/git/examples/bin
cd /c/Users/D046063/public_html/hotspot/JET2016/git/examples/bin

set -o history
unset HISTFILE
Expand Down
74 changes: 74 additions & 0 deletions examples/hs_patches/JBreak2JET.patch
@@ -0,0 +1,74 @@
diff -r 5f0e3805cbe4 src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp
--- a/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp Wed Sep 07 02:57:30 2016 +0200
+++ b/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp Wed Sep 07 03:03:18 2016 +0200
@@ -352,7 +352,7 @@
// stack: [ ret adr ] <-- rsp

address entry_point = __ pc();
- const char *msg = "\x0d0\x09f\x0d1\x080\x0d0\x0b8\x0d0\x0b2\x0d0\x0b5\x0d1\x082 JBreak!\n";
+ const char *msg = "Hello JETConf!\n";
__ mov64(c_rarg1, (long)stdout);
__ mov64(c_rarg0, (long)msg);
__ xorl(rax, rax);
diff -r 5f0e3805cbe4 src/share/vm/classfile/vmSymbols.hpp
--- a/src/share/vm/classfile/vmSymbols.hpp Wed Sep 07 02:57:30 2016 +0200
+++ b/src/share/vm/classfile/vmSymbols.hpp Wed Sep 07 03:03:18 2016 +0200
@@ -1355,7 +1355,7 @@
do_name( getAndSetObject_name, "getAndSetObject") \
do_signature(getAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \
\
- /* support for JBreak */ \
+ /* support for JETConf */ \
do_class( java_util_Random, "java/util/Random") \
do_intrinsic(_nextInt, java_util_Random, nextInt_name, void_int_signature, F_R) \
do_name( nextInt_name, "nextInt") \
diff -r 5f0e3805cbe4 src/share/vm/interpreter/abstractInterpreter.cpp
--- a/src/share/vm/interpreter/abstractInterpreter.cpp Wed Sep 07 02:57:30 2016 +0200
+++ b/src/share/vm/interpreter/abstractInterpreter.cpp Wed Sep 07 03:03:18 2016 +0200
@@ -147,7 +147,7 @@
case vmIntrinsics::_doubleToRawLongBits: return java_lang_Double_doubleToRawLongBits;
}

- if (JBreak) {
+ if (JETConf) {
if (m->intrinsic_id() == vmIntrinsics::_sayHello) {
return HelloWorld_sayHello;
}
diff -r 5f0e3805cbe4 src/share/vm/interpreter/templateInterpreterGenerator.cpp
--- a/src/share/vm/interpreter/templateInterpreterGenerator.cpp Wed Sep 07 02:57:30 2016 +0200
+++ b/src/share/vm/interpreter/templateInterpreterGenerator.cpp Wed Sep 07 03:03:18 2016 +0200
@@ -265,7 +265,7 @@
method_entry(java_lang_Double_longBitsToDouble);
method_entry(java_lang_Double_doubleToRawLongBits);

- if (JBreak) {
+ if (JETConf) {
method_entry(HelloWorld_sayHello);
}
#undef method_entry
diff -r 5f0e3805cbe4 src/share/vm/oops/method.cpp
--- a/src/share/vm/oops/method.cpp Wed Sep 07 02:57:30 2016 +0200
+++ b/src/share/vm/oops/method.cpp Wed Sep 07 03:03:18 2016 +0200
@@ -1393,7 +1393,7 @@
// exception: the AES intrinsics come from lib/ext/sunjce_provider.jar
// which does not use the class default class loader so we check for its loader here
const InstanceKlass* ik = InstanceKlass::cast(holder);
- if (JBreak && ik->name()->equals("org/simonis/HelloWorld")) {
+ if (JETConf && ik->name()->equals("org/simonis/HelloWorld")) {
// check for org.simonis.HelloWorld
return vmSymbols::find_sid(ik->name());
}
diff -r 5f0e3805cbe4 src/share/vm/runtime/globals.hpp
--- a/src/share/vm/runtime/globals.hpp Wed Sep 07 02:57:30 2016 +0200
+++ b/src/share/vm/runtime/globals.hpp Wed Sep 07 03:03:18 2016 +0200
@@ -4044,8 +4044,8 @@
diagnostic(int, CompilerDirectivesLimit, 50, \
"Limit on number of compiler directives.") \
\
- product(bool, JBreak, false, \
- "Enable some JBreak specific enhancements")
+ product(bool, JETConf, false, \
+ "Enable some JETConf specific enhancements")


/*
22 changes: 22 additions & 0 deletions examples/src/org/simonis/ArrayCopy.java
@@ -0,0 +1,22 @@
package org.simonis;

public class ArrayCopy {

public static boolean arraycopy(Object[] src, int length) {
try {
System.arraycopy(src, 1, new Object[8], 1, length);
return false;
} catch (IndexOutOfBoundsException e) {
return true;
}
}

public static void main(String args[]){
int count = Integer.parseInt(args[0]);

for (int x = 0; x < count; x++) {
if (arraycopy(new Object[8], -1) == false)
throw new RuntimeException("Expected IndexOutOfBoundsException for System.arracopy(.., -1)");
}
}
}
2 changes: 1 addition & 1 deletion examples/src/org/simonis/HelloWorld.java
Expand Up @@ -5,7 +5,7 @@
public class HelloWorld {

public static void sayHello() {
System.out.println("Hello JavaZone!");
System.out.println("Hello JETConf!");
}
public static void main(String ... args) {

Expand Down
7 changes: 3 additions & 4 deletions examples/src/org/simonis/Loop.java
Expand Up @@ -10,12 +10,11 @@ static double compute(int count, double d) {
}

public static void main(String[] args) throws Exception {
double seed = Double.parseDouble(args[0]);
int warmup = Integer.parseInt(args[1]);
int count = Integer.parseInt(args[2]);
double seed = args.length; // Just to avoid constant folding
int count = Integer.parseInt(args[0]); // Iteration count for compute()

for (int i = 0; i < 20_000; i++) {
compute(warmup, seed);
compute(1, seed); // Call compute() until it gets JIT-compiled
}

compute(count, seed);
Expand Down
7 changes: 3 additions & 4 deletions examples/src/org/simonis/LoopWithGC.java
Expand Up @@ -10,12 +10,11 @@ static double compute(int count, double d) {
}

public static void main(String[] args) throws Exception {
double seed = Double.parseDouble(args[0]);
int warmup = Integer.parseInt(args[1]);
int count = Integer.parseInt(args[2]);
double seed = args.length; // Just to avoid constant folding
int count = Integer.parseInt(args[0]); // Iteration count for compute()

for (int i = 0; i < 20_000; i++) {
compute(warmup, seed);
compute(1, seed); // Call compute() until it gets JIT-compiled
}

new Thread() {
Expand Down
Binary file added images/6869327_counted_loop_safep.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/8013579_intrinsics_class_redef.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/8159611_ArrayCopy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions images/ArrayCopy.fig
@@ -0,0 +1,21 @@
#FIG 3.2 Produced by xfig version 3.2.5c
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 2925 3150 4500 3825
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
2925 3150 4500 3150 4500 3825 2925 3825 2925 3150
4 0 0 50 -1 14 16 0.0000 4 180 1155 3150 3600 Const 8\001
-6
6 5175 3150 6750 3825
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
5175 3150 6750 3150 6750 3825 5175 3825 5175 3150
4 0 0 50 -1 14 16 0.0000 4 180 1155 5400 3600 Const 1\001
-6
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
2700 900 3870 900 3870 1350 2700 1350 2700 900
101 changes: 101 additions & 0 deletions images/ArrayCopy_intrinsic.html
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?><table class="calling_hirarchy">
<tr>
<td colspan="10" class="functionCall indent_level_3">
<code>Compile::Compile(compiler=0x7ffff01a0a60, target=0x7fffc4299130)</code>
</td>
</tr>
<tr>
<td rowspan="16">&nbsp;</td>
<td colspan="9" class="functionCall indent_level_4">
<code>ParseGenerator::generate()</code>
</td>
</tr>
<tr>
<td rowspan="8">&nbsp;</td>
<td colspan="8" class="functionCall indent_level_5">
<code>Parse::Parse(caller=0x7fffc440de00, parse_method=0x7fffc4299130)</code>
</td>
</tr>
<tr>
<td rowspan="7">&nbsp;</td>
<td colspan="7" class="functionCall indent_level_6">
<code>Parse::do_all_blocks()</code>
</td>
</tr>
<tr>
<td rowspan="6">&nbsp;</td>
<td colspan="6" class="functionCall indent_level_7">
<code>Parse::do_one_block()</code>
</td>
</tr>
<tr>
<td rowspan="5">&nbsp;</td>
<td colspan="5" class="functionCall indent_level_8">
<code>Parse::do_one_bytecode()</code>
</td>
</tr>
<tr>
<td rowspan="4">&nbsp;</td>
<td colspan="4" class="functionCall indent_level_9">
<code>Parse::do_call()</code>
</td>
</tr>
<tr>
<td rowspan="3">&nbsp;</td>
<td colspan="3" class="functionCall indent_level_10">
<code>LibraryIntrinsic::generate()</code>
</td>
</tr>
<tr>
<td rowspan="2">&nbsp;</td>
<td colspan="2" class="functionCall indent_level_11">
<code>LibraryCallKit::try_to_inline(id=vmIntrinsics::_arraycopy)</code>
</td>
</tr>
<tr>
<td rowspan="1">&nbsp;</td>
<td colspan="1" class="functionCall indent_level_12">
<code>LibraryCallKit::inline_arraycopy()</code>
</td>
</tr>
<tr>
<td colspan="9" class="functionCall indent_level_4">
<code>Compile::optimze()</code>
</td>
</tr>
<tr>
<td rowspan="6">&nbsp;</td>
<td colspan="8" class="functionCall indent_level_5">
<code>PhaseMacroExpand::eliminate_macro_nodes()</code>
</td>
</tr>
<tr>
<td rowspan="2">&nbsp;</td>
<td colspan="7" class="functionCall indent_level_6">
<code>PhaseMacroExpand::eliminate_allocate_node(AllocateNode*, ...)</code>
</td>
</tr>
<tr>
<td rowspan="1">&nbsp;</td>
<td colspan="6" class="functionCall indent_level_7">
<code>PhaseMacroExpand::process_users_of_allocation()</code>
</td>
</tr>
<tr>
<td colspan="8" class="functionCall indent_level_5">
<code>PhaseMacroExpand::expand_macro_nodes()</code>
</td>
</tr>
<tr>
<td rowspan="2">&nbsp;</td>
<td colspan="7" class="functionCall indent_level_6">
<code>PhaseMacroExpand::expand_arraycopy_node(ArrayCopyNode*)</code>
</td>
</tr>
<tr>
<td rowspan="1">&nbsp;</td>
<td colspan="6" class="functionCall indent_level_7">
<code>PhaseMacroExpand::generate_arraycopy(ArrayCopyNode*, AllocateNode*, ...)</code>
</td>
</tr>
</table>
17 changes: 17 additions & 0 deletions images/ArrayCopy_intrinsic.txt
@@ -0,0 +1,17 @@
f Compile::Compile(compiler=0x7ffff01a0a60, target=0x7fffc4299130)
f ParseGenerator::generate()
f Parse::Parse(caller=0x7fffc440de00, parse_method=0x7fffc4299130)
f Parse::do_all_blocks()
f Parse::do_one_block()
f Parse::do_one_bytecode()
f Parse::do_call()
f LibraryIntrinsic::generate()
f LibraryCallKit::try_to_inline(id=vmIntrinsics::_arraycopy)
f LibraryCallKit::inline_arraycopy()
f Compile::optimze()
f PhaseMacroExpand::eliminate_macro_nodes()
f PhaseMacroExpand::eliminate_allocate_node(AllocateNode*, ...)
f PhaseMacroExpand::process_users_of_allocation()
f PhaseMacroExpand::expand_macro_nodes()
f PhaseMacroExpand::expand_arraycopy_node(ArrayCopyNode*)
f PhaseMacroExpand::generate_arraycopy(ArrayCopyNode*, AllocateNode*, ...)
19 changes: 19 additions & 0 deletions images/ArrayCopy_intrinsic.xml
@@ -0,0 +1,19 @@
<calling_hirarchy>
<call level='3' type='functionCall '><code>Compile::Compile(compiler=0x7ffff01a0a60, target=0x7fffc4299130)</code></call>
<call level='4' type='functionCall '><code>ParseGenerator::generate()</code></call>
<call level='5' type='functionCall '><code>Parse::Parse(caller=0x7fffc440de00, parse_method=0x7fffc4299130)</code></call>
<call level='6' type='functionCall '><code>Parse::do_all_blocks()</code></call>
<call level='7' type='functionCall '><code>Parse::do_one_block()</code></call>
<call level='8' type='functionCall '><code>Parse::do_one_bytecode()</code></call>
<call level='9' type='functionCall '><code>Parse::do_call()</code></call>
<call level='10' type='functionCall '><code>LibraryIntrinsic::generate()</code></call>
<call level='11' type='functionCall '><code>LibraryCallKit::try_to_inline(id=vmIntrinsics::_arraycopy)</code></call>
<call level='12' type='functionCall '><code>LibraryCallKit::inline_arraycopy()</code></call>
<call level='4' type='functionCall '><code>Compile::optimze()</code></call>
<call level='5' type='functionCall '><code>PhaseMacroExpand::eliminate_macro_nodes()</code></call>
<call level='6' type='functionCall '><code>PhaseMacroExpand::eliminate_allocate_node(AllocateNode*, ...)</code></call>
<call level='7' type='functionCall '><code>PhaseMacroExpand::process_users_of_allocation()</code></call>
<call level='5' type='functionCall '><code>PhaseMacroExpand::expand_macro_nodes()</code></call>
<call level='6' type='functionCall '><code>PhaseMacroExpand::expand_arraycopy_node(ArrayCopyNode*)</code></call>
<call level='7' type='functionCall '><code>PhaseMacroExpand::generate_arraycopy(ArrayCopyNode*, AllocateNode*, ...)</code></call>
</calling_hirarchy>

0 comments on commit 064ae5b

Please sign in to comment.