Skip to content

Instantly share code, notes, and snippets.

@headius
Created January 31, 2023 17:44
Show Gist options
  • Save headius/ff51eb78bad7213e3c30e9dca2482d69 to your computer and use it in GitHub Desktop.
Save headius/ff51eb78bad7213e3c30e9dca2482d69 to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/runtime/ThreadContext.java b/core/src/main/java/org/jruby/runtime/ThreadContext.java
index 5708fd2685..df67cad843 100644
--- a/core/src/main/java/org/jruby/runtime/ThreadContext.java
+++ b/core/src/main/java/org/jruby/runtime/ThreadContext.java
@@ -489,7 +489,7 @@ public final class ThreadContext {
public void pushEvalSimpleFrame(IRubyObject executeObject) {
Frame frame = getCurrentFrame();
- pushCallFrame(frame.getKlazz(), frame.getName(), executeObject, Block.NULL_BLOCK);
+ pushCallFrame(frame.getKlazz(), frame.getName(), executeObject, frame.getBlock());
}
private void pushCallFrame(RubyModule clazz, String name,
diff --git a/core/src/main/java/org/jruby/runtime/marshal/UnmarshalCache.java b/core/src/main/java/org/jruby/runtime/marshal/UnmarshalCache.java
index 3bb2af69be..870d7d52be 100644
--- a/core/src/main/java/org/jruby/runtime/marshal/UnmarshalCache.java
+++ b/core/src/main/java/org/jruby/runtime/marshal/UnmarshalCache.java
@@ -33,7 +33,9 @@ package org.jruby.runtime.marshal;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.IdentityHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.jruby.Ruby;
@@ -44,22 +46,22 @@ public class UnmarshalCache {
private final Ruby runtime;
private final List<IRubyObject> links = new ArrayList<>();
private final List<RubySymbol> symbols = new ArrayList<>();
- private final Set<IRubyObject> partials = new HashSet<>();
+ private final Map<IRubyObject, IRubyObject> partials = new IdentityHashMap<>();
public UnmarshalCache(Ruby runtime) {
this.runtime = runtime;
}
public boolean isPartialObject(IRubyObject value) {
- return partials.contains(value.id());
+ return partials.containsKey(value);
}
public void markAsPartialObject(IRubyObject value) {
- partials.add(value.id());
+ partials.put(value, value);
}
public void noLongerPartial(IRubyObject value) {
- partials.remove(value.id());
+ partials.remove(value);
}
public IRubyObject readSymbolLink(UnmarshalStream input) throws IOException {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment