Skip to content

Commit 37dbf25

Browse files
committed
VM: Mark loads from final captured locals immutable.
This enables load elimination across calls for these locals. BUG= [email protected] Review URL: https://codereview.chromium.org/2160613004 .
1 parent 30b4895 commit 37dbf25

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

runtime/vm/flow_graph_builder.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -899,10 +899,13 @@ Definition* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local,
899899
context, Context::parent_offset(), Type::ZoneHandle(Z, Type::null()),
900900
token_pos));
901901
}
902-
return new(Z) LoadFieldInstr(context,
903-
Context::variable_offset(local.index()),
904-
local.type(),
905-
token_pos);
902+
LoadFieldInstr* load = new(Z) LoadFieldInstr(
903+
context,
904+
Context::variable_offset(local.index()),
905+
local.type(),
906+
token_pos);
907+
load->set_is_immutable(local.is_final());
908+
return load;
906909
} else {
907910
return new(Z) LoadLocalInstr(local, token_pos);
908911
}

0 commit comments

Comments
 (0)