Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
rednaxelafx / java_error_28522.short.extra.log
Created May 3, 2012 09:05
A HotSpot crash log example of a crash caused by a bug in the C2 compiler (7070134)
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00002aaf0d11c031, pid=28522, tid=1104951616
#
# JRE version: 6.0_23-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (19.0-b09 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V [libjvm.so+0x593031]
#
@rednaxelafx
rednaxelafx / StackOverflowCrashDemo.h
Created May 2, 2012 06:27
demo of a Java-level stack overflow causing a native crash
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class StackOverflowCrashDemo */
#ifndef _Included_StackOverflowCrashDemo
#define _Included_StackOverflowCrashDemo
#ifdef __cplusplus
extern "C" {
#endif
/*
diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
index 818895c..4b1278a 100644
--- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -383,7 +383,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
UString separator;
if (!exec->argument(0).isUndefined())
- separator = exec->argument(0).toString(exec)->value(exec);
+ separator = fastJSValuetoUString(exec->argument(0), exec);
@rednaxelafx
rednaxelafx / .hotspot_compiler
Created March 6, 2012 13:18
Example (XS) of adding an intrinsic method to HotSpot C2. Patch against HS20-b12
exclude Main main
dontinline Main doTest
compileonly Main doTest
compileonly FxIntrinsics *
@rednaxelafx
rednaxelafx / DirectMemorySize.java
Created January 11, 2012 07:18
An Serviceability-Agent based tool to see stats of NIO direct memory, as an alternative on JDK6 without JMX support for direct memory monitoring. Only works on JDK6; to work on JDK7 will need some tweaking because static variables are moved to Java mirror
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.tools.*;
import sun.jvm.hotspot.utilities.*;
public class DirectMemorySize extends Tool {
@psineur
psineur / UIWebViewWithDebug.m
Created December 12, 2011 17:35
UIWebView with js Debugger.
/** @class UIWebViewWithDebug UIWebView with additional js error on DEBUG.
* Tested on iPad with 4.3.5 & 5.0
*/
@interface UIWebViewWithDebug : UIWebView {} @end
#ifdef DEBUG
@class WebView;
@class WebScriptCallFrame;
@class WebFrame;
@steipete
steipete / ARCCheck.m
Created December 5, 2011 22:26
Don't be a fool and wonder why nothing is working... ADD THIS CHECK.
// ARC is compatible with iOS 4.0 upwards, but you need at least Xcode 4.2 with Clang LLVM 3.0 to compile it.
#if !defined(__clang__) || __clang_major__ < 3 || !__has_feature(objc_arc)
#error This project must be compiled with ARC (Xcode 4.2+ with LLVM 3.0 and above)
#endif
@mklabs
mklabs / bootstrap-plugins.txt
Created December 2, 2011 11:23
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@huandu
huandu / class.js
Created August 15, 2011 05:14
A way to define javascript class. support multiple base class and static method.
(function(window, undefined) {
var Abstract = function() {
return arguments.callee;
},
Static = function(cb) {
this.cb = cb;
},
/**
* define your class.
*
@adeel
adeel / UILabel+withString.h
Created July 21, 2011 22:36
UILabel category that adds a method to easily make labels on the fly.
//
// UILabel+withString.h
//
#import <Foundation/Foundation.h>
@interface UILabel (withString)
+ (UILabel *)labelWithString:(NSString *)string
font:(UIFont *)font