Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles Oliver Nutter headius

View GitHub Profile
@headius
headius / command_lines.txt
Last active Sep 25, 2020
Simple JavaFX app in JRuby
View command_lines.txt
java --module-path /Users/headius/Downloads/javafx-sdk-15/lib --add-modules javafx.controls \
-Djruby.home=`pwd` -cp lib/jruby.jar org.jruby.Main javafx2.rb
jruby -e 'Dir["/Users/headius/Downloads/javafx-sdk-15/lib/*.jar"].each {|f| require f}; load "javafx2.rb"'
@headius
headius / output.txt
Created Sep 11, 2020
Using versions:display-plugin-updates to show Maven plugin version negotiation
View output.txt
[] ~/projects/jnr-ffi $ mvn versions:display-plugin-updates
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.github.jnr:jnr-ffi >-----------------------
[INFO] Building jnr-ffi 2.2.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.8.1:display-plugin-updates (default-cli) @ jnr-ffi ---
[INFO]
[INFO] The following plugin updates are available:
@headius
headius / 1.patch.diff
Created Sep 3, 2020
Hacky patch for "unloaded classes" and resulting inlined code
View 1.patch.diff
diff --git a/core/src/main/java/org/jruby/ir/targets/JVM.java b/core/src/main/java/org/jruby/ir/targets/JVM.java
index c24a8524a9..a630941524 100644
--- a/core/src/main/java/org/jruby/ir/targets/JVM.java
+++ b/core/src/main/java/org/jruby/ir/targets/JVM.java
@@ -3,6 +3,7 @@ package org.jruby.ir.targets;
import com.headius.invokebinder.Signature;
import org.jruby.RubyInstanceConfig;
import org.jruby.RubyModule;
+import org.jruby.compiler.impl.SkinnyMethodAdapter;
import org.jruby.ir.IRScope;
View ruby_2_5_8_webrick_1_4_2.diff
Only in ../ruby/lib/webrick/: .document
diff -r -u lib/webrick/cgi.rb ../ruby/lib/webrick/cgi.rb
--- lib/webrick/cgi.rb 2020-06-29 08:32:08.000000000 -0500
+++ ../ruby/lib/webrick/cgi.rb 2020-06-29 07:03:43.000000000 -0500
@@ -265,6 +265,10 @@
@out_port << data
end
+ def write(data)
+ @out_port.write(data)
@headius
headius / webrick_1_4_2.diff
Last active Jun 29, 2020
Diffs from WEBrick 1.4.2 in the ruby/webrick repository versus CRuby's ruby_2_6 branch lib/webrick
View webrick_1_4_2.diff
diff --git a/../ruby/lib/webrick/.document b/../ruby/lib/webrick/.document
new file mode 100644
index 0000000..c62f890
--- /dev/null
+++ b/../ruby/lib/webrick/.document
@@ -0,0 +1,6 @@
+# Add files to this as they become documented
+
+*.rb
+
@headius
headius / .diff
Created Jun 22, 2020
Attempting to make JavaAccessibleObject use module logic
View .diff
diff --git a/core/pom.rb b/core/pom.rb
index e782155852..db60cec60b 100644
--- a/core/pom.rb
+++ b/core/pom.rb
@@ -73,7 +73,7 @@ project 'JRuby Core' do
jar 'me.qmx.jitescript:jitescript:0.4.1', :exclusions => ['org.ow2.asm:asm-all']
- jar 'com.headius:backport9:1.7'
+ jar 'com.headius:backport9:1.8-SNAPSHOT'
View gist:e8070601dbbb7ee49424ea974fcf5858
JRuby 9.3 + invokedynamic + parallel GC on Java 13
Warming up --------------------------------------
fastrandom 435.445k i/100ms
random 578.741k i/100ms
Calculating -------------------------------------
fastrandom 13.264M (±26.4%) i/s - 56.172M in 5.002513s
random 24.357M (±27.6%) i/s - 94.335M in 5.000926s
CRuby 2.7 from RVM
@headius
headius / BrokenURLClassLoader.java
Last active Jun 6, 2020
Example case for how URLClassLoader breaks the JarFile cache
View BrokenURLClassLoader.java
import java.net.*;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* To run, first create a jar file:
*
* $ touch blah.txt
* $ jar cf blah.jar blah.txt
@headius
headius / jffi.diff
Last active May 7, 2020
Naive support for LD_PRELOAD in jffi and jnr-posix
View jffi.diff
diff --git a/src/main/java/com/kenai/jffi/Library.java b/src/main/java/com/kenai/jffi/Library.java
index 9ce61fd..6ec78e3 100644
--- a/src/main/java/com/kenai/jffi/Library.java
+++ b/src/main/java/com/kenai/jffi/Library.java
@@ -149,12 +149,17 @@ public final class Library {
* null if the library cannot be opened.
*/
public static final Library openLibrary(String name, int flags) {
+ final Foreign foreign = Foreign.getInstance();
+
@headius
headius / example.txt
Last active Apr 28, 2020
Example of module appearing to be open when it is not (https://github.com/jruby/jruby/issues/6189)
View example.txt
[] ~/projects/jruby $ cat ModuleThing.java
public class ModuleThing {
public static void main(String[] args) throws Exception {
Class cls = sun.nio.ch.NativeThread.class;
java.lang.reflect.Method method = cls.getDeclaredMethod("signal", long.class);
System.out.println("isOpen: " + cls.getModule().isOpen(cls.getPackage().getName(), ModuleThing.class.getModule()));
method.setAccessible(true);
}
}
You can’t perform that action at this time.