Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bf60762d425e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: eef603d6421a
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 26, 2016

  1. Copy the full SHA
    aa1f5df View commit details
  2. Copy the full SHA
    eef603d View commit details
Showing with 18 additions and 2 deletions.
  1. +1 −1 core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
  2. +17 −1 core/src/main/java/org/jruby/runtime/callsite/CachingCallSite.java
Original file line number Diff line number Diff line change
@@ -1861,7 +1861,7 @@ public static RubyString freezeLiteralString(ThreadContext context, RubyString s

@JIT
public static IRubyObject callOptimizedAref(ThreadContext context, IRubyObject caller, IRubyObject target, RubyString keyStr, CallSite site) {
if (target instanceof RubyHash && ((CachingCallSite) site).retrieveCache(target.getMetaClass(), "[]").method.isBuiltin()) {
if (target instanceof RubyHash && ((CachingCallSite) site).isBuiltin(target.getMetaClass())) {
// call directly with cached frozen string
return ((RubyHash) target).op_aref(context, keyStr);
}
Original file line number Diff line number Diff line change
@@ -267,9 +267,25 @@ public CacheEntry retrieveCache(RubyClass selfType, String methodName) {
return cacheAndGet(selfType, methodName);
}

public boolean isBuiltin(RubyClass selfType) {
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.isBuiltin();
}
return cacheAndGetBuiltin(selfType, methodName);
}

private CacheEntry cacheAndGet(RubyClass selfType, String methodName) {
CacheEntry entry = selfType.searchWithCache(methodName);
return cache = entry;
if (!entry.method.isUndefined()) cache = entry;
return entry;
}

private boolean cacheAndGetBuiltin(RubyClass selfType, String methodName) {
CacheEntry entry = selfType.searchWithCache(methodName);
if (!entry.method.isUndefined()) return false;
return entry.method.isBuiltin();
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, Block block, IRubyObject[] args, ThreadContext context, IRubyObject self) {