Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Issue 1454553004: Create code and instruction object, and install them in the background compilation thread while br… (Closed)

Created:
5 years, 1 month ago by srdjan
Modified:
4 years, 8 months ago
Reviewers:
siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Create code and instruction object, and install them in the background compilation thread while bringing mutator thread to a saferpoint. BUG=

Patch Set 1 #

Patch Set 2 : Change default back #

Patch Set 3 : Cleanup #

Patch Set 4 : c #

Total comments: 10

Patch Set 5 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+151 lines, -410 lines) Patch
M runtime/vm/code_generator.cc View 1 1 chunk +0 lines, -2 lines 0 comments Download
M runtime/vm/compiler.h View 4 chunks +1 line, -65 lines 0 comments Download
M runtime/vm/compiler.cc View 1 2 3 4 27 chunks +106 lines, -319 lines 0 comments Download
M runtime/vm/compiler_test.cc View 2 chunks +2 lines, -1 line 0 comments Download
M runtime/vm/object.h View 1 2 3 4 3 chunks +3 lines, -11 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 10 chunks +30 lines, -10 lines 0 comments Download
M runtime/vm/profiler_test.cc View 3 chunks +4 lines, -0 lines 0 comments Download
M runtime/vm/stub_code.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M runtime/vm/thread_registry.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (2 generated)
srdjan
5 years, 1 month ago (2015-11-17 23:22:25 UTC) #3
siva
lgtm https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/compiler.cc File runtime/vm/compiler.cc (right): https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/compiler.cc#newcode407 runtime/vm/compiler.cc:407: // if the code may got invalidated while ...
5 years, 1 month ago (2015-11-18 17:46:27 UTC) #4
srdjan
5 years, 1 month ago (2015-11-18 19:04:53 UTC) #5
https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/compiler.cc
File runtime/vm/compiler.cc (right):

https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/compiler.cc#...
runtime/vm/compiler.cc:407: // if the code may got invalidated while compiling.
On 2015/11/18 17:46:27, siva wrote:
> The comment does not read well, maybe
> 
> Get current generation count so that we can check and ensure that the code was
> not invalidated while we were compiling in the background.

Done.

https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/compiler.cc#...
runtime/vm/compiler.cc:750: // Stop mutator thread while in background
compilation.
On 2015/11/18 17:46:27, siva wrote:
> Stop mutator thread before creating the instruction object.

Stop mutator thread before creating the instruction object and installing code.

https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/compiler.cc#...
runtime/vm/compiler.cc:797: function.InstallOptimizedCode(code, is_osr);
On 2015/11/18 17:46:27, siva wrote:
> Maybe add a comment here that there won't be concurrent access to the
> instruction page as the background compiler installs code only at a safepoint.


Adding that comment above at FinalizeCode:
        // Allocates instruction object. Since this occurs only at safepoint,
        // there can be no concurrent access to the instruction page.

Adding here:
           // Install code while at safepoint.

https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/compiler.cc#...
runtime/vm/compiler.cc:799: // Background compilation
On 2015/11/18 17:46:27, siva wrote:
> Background compilation.
> 

Done and added:
            // Before installing code check generation counts if the code may
            // have become invalid.

https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/object.cc
File runtime/vm/object.cc (right):

https://codereview.chromium.org/1454553004/diff/60001/runtime/vm/object.cc#ne...
runtime/vm/object.cc:2894:
Isolate::Current()->thread_registry()->InSafepoint());
On 2015/11/18 17:46:27, siva wrote:
> I wonder if it will be more efficient to do:
> #if defined(DEBUG)
> Thread* thread = Thread;;Current();
> ASSERT(thread->IsMutatorThread() ||
> thread->isolate()->thread_registry()->AtSafepoint());
> ASSERT(code.is_optimized);
> #endif

Factoring this out into (in object.cc):

static bool IsMutatorOrAtSafepoint() {...}

Also changing ThreadRegistry's InSafepoint -> AtSafepoint

Powered by Google App Engine
This is Rietveld 408576698