static final HashMap<S, L<Method>> callMC_3_cache = new HashMap;
static callMC_3_Q callMC_3_quick;
sclass callMC_3_Q {
S name;
Method method;
}
// varargs assignment fixer for a single string array argument
static Object callMC_3(S method, S[] arg) {
ret callMC_3(method, new O[] {arg});
}
static O callMC_3(S method, O... args) ctex {
callMC_3_Q q = callMC_3_quick;
if (q != null && q.name == method)
ret q.method.invoke(null, args);
L<Method> m = callMC_3_cache.get(method);
if (m == null) {
if (callMC_3_cache.isEmpty()) {
callMC_3_makeCache();
m = callMC_3_cache.get(method);
}
if (m == null) fail("Method named " + method + " not found in main");
}
int n = m.size();
if (n == 1) {
Method me = m.get(0);
if (q == null || q.name != method) {
q = new callMC_3_Q;
q.name = method;
q.method = me;
callMC_3_quick = q;
}
ret me.invoke(null, args);
}
for i to n: {
Method me = m.get(i);
if (call_checkArgs(me, args, false))
ret me.invoke(null, args);
}
fail("No method called " + method + " with matching arguments found in main");
}
static synchronized void callMC_3_makeCache() {
callMC_3_cache.clear();
Class _c = (Class) mc(), c = _c;
while (c != null) {
for (Method m : c.getDeclaredMethods())
if ((m.getModifiers() & Modifier.STATIC) != 0) {
m.setAccessible(true);
multiMapPut(callMC_3_cache, m.getName(), m);
}
c = c.getSuperclass();
}
}Began life as a copy of #1007834
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1007835 |
| Snippet name: | callMC_3 - call function in main class, optimizing even more |
| Eternal ID of this version: | #1007835/3 |
| Text MD5: | 9122cd20fe03bd1b15a8c4a7cf899297 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-04-11 14:39:08 |
| Source code size: | 1556 bytes / 57 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 858 / 863 |
| Version history: | 2 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |