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

Issue 9447102: Implement x64 compilation for loading and storing local variables. (Closed)

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

Description

Implement x64 compilation for loading and storing local variables. Continue to bailout on optional parameters and context-allocated local variables. Implement compilation of Bind and Do instructions, LoadLocal and StoreLocal computations, and temporary values. Temporary allocation assumes they obey a stack-discipline and have a single use---so any use is always the last use. Temporaries can then be allocated via push and used via pop. This dart function: hukairs(a) { var b, c; c = b = a; return c; } compiles to this annotated generated code snippet: ;; StoreLocal(b, #null) 66: mov $0x7f99303c0021,%rax 70: mov %rax,-0x8(%rbp) ;; StoreLocal(c, #null) 74: mov $0x7f99303c0021,%rax 7e: mov %rax,-0x10(%rbp) ;; t0 <-LoadLocal(a) 82: mov 0x10(%rbp),%ax 86: push %rax ;; t0 <-StoreLocal(b, t0) 87: pop %rax 88: mov %rax,-0x8(%rbp) 8c: push %rax ;; StoreLocal(c, t0) 8d: pop %rax 8e: mov %rax,-0x10(%rbp) ;; t0 <-LoadLocal(c) 92: mov -0x10(%rbp),%ax 96: push %rax ;; return t0 97: pop %rax ;; ... bf: mov %rbp,%rsp c2: pop %rbp c3: retq R=srdjan@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=4666

Patch Set 1 #

Total comments: 3

Patch Set 2 : Bugfix and rebase to HEAD. #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+328 lines, -180 lines) Patch
M runtime/vm/flow_graph_builder.h View 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 8 chunks +88 lines, -19 lines 1 comment Download
M runtime/vm/flow_graph_compiler_x64.h View 3 chunks +19 lines, -6 lines 0 comments Download
M runtime/vm/flow_graph_compiler_x64.cc View 1 9 chunks +77 lines, -23 lines 3 comments Download
M runtime/vm/intermediate_language.h View 13 chunks +118 lines, -56 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 chunk +13 lines, -63 lines 0 comments Download
M runtime/vm/scopes.h View 7 chunks +9 lines, -9 lines 2 comments Download
M runtime/vm/scopes.cc View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Kevin Millikin (Google)
Guide to review: 1. This includes the changes from http://codereview.chromium.org/9471010/ (expand the graph visitor) which ...
8 years, 9 months ago (2012-02-27 13:35:07 UTC) #1
Kevin Millikin (Google)
http://codereview.chromium.org/9447102/diff/1/runtime/vm/flow_graph_compiler_x64.cc File runtime/vm/flow_graph_compiler_x64.cc (right): http://codereview.chromium.org/9447102/diff/1/runtime/vm/flow_graph_compiler_x64.cc#newcode90 runtime/vm/flow_graph_compiler_x64.cc:90: __ movw(RAX, Address(RBP, comp->local().index() * kWordSize)); Oops, movq. http://codereview.chromium.org/9447102/diff/1/runtime/vm/flow_graph_compiler_x64.cc#newcode217 ...
8 years, 9 months ago (2012-02-27 13:40:41 UTC) #2
srdjan
LGTM Regarding temporaries: I think that one-use-only rule is good enough for now. I like ...
8 years, 9 months ago (2012-02-27 23:23:53 UTC) #3
Kevin Millikin (Google)
8 years, 9 months ago (2012-02-28 09:13:12 UTC) #4
http://codereview.chromium.org/9447102/diff/4001/runtime/vm/flow_graph_compil...
File runtime/vm/flow_graph_compiler_x64.cc (right):

http://codereview.chromium.org/9447102/diff/4001/runtime/vm/flow_graph_compil...
runtime/vm/flow_graph_compiler_x64.cc:204: // Initialize locals to null.
On 2012/02/27 23:23:53, srdjan wrote:
> Shall we generate IL to describe the NULL stores into locals? That way the SSA
> builder would be able to remove them.

It looks like they're already present in the AST, because we're generating IL
for them without any special handling.  I kept this loop from the existing code
generator because I wasn't positive that a GC or other stack walk could
definitely not occur between the prologue code and the explicit null
initialization.

Let's keep it as an open issue to revisit (maybe remove them from the AST?) in a
month or so.

http://codereview.chromium.org/9447102/diff/4001/runtime/vm/scopes.h
File runtime/vm/scopes.h (right):

http://codereview.chromium.org/9447102/diff/4001/runtime/vm/scopes.h#newcode60
runtime/vm/scopes.h:60: ASSERT(!HasIndex() || (index_ == index));
On 2012/02/27 23:23:53, srdjan wrote:
> Add a comment why it can happen that the same index is assigned twice.

Good idea, done.

Powered by Google App Engine
This is Rietveld 408576698