Skip to content

Commit 8e783d9

Browse files
committed
Eliminate String::Extend weak reference
Rarely used, mostly at boot, and probably just as quick to look up the constant as go through the weak reference.
1 parent cbcc74b commit 8e783d9

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

java/src/json/ext/GeneratorMethods.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ private static RubyHash toJsonRawObject(ThreadContext context,
171171
}
172172

173173
@JRubyMethod(module=true)
174-
public static IRubyObject included(ThreadContext context, IRubyObject vSelf, IRubyObject module) {
174+
public static IRubyObject included(ThreadContext context, IRubyObject extendModule, IRubyObject module) {
175175
RuntimeInfo info = RuntimeInfo.forRuntime(context.runtime);
176-
return module.callMethod(context, "extend", info.stringExtendModule.get());
176+
return module.callMethod(context, "extend", ((RubyModule) extendModule).getConstant("Extend"));
177177
}
178178
}
179179

java/src/json/ext/RuntimeInfo.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ final class RuntimeInfo {
2828
// the Ruby runtime object, which would cause memory leaks in the runtimes map above.
2929
/** JSON */
3030
WeakReference<RubyModule> jsonModule;
31-
/** JSON::Ext::Generator::GeneratorMethods::String::Extend */
32-
WeakReference<RubyModule> stringExtendModule;
3331
/** JSON::Ext::Generator::State */
3432
WeakReference<RubyClass> generatorStateClass;
3533
/** JSON::SAFE_STATE_PROTOTYPE */

0 commit comments

Comments
 (0)