Skip to content

Instantly share code, notes, and snippets.

View rednaxelafx's full-sized avatar

Kris Mok rednaxelafx

View GitHub Profile
+PrintCompilation
-BackgroundCompilation
PrintIdealGraphLevel=4
PrintIdealGraphFile=ideal.xml
CICompilerCount=1
-TieredCompilation
CompileCommand=exclude,Main,logError
@rednaxelafx
rednaxelafx / .hotspotrc
Created June 25, 2012 06:04
Reproduce the OptimizeStringConcat bug in JDK7u4/HS23, as mentioned by Riven here: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2012-June/007916.html
+PrintCompilation
-BackgroundCompilation
PrintIdealGraphLevel=4
PrintIdealGraphFile=ideal.xml
CICompilerCount=1
@rednaxelafx
rednaxelafx / FileInputStream.modified.java
Created June 19, 2012 03:55
The effects of running the FinalizeTracker sample in BTrace
package java.io;
import com.sun.btrace.BTraceRuntime;
import com.sun.btrace.BTraceUtils;
import com.sun.btrace.samples.FinalizeTracker;
import java.nio.channels.FileChannel;
import sun.nio.ch.FileChannelImpl;
public
class FileInputStream extends InputStream
@rednaxelafx
rednaxelafx / compile.cpp
Created June 18, 2012 03:59
-XX:+OptoNoExecute would lead to assertions hit, because the resources have been freed already. Should add a check in record_failure() to avoid hitting assertion.
void Compile::record_failure(const char* reason) {
if (log() != NULL) {
log()->elem("failure reason='%s' phase='compile'", reason);
}
if (_failure_reason == NULL) {
// Record the first failure reason.
_failure_reason = reason;
}
if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())
&& !(OptoNoExecute && reason == "+OptoNoExecute")) {
@rednaxelafx
rednaxelafx / Notes.md
Created June 8, 2012 16:55
adding an int field after _metadata in oopDesc crashes the VM on x64

The problematic function, in src/share/vm/oops/arrayOop.hpp

  // The _length field is not declared in C++.  It is allocated after the
  // declared nonstatic fields in arrayOopDesc if not compressed, otherwise
  // it occupies the second half of the _klass field in oopDesc.
  static int length_offset_in_bytes() {
    return UseCompressedOops ? klass_gap_offset_in_bytes() :
                               sizeof(arrayOopDesc);
 }
@rednaxelafx
rednaxelafx / remove_AtomicLongCSImpl_hotspot.patch
Created June 5, 2012 17:23
7174218: remove AtomicLongCSImpl intrinsics
diff -r 8f37087fc13f src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp
--- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Tue Jun 05 10:15:27 2012 +0200
+++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Jun 06 01:15:36 2012 +0800
@@ -644,30 +644,6 @@
}
-void LIRGenerator::do_AttemptUpdate(Intrinsic* x) {
- assert(x->number_of_arguments() == 3, "wrong type");
- LIRItem obj (x->argument_at(0), this); // AtomicLong object
@rednaxelafx
rednaxelafx / mark.patch
Created June 5, 2012 13:28
In MarkSweep::mark_and_push(), skip pushing objects onto the mark stack if they don't have oops? This patch isn't complete yet, because the object header has to be taken care of, too
diff -r 2040997cba56 src/share/vm/gc_implementation/shared/markSweep.inline.hpp
--- a/src/share/vm/gc_implementation/shared/markSweep.inline.hpp Fri Jun 01 14:12:10 2012 -0700
+++ b/src/share/vm/gc_implementation/shared/markSweep.inline.hpp Tue Jun 05 21:26:00 2012 +0800
@@ -70,7 +70,9 @@
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
if (!obj->mark()->is_marked()) {
mark_object(obj);
- _marking_stack.push(obj);
+ if (obj->blueprint()->nonstatic_oop_map_size() > 0) {
+ _marking_stack.push(obj);
@rednaxelafx
rednaxelafx / c1_isInstance.patch
Created May 29, 2012 19:28
First cut: C1 Class.isInstance intrinsic
diff -r 4d8787136e08 src/share/vm/c1/c1_Canonicalizer.cpp
--- a/src/share/vm/c1/c1_Canonicalizer.cpp Fri May 25 11:39:13 2012 -0700
+++ b/src/share/vm/c1/c1_Canonicalizer.cpp Wed May 30 03:21:56 2012 +0800
@@ -451,6 +451,28 @@
}
break;
}
+ case vmIntrinsics::_isInstance : {
+ assert(x->number_of_arguments() == 2, "wrong type");
+
@rednaxelafx
rednaxelafx / c1_fix_printable_bci.patch
Created May 29, 2012 18:46
C1: fix "assert(has_printable_bci()) failed: _printable_bci should have been set" when using -XX:+PrintCanonicalization
diff -r 4d8787136e08 src/share/vm/c1/c1_Canonicalizer.cpp
--- a/src/share/vm/c1/c1_Canonicalizer.cpp Fri May 25 11:39:13 2012 -0700
+++ b/src/share/vm/c1/c1_Canonicalizer.cpp Wed May 30 02:29:42 2012 +0800
@@ -42,6 +42,11 @@
// the instruction stream (because the instruction list is embedded
// in the instructions).
if (canonical() != x) {
+#ifndef PRODUCT
+ if (!x->has_printable_bci()) {
+ x->set_printable_bci(bci());
@rednaxelafx
rednaxelafx / Foo.java
Created May 27, 2012 14:30
HotSpot C1 always uses implicit null checks for inlined non-static intrinsics, even if -XX:-ImplicitNullChecks is given
public class Foo {
public static Class<?> test(Object obj) {
return obj.getClass();
}
public static void main(String[] args) throws Exception {
try {
test(null);
} catch (Exception e) { }
System.in.read();