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
public class TrapDemo { | |
public static void demo(IntBox p) { | |
int dead = p.value; | |
if (p == null) return; | |
p.value = 42; | |
} | |
public static void main(String[] args) throws Exception { | |
demo(null); | |
} |
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
$ javap -verbose -c -s -l -private Demo\$\$Lambda\$1 | |
Classfile /private/tmp/Demo$$Lambda$1.class | |
Last modified Oct 12, 2016; size 754 bytes | |
MD5 checksum 81ce9dafbca34417b2dfa94f596a85a1 | |
final class Demo$$Lambda$1 implements org.apache.spark.api.java.function.VoidFunction | |
minor version: 0 | |
major version: 52 | |
flags: ACC_FINAL, ACC_SUPER, ACC_SYNTHETIC | |
Constant pool: | |
#1 = Utf8 Demo$$Lambda$1 |
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
.class public Demo | |
.super java/lang/Object | |
.field public static dummy I | |
.method public static foo(Ljava/lang/Object;Ljava/lang/Object;Z)V | |
.limit stack 2 | |
.limit locals 3 | |
iload_2 |
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
import java.util.*; | |
public class HashMapStackOverflow { | |
public static void main(String[] args) throws Exception { | |
HashMap<String, Object> map = new HashMap<>(); | |
map.put("self", map); | |
System.out.println(map.hashCode()); | |
} | |
} |
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
$ clang++ -S -emit-llvm yy.cc |
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
#include <iostream> | |
// #include <jit/jit-dump.h> | |
#include <jit/jit-plus.h> | |
// Create an example function equivalent to: | |
// int foo(int x, int y, int z) { | |
// return x + y * z; | |
// } | |
jit_function create_example_foo(jit_context& context, int opt_level) { | |
jit_type_t signature = jit_function::signature_helper( |
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
import java.util.*; | |
public class TestVec { | |
public static int[] doTest(int[] xs, int[] ys) { | |
if (xs.length != ys.length) return null; | |
int[] zs = new int[xs.length]; | |
for (int i = 0; i < xs.length; i++) { | |
zs[i] = xs[i] * ys[i]; | |
} | |
return zs; |
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
exclude SubtypeTest main | |
dontinline SubtypeTest * | |
compileonly SubtypeTest driver | |
compileonly SubtypeTest getObject |
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
diff -r 9d39e8a8ff61 src/share/vm/opto/subnode.cpp | |
--- a/src/share/vm/opto/subnode.cpp Fri Dec 27 07:51:07 2013 -0800 | |
+++ b/src/share/vm/opto/subnode.cpp Wed Feb 12 14:59:00 2014 -0800 | |
@@ -1206,6 +1206,40 @@ | |
Node *ncmp = phase->transform( new (phase->C) CmpINode(cmp1->in(2),cmp2)); | |
return new (phase->C) BoolNode( ncmp, _test.commute() ); | |
} | |
+ | |
+ // Change ((x & m) <= m) into (m >= 0) | |
+ // Integer expressions which perform bitwise and can be proven to |
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
// Pseudo-code that implements Cheney's algorithm | |
class Object { | |
// remains null for normal objects | |
// non-null for forwarded objects | |
Object* _forwardee; | |
public: | |
void forward_to(address new_addr); | |
Object* forwardee(); |