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

Issue 10831261: Build and use stack maps in the SSA compiler. (Closed)

Created:
8 years, 4 months ago by Kevin Millikin (Google)
Modified:
8 years, 4 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Build and use stack maps in the SSA compiler. Add a stack bitmap to the location summaries for calls that are GC safepoints. The bitmap covers the spill slots. The register allocator collects these bitmaps into a list and then marks live pointer values during register allocation. When emitting code for a call, a heap-allocated stackmap is built. BUG= Committed: https://code.google.com/p/dart/source/detail?r=10618

Patch Set 1 #

Total comments: 31
Unified diffs Side-by-side diffs Delta from patch set Stats (+427 lines, -209 lines) Patch
M runtime/vm/compiler.cc View 5 chunks +21 lines, -3 lines 0 comments Download
M runtime/vm/flow_graph_allocator.h View 2 chunks +9 lines, -0 lines 5 comments Download
M runtime/vm/flow_graph_allocator.cc View 9 chunks +53 lines, -14 lines 2 comments Download
M runtime/vm/flow_graph_compiler.cc View 11 chunks +19 lines, -16 lines 2 comments Download
M runtime/vm/flow_graph_compiler_ia32.h View 3 chunks +14 lines, -7 lines 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.cc View 13 chunks +39 lines, -19 lines 6 comments Download
M runtime/vm/flow_graph_compiler_x64.h View 3 chunks +14 lines, -7 lines 0 comments Download
M runtime/vm/flow_graph_compiler_x64.cc View 13 chunks +39 lines, -19 lines 5 comments Download
M runtime/vm/intermediate_language.cc View 8 chunks +16 lines, -8 lines 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 29 chunks +75 lines, -44 lines 2 comments Download
M runtime/vm/intermediate_language_x64.cc View 29 chunks +75 lines, -44 lines 1 comment Download
M runtime/vm/locations.h View 2 chunks +3 lines, -1 line 0 comments Download
M runtime/vm/locations.cc View 1 chunk +3 lines, -1 line 0 comments Download
M runtime/vm/object.h View 2 chunks +9 lines, -0 lines 2 comments Download
M runtime/vm/object.cc View 5 chunks +16 lines, -6 lines 2 comments Download
M runtime/vm/raw_object.h View 1 chunk +1 line, -0 lines 2 comments Download
M runtime/vm/stack_frame.cc View 2 chunks +21 lines, -20 lines 2 comments Download

Messages

