Skip to content

Instantly share code, notes, and snippets.

package my.example;
import java.util.Arrays;
import java.util.List;
import org.jruby.embed.AttributeName;
import org.jruby.embed.PathType;
import org.jruby.embed.ScriptingContainer;
public class Main {
public static void main(String[] args) {
diff --git a/src/org/jruby/RubyDir.java b/src/org/jruby/RubyDir.java
index a8d9508..19d5089 100644
--- a/src/org/jruby/RubyDir.java
+++ b/src/org/jruby/RubyDir.java
@@ -392,11 +392,10 @@ public class RubyDir extends RubyObject {
@JRubyMethod(name = "mkdir", required = 1, optional = 1, meta = true, compat = CompatVersion.RUBY1_8)
public static IRubyObject mkdir(IRubyObject recv, IRubyObject[] args) {
Ruby runtime = recv.getRuntime();
- runtime.checkSafeString(args[0]);
+ RubyString stringArg = args[0].convertToString();
run-junit-interpreted:
[echo] compile=OFF, jit.threshold=20, jit.maxsize=1000000000, jit.max=-1, objectspace=true threadpool=false reflection=false version=ruby1_8
[junit] Testsuite: org.jruby.test.ScriptTestSuite
[junit] Tests run: 79, Failures: 0, Errors: 0, Time elapsed: 18.043 sec
[junit]
[junit] Testsuite: org.jruby.test.BFTSTestSuite
[junit] Tests run: 11, Failures: 0, Errors: 0, Time elapsed: 1.505 sec
[junit]
[junit] Testsuite: org.jruby.test.JRubyTestSuite
[junit] no such file to load -- bundler/commands/bundle_command
def foo(a)
end
def foo(a)
end
class Foo
attr_reader :a
def foo(a)
@a = $a = a
end
end
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {
InterpreterContext interp = new IRInterpreterContext(context, self, args);
BasicBlock basicBlock = cfg.getEntryBB();
BasicBlock jumpBlock = basicBlock;
while (basicBlock != null) {
// System.out.println("BB:" + basicBlock);
for (Instr instruction : basicBlock.getInstrs()) {
try {
@Interp
public Iterator<LocalVariable> getLiveLocalVariables() {
Map<LocalVariable, Integer> ends = new HashMap<LocalVariable, Integer>();
Map<LocalVariable, Integer> starts = new HashMap<LocalVariable, Integer>();
Set<LocalVariable> variables = new TreeSet<LocalVariable>();
for (int i = instructions.size() - 1; i >= 0; i--) {
Instr instr = instructions.get(i);
Variable variable = instr.result;
Pre-massive refactoring:
./bin/sample small_enum_bench
drives.each 250 of 120 calls: 6.265000 0.000000 6.265000 ( 6.172000)
drives.each 250 of 120 calls: 4.312000 0.000000 4.312000 ( 4.312000)
drives.each 250 of 120 calls: 5.625000 0.000000 5.625000 ( 5.625000)
drives.each 250 of 120 calls: 4.469000 0.000000 4.469000 ( 4.469000)
drives.each 250 of 120 calls: 4.469000 0.000000 4.469000 ( 4.469000)
drives.each 250 of 120 calls: 4.531000 0.000000 4.531000 ( 4.531000)
drives.each 250 of 120 calls: 5.078000 0.000000 5.078000 ( 5.078000)
class GCEvent < Struct.new(:name, :before, :after, :total, :time)
end
def tally(name)
$gc_events.inject(0) do |memo, event|
memo += event.time if event.name == name
memo
end
end