Optimize argument array creation in reflection call

This commit is contained in:
Alexander Udalov
2016-08-15 10:37:46 +03:00
parent c422de7c3c
commit d0d1824e7d
@@ -95,7 +95,7 @@ internal abstract class FunctionCaller<out M : Member>(
class InstanceMethod(method: ReflectMethod) : Method(method) { class InstanceMethod(method: ReflectMethod) : Method(method) {
override fun call(args: Array<*>): Any? { override fun call(args: Array<*>): Any? {
checkArguments(args) checkArguments(args)
return callMethod(args[0], args.asList().subList(1, args.size).toTypedArray()) return callMethod(args[0], args.copyOfRange(1, args.size))
} }
} }
@@ -103,7 +103,7 @@ internal abstract class FunctionCaller<out M : Member>(
override fun call(args: Array<*>): Any? { override fun call(args: Array<*>): Any? {
checkArguments(args) checkArguments(args)
checkObjectInstance(args.firstOrNull()) checkObjectInstance(args.firstOrNull())
return callMethod(null, args.asList().subList(1, args.size).toTypedArray()) return callMethod(null, args.copyOfRange(1, args.size))
} }
} }