Total messages: 8 (0 generated)
Kevin Millikin (Google)
This passes all our tests, but our GC coverage could be better. I know it ...
8 years, 4 months ago (2012-08-10 11:08:51 UTC) #1
Kevin Millikin (Google)
8 years, 4 months ago (2012-08-10 14:13:05 UTC) #2
Kevin Millikin (Google)
8 years, 4 months ago (2012-08-10 14:13:58 UTC) #3
siva
DBC https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/stack_frame.cc File runtime/vm/stack_frame.cc (right): https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/stack_frame.cc#newcode90 runtime/vm/stack_frame.cc:90: visitor->VisitPointers(start_addr, end_addr); I think this hybrid approach of ...
8 years, 4 months ago (2012-08-10 18:01:25 UTC) #4
Vyacheslav Egorov (Google)
https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/stack_frame.cc File runtime/vm/stack_frame.cc (right): https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/stack_frame.cc#newcode90 runtime/vm/stack_frame.cc:90: visitor->VisitPointers(start_addr, end_addr); On 2012/08/10 18:01:25, asiva wrote: > I ...
8 years, 4 months ago (2012-08-10 18:11:42 UTC) #5
srdjan
https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_allocator.h File runtime/vm/flow_graph_allocator.h (right): https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_allocator.h#newcode438 runtime/vm/flow_graph_allocator.h:438: bool Covers(intptr_t pos) const; Could you add a brief ...
8 years, 4 months ago (2012-08-10 23:11:05 UTC) #6
Vyacheslav Egorov (Google)
lgtm https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_allocator.cc File runtime/vm/flow_graph_allocator.cc (right): https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_allocator.cc#newcode525 runtime/vm/flow_graph_allocator.cc:525: for (intptr_t i = 0; i < safepoints_.length(); ...
8 years, 4 months ago (2012-08-13 12:54:46 UTC) #7
Kevin Millikin (Google)
8 years, 4 months ago (2012-08-13 15:10:37 UTC) #8
https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
File runtime/vm/flow_graph_allocator.cc (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
runtime/vm/flow_graph_allocator.cc:525: for (intptr_t i = 0; i <
safepoints_.length(); ++i) {
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> Please move this code into a separate function.
> 
> It is duplicated in two places.

OK.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
File runtime/vm/flow_graph_allocator.h (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
runtime/vm/flow_graph_allocator.h:224: struct Safepoint {
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> : public ValueObject ?

Nah.  The comment in that class indicates that ValueObject is not intended to be
passed by value.  :)

A minor issue is that it would no longer be POD (ValueObject has a user-defined
constructor) so I'd have to write a silly constructor here.

I think I'll probably introduce a SafepointInfo class that wraps this and hides
the bitmap builder as part of a future cleanup, anyway.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
runtime/vm/flow_graph_allocator.h:438: bool Covers(intptr_t pos) const;
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> I suggest renaming Covers to Contains to match naming of Contains in
UseInterval
> or maybe even AnySiblingContains()
> 
> Also please add comment as Srdjan suggested.

Done.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
File runtime/vm/flow_graph_compiler.cc (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
runtime/vm/flow_graph_compiler.cc:407: if (is_ssa() && (stack_bitmap != NULL)) {
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> we should make as hard as possible to pass NULLs from ssa pipeline here so
that
> instructions with no bitmap will not easily come here.

Agreed.  I think we'll actually want to just make it non-NULL, even if we have a
few special (constant or nearly so) bitmaps describing the prologue etc.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
File runtime/vm/flow_graph_compiler_ia32.cc (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
runtime/vm/flow_graph_compiler_ia32.cc:784: NULL);
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> This NULL looks suspicious to me because we already expanded the stack above
and
> now we can have some garbage in out frame . 
> 
> If this call causes GC it might see all kinds of wierdness in the frame.

Yes, it's an existing problem.  We should be able to fix it with stackmaps.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
runtime/vm/flow_graph_compiler_ia32.cc:812: NULL);
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> This NULL looks suspicious to me because we already expanded the stack above
and
> now we can have some garbage in out frame . 
> 
> If this call causes GC it might see all kinds of wierdness in the frame.

Agreed.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
runtime/vm/flow_graph_compiler_ia32.cc:936: NULL);
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> This NULL looks suspicious to me because we already expanded the stack above
and
> now we can have some garbage in out frame . 
> 
> If this call causes GC it might see all kinds of wierdness in the frame.

Agreed.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
File runtime/vm/flow_graph_compiler_x64.cc (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/flow_graph_...
runtime/vm/flow_graph_compiler_x64.cc:1011: if (is_ssa() && (stack_bitmap !=
NULL)) {
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> I would prefer to have stack_bitmap always not equal to NULL with assertion.
> 
> All call sites should have some kind of bitmap.

I agree completely.  With this change we fall back on the existing behavior for
those points, which at least should not introduce new bugs.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/intermediat...
File runtime/vm/intermediate_language_ia32.cc (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/intermediat...
runtime/vm/intermediate_language_ia32.cc:95: locs()->stack_bitmap());
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> ReturnInstr is marked as NoCall. This code is suspicious.

I know.  We really don't want it to be a call because it's pointless to do any
work spilling before return.  Let's see if we can defer the call in the same way
as we plan to do with the stack check.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/object.cc
File runtime/vm/object.cc (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/object.cc#n...
runtime/vm/object.cc:6575: "0x%-*" PRIxPTR "\t%s\t%" PRIdPTR "\t%" PRIdPTR "\t%"
PRIdPTR "\n";
On 2012/08/13 12:54:46, Vyacheslav Egorov (Google) wrote:
> please add a comment about *
> 
> consider making a define to fold *PRIxPTR into a fixed width format modifier,
> something like
> 
> #if X64
> #  define PRIxPTRW "16" PRIxPTR 
> #else
> #  define PRIxPTRW "8" PRIxPTR 
> #endif

Blah.  I'd rather use vanilla printf specifiers than invent our own wrappers. 
I'll add a comment, though.

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/object.h
File runtime/vm/object.h (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/object.h#ne...
runtime/vm/object.h:2455: void set_spill_slot_count(intptr_t count) const {
On 2012/08/10 23:11:05, srdjan wrote:
> ASSERT(is_optimized()) ?

Hmmm.  It's called for unoptimized code to set it to zero (maybe -1 is better).

Is there a better way than using the accessor to initialize it for unoptmized
code?

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/raw_object.h
File runtime/vm/raw_object.h (right):

https://chromiumcodereview.appspot.com/10831261/diff/1/runtime/vm/raw_object....
runtime/vm/raw_object.h:814: intptr_t spill_slot_count_;
On 2012/08/10 23:11:05, srdjan wrote:
> Add comment what it means, when it is set.

Done.

Powered by Google App Engine
This is Rietveld 408576698