Karl Wiberg
d2c6967f1d
Optimize RoboCaller::AddReceiver() for code size
...
Essentially, instead of having the inlined UntypedFunction::Create(f)
return an UntypedFunction which is then passed as an argument to
non-inlined RoboCallerReceivers::AddReceiverImpl(), we let
UntypedFunction::PrepareArgs(f) return a few different kinds of
trivial structs (depending on what sort of type f has) which are
passed as arguments to non-inlined RoboCallerReceivers::AddReceiver()
(which then converts them to UntypedFunction by calling
UntypedFunction::Create()). These structs are smaller than
UntypedFunction and optimized for argument passing, so many fewer
instructions are needed.
Example code:
struct Foo {
void Receive(int, float, int, float);
void TestAddLambdaReceiver();
webrtc::RoboCaller<int, float, int, float> rc;
};
void Foo::TestAddLambdaReceiver() {
rc.AddReceiver([this](int a, float b, int c, float d){
Receive(a, b, c, d);});
}
On arm32, we get before this CL:
Foo::TestAddLambdaReceiver():
push {r11, lr}
mov r11, sp
sub sp, sp, #24
ldr r1, .LCPI0_0
mov r2, #0
stm sp, {r0, r2}
add r1, pc, r1
str r2, [sp, #20 ]
str r1, [sp, #16 ]
mov r1, sp
bl RoboCallerReceivers::AddReceiverImpl
mov sp, r11
pop {r11, pc}
.LCPI0_0:
.long CallInlineStorage<Foo::TestAddLambdaReceiver()::$_0>
CallInlineStorage<Foo::TestAddLambdaReceiver()::$_0>:
ldr r0, [r0]
b Foo::Receive(int, float, int, float)
After this CL:
Foo::TestAddLambdaReceiver():
ldr r3, .LCPI0_0
mov r2, r0
add r3, pc, r3
b RoboCallerReceivers::AddReceiver<1u>
.LCPI0_0:
.long CallInlineStorage<Foo::TestAddLambdaReceiver()::$_0>
CallInlineStorage<Foo::TestAddLambdaReceiver()::$_0>:
ldr r0, [r0]
b Foo::Receive(int, float, int, float)
(Symbol names abbreviated so that they'll fit on one line.)
So a reduction from 64 to 28 bytes. The improvements on arm64 and
x86_64 are similar.
Bug: webrtc:11943
Change-Id: I93fbba083be0235051c3279d3e3f6852a4a9fdad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185960
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32244}
2020-09-30 06:59:44 +00:00
..
2020-09-29 10:19:20 +00:00
2020-09-22 07:26:26 +00:00
2019-11-27 12:52:48 +00:00
2020-07-08 20:38:54 +00:00
2020-06-08 12:59:40 +00:00
2020-09-18 17:42:53 +00:00
2020-05-26 20:27:34 +00:00
2020-09-07 12:57:15 +00:00
2020-09-11 15:31:51 +00:00
2020-06-08 12:59:40 +00:00
2020-01-21 12:13:11 +00:00
2020-01-21 12:13:11 +00:00
2020-04-02 09:54:27 +00:00
2020-09-29 19:14:29 +00:00
2018-06-19 14:00:39 +00:00
2020-07-16 13:52:28 +00:00
2020-07-08 10:46:20 +00:00
2020-09-07 12:57:15 +00:00
2020-03-02 11:36:58 +00:00
2020-01-28 19:16:18 +00:00
2019-02-20 16:02:59 +00:00
2019-10-15 09:07:44 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-02-03 21:19:57 +00:00
2020-02-03 21:19:57 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:05:20 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-11-27 19:34:54 +00:00
2019-11-27 19:34:54 +00:00
2020-07-08 11:41:20 +00:00
2020-07-08 11:41:20 +00:00
2019-07-03 13:30:01 +00:00
2020-03-02 20:55:28 +00:00
2020-03-02 20:55:28 +00:00
2020-03-02 20:55:28 +00:00
2019-01-11 17:11:39 +00:00
2020-09-29 12:57:20 +00:00
2020-09-29 12:57:20 +00:00
2020-05-26 20:27:34 +00:00
2020-05-29 11:42:06 +00:00
2020-09-30 06:59:44 +00:00
2019-11-15 11:48:42 +00:00
2019-11-15 11:48:42 +00:00
2019-11-15 11:48:42 +00:00
2019-07-08 13:45:15 +00:00
2019-03-31 11:55:09 +00:00
2019-01-11 17:11:39 +00:00
2019-01-25 20:29:58 +00:00
2019-01-25 20:29:58 +00:00
2020-05-26 20:27:34 +00:00
2019-11-28 17:51:00 +00:00
2020-06-12 14:12:54 +00:00
2018-06-19 14:00:39 +00:00
2020-09-29 10:19:20 +00:00
2019-09-26 09:48:07 +00:00
2019-09-26 09:48:07 +00:00
2019-10-15 09:07:44 +00:00
2020-01-15 13:36:58 +00:00
2019-01-11 17:11:39 +00:00
2018-11-28 18:25:07 +00:00
2019-05-15 23:54:07 +00:00
2018-05-21 19:35:08 +00:00
2019-05-10 07:07:19 +00:00
2019-05-10 07:07:19 +00:00
2018-11-28 18:25:07 +00:00
2018-02-28 19:58:24 +00:00
2019-10-15 09:07:44 +00:00
2018-06-19 14:00:39 +00:00
2020-06-04 09:55:12 +00:00
2018-06-19 14:00:39 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2018-06-19 14:00:39 +00:00
2018-11-28 18:25:07 +00:00
2019-04-11 16:35:18 +00:00
2019-04-11 16:35:18 +00:00
2020-02-10 12:21:17 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-03-02 10:18:01 +00:00
2020-09-07 12:57:15 +00:00
2020-04-16 14:21:41 +00:00
2020-04-16 14:21:41 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-08-08 08:29:18 +00:00
2018-06-19 14:00:39 +00:00
2018-12-17 17:33:06 +00:00
2020-02-10 12:21:17 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-10-15 09:07:44 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:05:20 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-04-24 20:57:20 +00:00
2020-03-02 11:36:58 +00:00
2020-03-02 11:36:58 +00:00
2019-01-25 20:29:58 +00:00
2019-12-03 19:43:12 +00:00
2019-12-03 19:43:12 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-09-21 20:42:59 +00:00
2020-09-21 20:42:59 +00:00
2020-09-22 12:08:38 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-10-25 12:07:32 +00:00
2019-10-25 12:07:32 +00:00
2018-11-28 18:25:07 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-09-25 11:44:02 +00:00
2020-09-25 11:44:02 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2020-01-10 19:03:12 +00:00
2020-01-10 19:03:12 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-09-17 15:47:29 +00:00
2020-03-02 11:36:58 +00:00
2020-03-02 11:36:58 +00:00
2020-05-26 20:07:14 +00:00
2020-05-26 20:07:14 +00:00
2020-04-02 07:48:36 +00:00
2020-04-02 07:48:36 +00:00
2020-08-13 20:50:23 +00:00
2020-08-13 20:50:23 +00:00
2020-09-11 18:22:14 +00:00
2020-09-11 18:22:14 +00:00
2020-03-24 11:48:42 +00:00
2020-03-24 11:48:42 +00:00
2020-03-30 13:02:46 +00:00
2020-09-11 18:22:14 +00:00
2020-08-20 21:46:18 +00:00
2020-09-07 12:57:15 +00:00
2020-09-07 12:57:15 +00:00
2019-07-08 13:45:15 +00:00
2020-05-06 20:19:49 +00:00
2019-01-11 17:11:39 +00:00
2020-07-08 20:38:54 +00:00
2020-05-14 19:33:26 +00:00
2020-04-14 11:00:49 +00:00
2020-09-07 12:57:15 +00:00
2019-09-17 15:47:29 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-04-16 20:56:25 +00:00
2020-04-16 20:56:25 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2020-09-28 14:30:01 +00:00
2020-09-28 14:30:01 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2018-04-06 01:01:48 +00:00
2020-08-25 16:11:22 +00:00
2020-08-25 09:56:39 +00:00
2020-08-25 09:56:39 +00:00
2020-02-19 14:05:46 +00:00
2020-08-31 20:26:37 +00:00
2020-08-31 20:26:37 +00:00
2020-08-31 20:26:37 +00:00
2020-05-17 17:22:01 +00:00
2019-03-04 12:42:10 +00:00
2019-05-03 08:35:42 +00:00
2019-07-08 13:45:15 +00:00
2019-05-06 07:34:09 +00:00
2019-02-16 11:11:45 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-09-17 15:47:29 +00:00
2019-03-28 13:33:30 +00:00
2019-07-08 13:45:15 +00:00
2018-10-23 11:32:56 +00:00
2020-09-18 17:42:53 +00:00
2017-11-22 11:21:47 +00:00
2020-09-29 10:19:20 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 20:38:54 +00:00
2020-09-29 10:19:20 +00:00
2020-01-15 13:46:38 +00:00
2020-05-25 12:14:44 +00:00
2020-05-25 12:14:44 +00:00
2020-01-15 13:46:38 +00:00
2020-01-15 13:46:38 +00:00
2020-01-15 13:46:38 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-11-26 14:05:20 +00:00
2020-09-25 07:14:04 +00:00
2020-09-30 06:59:44 +00:00
2020-09-30 06:59:44 +00:00
2019-07-08 13:45:15 +00:00
2020-09-18 17:42:53 +00:00
2020-04-15 09:30:07 +00:00
2020-09-14 14:48:39 +00:00
2019-10-15 09:07:44 +00:00
2020-03-21 18:53:46 +00:00
2020-03-21 18:53:46 +00:00
2019-10-15 09:07:44 +00:00
2018-11-28 18:25:07 +00:00
2018-11-26 19:20:27 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2020-05-28 07:52:53 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-04-09 17:18:20 +00:00
2019-01-11 17:11:39 +00:00
2019-12-10 08:32:10 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2020-01-03 18:42:32 +00:00
2019-10-15 09:07:44 +00:00
2019-01-11 17:11:39 +00:00
2020-01-10 19:03:12 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2020-09-07 12:57:15 +00:00
2020-08-31 20:26:37 +00:00
2019-07-08 13:45:15 +00:00
2020-01-07 09:54:44 +00:00
2020-05-14 19:33:26 +00:00
2019-01-11 17:11:39 +00:00
2020-04-14 11:00:49 +00:00
2019-09-17 15:47:29 +00:00
2019-10-15 09:07:44 +00:00
2019-09-17 15:47:29 +00:00
2019-10-15 09:07:44 +00:00
2020-03-21 18:53:46 +00:00
2020-04-16 14:21:41 +00:00
2020-04-16 20:56:25 +00:00
2020-09-03 14:18:18 +00:00
2020-09-29 12:57:20 +00:00
2020-03-21 18:53:46 +00:00
2020-04-16 14:21:41 +00:00
2020-01-08 14:12:08 +00:00
2020-09-07 12:57:15 +00:00
2019-07-08 13:45:15 +00:00
2019-08-29 14:16:23 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2018-10-23 11:32:56 +00:00
2019-07-30 19:35:37 +00:00
2020-09-17 13:18:25 +00:00
2020-09-17 13:18:25 +00:00
2018-06-19 14:00:39 +00:00
2020-05-26 20:27:34 +00:00
2020-09-16 14:08:55 +00:00
2019-03-19 18:11:52 +00:00
2020-05-04 13:47:35 +00:00
2020-03-18 16:06:09 +00:00
2019-02-20 17:08:53 +00:00
2020-07-08 20:38:54 +00:00
2019-02-12 10:58:36 +00:00
2020-07-08 20:38:54 +00:00
2019-02-21 14:36:07 +00:00
2019-03-26 14:42:49 +00:00
2020-07-08 20:38:54 +00:00
2019-02-21 09:33:42 +00:00
2019-04-10 10:27:07 +00:00
2019-09-17 15:47:29 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-09-17 15:47:29 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-01-11 17:11:39 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2017-11-01 13:23:26 +00:00
2019-07-08 13:45:15 +00:00
2019-04-08 16:58:07 +00:00
2020-01-20 14:07:16 +00:00
2020-09-07 12:57:15 +00:00
2020-09-25 11:44:02 +00:00
2020-09-25 11:44:02 +00:00
2020-02-10 12:21:17 +00:00
2020-07-01 17:21:02 +00:00
2020-01-28 19:16:18 +00:00
2020-03-10 17:22:54 +00:00
2020-03-10 17:22:54 +00:00
2020-03-10 17:22:54 +00:00
2019-11-28 15:58:24 +00:00
2018-06-19 14:00:39 +00:00
2019-07-08 13:45:15 +00:00
2019-02-09 00:55:14 +00:00
2019-02-09 00:55:14 +00:00
2020-09-18 09:43:07 +00:00
2020-09-30 06:59:44 +00:00
2020-07-17 09:19:50 +00:00
2020-09-07 12:57:15 +00:00
2020-09-07 12:57:15 +00:00
2019-10-15 09:17:36 +00:00
2019-04-09 12:28:04 +00:00
2020-09-29 10:19:20 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2020-07-08 20:38:54 +00:00
2020-07-08 20:38:54 +00:00
2019-07-08 13:45:15 +00:00
2019-07-08 13:45:15 +00:00
2019-10-22 16:15:56 +00:00
2019-01-11 17:11:39 +00:00
2019-07-08 13:45:15 +00:00
2019-05-22 10:32:25 +00:00
2018-11-28 18:25:07 +00:00
2018-03-07 22:06:20 +00:00
2019-07-08 13:45:15 +00:00