| Index: runtime/vm/code_generator.cc
|
| diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
|
| index 44ddb3e1a8f2b0545e41d76eba282b8731fa92fc..9e983a817f5496cc059778d7b1d78319d6ea9963 100644
|
| --- a/runtime/vm/code_generator.cc
|
| +++ b/runtime/vm/code_generator.cc
|
| @@ -725,9 +725,14 @@ DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) {
|
| // target.
|
| ASSERT(target_code.EntryPoint() !=
|
| CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code));
|
| - CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code,
|
| - target_code.EntryPoint());
|
| - caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code);
|
| + const Instructions& instrs =
|
| + Instructions::Handle(caller_code.instructions());
|
| + {
|
| + WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
|
| + CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code,
|
| + target_code.EntryPoint());
|
| + caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code);
|
| + }
|
| if (FLAG_trace_patching) {
|
| OS::PrintErr("PatchStaticCall: patching from %#" Px " to '%s' %#" Px "\n",
|
| caller_frame->pc(),
|
| @@ -1454,9 +1459,13 @@ DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) {
|
| ASSERT(target_function.raw() == target_code.function());
|
|
|
| const Code& current_target_code = Code::Handle(target_function.CurrentCode());
|
| - CodePatcher::PatchStaticCallAt(frame->pc(), caller_code,
|
| - current_target_code.EntryPoint());
|
| - caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code);
|
| + const Instructions& instrs = Instructions::Handle(caller_code.instructions());
|
| + {
|
| + WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
|
| + CodePatcher::PatchStaticCallAt(frame->pc(), caller_code,
|
| + current_target_code.EntryPoint());
|
| + caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code);
|
| + }
|
| if (FLAG_trace_patching) {
|
| OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n",
|
| frame->pc(),
|
| @@ -1496,7 +1505,12 @@ void DeoptimizeAt(const Code& optimized_code, uword pc) {
|
| // is not a performance issue).
|
| uword lazy_deopt_jump = optimized_code.GetLazyDeoptPc();
|
| ASSERT(lazy_deopt_jump != 0);
|
| - CodePatcher::InsertCallAt(pc, lazy_deopt_jump);
|
| + const Instructions& instrs =
|
| + Instructions::Handle(optimized_code.instructions());
|
| + {
|
| + WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
|
| + CodePatcher::InsertCallAt(pc, lazy_deopt_jump);
|
| + }
|
| // Mark code as dead (do not GC its embedded objects).
|
| optimized_code.set_is_alive(false);
|
| }
|
|
|