Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

java_import java.util.HashMap
class Extend < HashMap
def initialize(a, b)
c = a
p c
super
end
end

You can see I added a try/finally where I construct a new dynamic scope for the static scope of the split method. This is not really in the right place since this same dynamicscope needs to be used for both interpret calls.

So you need to make equivalent try/finally in your asm logic where you push a new scope and pop it.

One thing which is a little foggy is that you can probably always push the extra dynamic scope but if it is not actually going to call into the interpreter there is no need to do it. So best solution might be to emit two versions instead of just one which handles the split and non-split case.

RootNode line: 0
DefnNode*:initialize line: 0
ArgsNode line: 1
ListNode line: 1
ListNode line: 1
ListNode line: 1
ListNode line: 1
EnsureNode line: 1
SuperNode* line: 1
ArrayNode line: 1
@enebo
enebo / aaa.rb
Created September 24, 2020 18:35
require 'java'
class HelloFX < Java::javafx::application::Application
def start(stage)
l = Java::javafx.scene.control.Label.new "Hello, JavaFX"
scene = Java::javafx.scene.Scene.new(Java::javafx.scene.layout.StackPane.new(l), 640, 480);
stage.setScene scene
stage.show
end
end
@enebo
enebo / err.rb
Created September 22, 2020 17:43
#v = [0]
v = Object.new
v[0] += raise("fff") rescue 1
p v
#<Object:0x31206beb>
@enebo
enebo / aaa.rb
Created September 15, 2020 15:25
module A
end
A.const_set :qux, 1
class Foo
def to_str
puts "Foo#to_str"
"to_str"
end
def ==(other)
puts "Foo#== #{other}"
other == to_str
end
def even?(number)
number.even?
end
def foo
a = Object.new
class << a
proc { return 1 }.call
end
end
p foo
diff --git a/core/src/main/java/org/jruby/util/ConvertBytes.java b/core/src/main/java/org/jruby/util/ConvertBytes.java
index 644d46da13..a2d4a8709d 100644
--- a/core/src/main/java/org/jruby/util/ConvertBytes.java
+++ b/core/src/main/java/org/jruby/util/ConvertBytes.java
@@ -176,10 +176,13 @@ public class ConvertBytes {
if (neg) newSize++;
string.resize(newSize);
ByteList byteList = string.getByteList();
+ byte[] bytes = byteList.getUnsafeBytes();
+ int beg = byteList.begin();