Skip to content

Commit

Permalink
Reorder args to match others in call path
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Mar 23, 2023
1 parent f1ce425 commit 9c5b3cc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 40 deletions.
48 changes: 20 additions & 28 deletions core/src/main/java/org/jruby/runtime/callsite/CachingCallSite.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, args);
}
return cacheAndCall(caller, selfType, args, context, self);
return cacheAndCall(context, caller, self, selfType, args);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, IRubyObject... args) {
Expand All @@ -89,7 +89,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, args, block);
}
return cacheAndCall(caller, selfType, block, args, context, self);
return cacheAndCall(context, caller, self, selfType, args, block);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) {
Expand Down Expand Up @@ -192,7 +192,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName);
}
return cacheAndCall(caller, selfType, context, self);
return cacheAndCall(context, caller, self, selfType);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self) {
Expand All @@ -207,7 +207,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, block);
}
return cacheAndCall(caller, selfType, block, context, self);
return cacheAndCall(context, caller, self, selfType, block);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, Block block) {
Expand Down Expand Up @@ -241,7 +241,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, arg1);
}
return cacheAndCall(caller, selfType, context, self, arg1);
return cacheAndCall(context, caller, self, selfType, arg1);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, IRubyObject arg1) {
Expand All @@ -256,7 +256,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, block);
}
return cacheAndCall(caller, selfType, block, context, self, arg1);
return cacheAndCall(context, caller, self, selfType, arg1, block);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, IRubyObject arg1, Block block) {
Expand Down Expand Up @@ -290,7 +290,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, arg2);
}
return cacheAndCall(caller, selfType, context, self, arg1, arg2);
return cacheAndCall(context, caller, self, selfType, arg1, arg2);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, IRubyObject arg1, IRubyObject arg2) {
Expand All @@ -305,7 +305,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, arg2, block);
}
return cacheAndCall(caller, selfType, block, context, self, arg1, arg2);
return cacheAndCall(context, caller, self, selfType, arg1, arg2, block);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, IRubyObject arg1, IRubyObject arg2, Block block) {
Expand Down Expand Up @@ -339,7 +339,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, arg2, arg3);
}
return cacheAndCall(caller, selfType, context, self, arg1, arg2, arg3);
return cacheAndCall(context, caller, self, selfType, arg1, arg2, arg3);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
Expand All @@ -354,7 +354,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
if (cache.typeOk(selfType)) {
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, arg2, arg3, block);
}
return cacheAndCall(caller, selfType, block, context, self, arg1, arg2, arg3);
return cacheAndCall(context, caller, self, selfType, block, arg1, arg2, arg3);
}

public IRubyObject fcall(ThreadContext context, IRubyObject self, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block) {
Expand Down Expand Up @@ -441,60 +441,52 @@ private CacheEntry cacheAndGet(IRubyObject self, RubyClass selfType, String meth
return entry;
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, Block block,
IRubyObject[] args, ThreadContext context, IRubyObject self) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject[] args, Block block) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, args, block);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType,
IRubyObject[] args, ThreadContext context, IRubyObject self) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject[] args) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, args);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType,
ThreadContext context, IRubyObject self) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, Block block,
ThreadContext context, IRubyObject self) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, Block block) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, block);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject arg) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, arg);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, Block block,
ThreadContext context, IRubyObject self, IRubyObject arg) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject arg, Block block) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, arg, block);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg1, IRubyObject arg2) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject arg1, IRubyObject arg2) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, arg1, arg2);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, Block block,
ThreadContext context, IRubyObject self, IRubyObject arg1, IRubyObject arg2) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject arg1, IRubyObject arg2, Block block) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, arg1, arg2, block);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType,
ThreadContext context, IRubyObject self, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, arg1, arg2, arg3);
}

protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, Block block,
ThreadContext context, IRubyObject self, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, Block block, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
CacheEntry entry = populateCacheEntry(caller, selfType, context, self);
return entry.method.call(context, self, entry.sourceModule, methodName, arg1, arg2, arg3, block);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, args);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, args, context, self);
return cacheAndCall(context, caller, self, selfType, args);
}
}

Expand All @@ -117,7 +117,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, args, block);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, block, args, context, self);
return cacheAndCall(context, caller, self, selfType, args, block);
}
}

Expand All @@ -131,7 +131,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, context, self);
return cacheAndCall(context, caller, self, selfType);
}
}

Expand All @@ -144,7 +144,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, block);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, block, context, self);
return cacheAndCall(context, caller, self, selfType, block);
}
}

Expand All @@ -158,7 +158,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, arg1);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, context, self, arg1);
return cacheAndCall(context, caller, self, selfType, arg1);
}
}

Expand All @@ -171,7 +171,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, block);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, block, context, self, arg1);
return cacheAndCall(context, caller, self, selfType, arg1, block);
}
}

Expand All @@ -185,7 +185,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, arg2);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, context, self, arg1, arg2);
return cacheAndCall(context, caller, self, selfType, arg1, arg2);
}
}

Expand All @@ -198,7 +198,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, arg2, block);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, block, context, self, arg1, arg2);
return cacheAndCall(context, caller, self, selfType, arg1, arg2, block);
}
}

Expand All @@ -212,7 +212,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, arg2, arg3);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, context, self, arg1, arg2, arg3);
return cacheAndCall(context, caller, self, selfType, arg1, arg2, arg3);
}
}

Expand All @@ -225,7 +225,7 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s
return cache.method.call(context, self, cache.sourceModule, methodName, arg1, arg2, arg3, block);
} else {
totalMonomorphicCalls.set(1);
return cacheAndCall(caller, selfType, block, context, self, arg1, arg2, arg3);
return cacheAndCall(context, caller, self, selfType, block, arg1, arg2, arg3);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private RubySymbol getRespondToNameSym(ThreadContext context) {
}

@Override
protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject arg) {
CacheEntry entry = selfType.searchWithCache(methodName);
DynamicMethod method = entry.method;

Expand All @@ -134,7 +134,7 @@ protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, Threa
}

@Override
protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1) {
protected IRubyObject cacheAndCall(ThreadContext context, IRubyObject caller, IRubyObject self, RubyClass selfType, IRubyObject arg0, IRubyObject arg1) {
CacheEntry entry = selfType.searchWithCache(methodName);
DynamicMethod method = entry.method;

Expand Down

0 comments on commit 9c5b3cc

Please sign in to comment.