projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ddb061f
)
[jit] Optimize ldloc+ldfld operations for valuetypes, so they don't require making...
author
Zoltan Varga
<vargaz@gmail.com>
Tue, 4 Jul 2017 17:02:05 +0000
(13:02 -0400)
committer
Zoltan Varga
<vargaz@gmail.com>
Tue, 4 Jul 2017 17:02:05 +0000
(13:02 -0400)
mono/mini/method-to-ir.c
patch
|
blob
|
history
diff --git
a/mono/mini/method-to-ir.c
b/mono/mini/method-to-ir.c
index 9b602e10a6903e327d437aa218f6a97c46e9e118..2a5f8917d5e86dba99e1612918565f8dfd325040 100644
(file)
--- a/
mono/mini/method-to-ir.c
+++ b/
mono/mini/method-to-ir.c
@@
-7829,7
+7829,12
@@
mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
CHECK_STACK_OVF (1);
n = ip [1];
CHECK_LOCAL (n);
CHECK_STACK_OVF (1);
n = ip [1];
CHECK_LOCAL (n);
- EMIT_NEW_LOCLOAD (cfg, ins, n);
+ if ((ip [2] == CEE_LDFLD) && ip_in_bb (cfg, cfg->cbb, ip + 2) && MONO_TYPE_ISSTRUCT (header->locals [n])) {
+ /* Avoid loading a struct just to load one of its fields */
+ EMIT_NEW_LOCLOADA (cfg, ins, n);
+ } else {
+ EMIT_NEW_LOCLOAD (cfg, ins, n);
+ }
*sp++ = ins;
ip += 2;
break;
*sp++ = ins;
ip += 2;
break;
@@
-12284,7
+12289,12
@@
mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
CHECK_OPSIZE (4);
n = read16 (ip + 2);
CHECK_LOCAL (n);
CHECK_OPSIZE (4);
n = read16 (ip + 2);
CHECK_LOCAL (n);
- EMIT_NEW_LOCLOAD (cfg, ins, n);
+ if ((ip [4] == CEE_LDFLD) && ip_in_bb (cfg, cfg->cbb, ip + 4) && header->locals [n]->type == MONO_TYPE_VALUETYPE) {
+ /* Avoid loading a struct just to load one of its fields */
+ EMIT_NEW_LOCLOADA (cfg, ins, n);
+ } else {
+ EMIT_NEW_LOCLOAD (cfg, ins, n);
+ }
*sp++ = ins;
ip += 4;
break;
*sp++ = ins;
ip += 4;
break;