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

Issue 8773026: Canonicalize TypeArguments. (Closed)

Created:
9 years ago by srdjan
Modified:
9 years ago
Reviewers:
regis
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Canonicalize TypeArguments. Committed: https://code.google.com/p/dart/source/detail?r=2133

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Patch Set 12 : '' #

Total comments: 26

Patch Set 13 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+147 lines, -61 lines) Patch
M runtime/vm/class_finalizer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -1 line 0 comments Download
M runtime/vm/code_generator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +4 lines, -10 lines 0 comments Download
M runtime/vm/object.h View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +12 lines, -8 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 chunks +70 lines, -33 lines 0 comments Download
M runtime/vm/object_store.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +8 lines, -0 lines 0 comments Download
M runtime/vm/object_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/object_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +22 lines, -0 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +16 lines, -5 lines 0 comments Download
M runtime/vm/raw_object.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +9 lines, -4 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
srdjan
9 years ago (2011-12-05 22:46:24 UTC) #1
regis
LGTM with comments http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc File runtime/vm/object.cc (right): http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc#newcode2419 runtime/vm/object.cc:2419: if (!type.IsNull() && !type.Equals(other_type)) { What ...
9 years ago (2011-12-05 23:16:35 UTC) #2
srdjan
9 years ago (2011-12-06 17:24:14 UTC) #3
Thanks for the comments! Also added checks that a canonical type argument cannot
be modified via SetTypeAt, SetLength.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc
File runtime/vm/object.cc (right):

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc#newcod...
runtime/vm/object.cc:2419: if (!type.IsNull() && !type.Equals(other_type)) {
On 2011/12/05 23:16:35, regis wrote:
> What if type.IsNull() && !other_type.IsNull()?

Type can't be NULL, removed test (see comment below).

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc#newcod...
runtime/vm/object.cc:2535: // type.IsNull() means it is Dynamic type.
On 2011/12/05 23:16:35, regis wrote:
> We should not encounter a Null type in a non-null type arguments. Either the
> vector is null or its elements are not null. We should debug when this case
> arises.

Removed isNull case (reverting the lines here). It was occurring in some of my
test code that is now removed.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc#newcod...
runtime/vm/object.cc:2625: RawAbstractTypeArguments*
TypeArguments::Canonicalize() const {
On 2011/12/05 23:16:35, regis wrote:
> I would add a comment that Canonicalize for a non-instantiated type arguments
is
> a no-op.

Expanded the existing comment in header file.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc#newcod...
runtime/vm/object.cc:2633: intptr_t ix = 0;
On 2011/12/05 23:16:35, regis wrote:
> index?

Done.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc#newcod...
runtime/vm/object.cc:2659: raw_ptr()->is_canonical_ = value ? Bool::True() :
Bool::False();
On 2011/12/05 23:16:35, regis wrote:
> Why do you store a dart value?
> Other flags in classes and types are not dart values.

I am moving it to above the length of RawTypeArgument and converting it to bool.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.cc#newcod...
runtime/vm/object.cc:5075: *FieldAddrAtOffset(field_offset) =
value.Canonicalize();
On 2011/12/05 23:16:35, regis wrote:
> Same comment: What about inline assembly?

Discussed, not an issue.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.h
File runtime/vm/object.h (right):

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/object.h#newcode...
runtime/vm/object.h:3083: raw_ptr()->type_arguments_ = value.Canonicalize();
On 2011/12/05 23:16:35, regis wrote:
> I would make it more obvious that setting the TypeArguments will canonicalize
> them.
> What about setting them from inline assembly? Do they get canonicalized too?

Discussed the inline assembly (went through code together), should not be a
problem.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/parser.cc
File runtime/vm/parser.cc (right):

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:6817: map_type_arguments = type_array.Canonicalize();
On 2011/12/05 23:16:35, regis wrote:
> Is this necessary? You canonicalize below as well.

Removed, doing it later

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:6825: ASSERT(map_type_arguments.IsNull() ||
(map_type_arguments.Length() == 2));
Canonicalizing it here,

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:6918: map_type_arguments,
On 2011/12/05 23:16:35, regis wrote:
> Why not canonicalize here as well?

Done it above

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:6947:
AbstractTypeArguments::ZoneHandle(map_type_arguments.Canonicalize());
Reverted this.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:7167: type_arguments,
On 2011/12/05 23:16:35, regis wrote:
> ditto

Done by moving canonicalization before if (is_const)

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/raw_object.h
File runtime/vm/raw_object.h (right):

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/raw_object.h#new...
runtime/vm/raw_object.h:338: return
reinterpret_cast<RawObject**>(&ptr()->length_);
On 2011/12/05 23:16:35, regis wrote:
> length_ needs to be changed if you keep a dart bool. But I would use a c++
bool
> for is_canonical_.

Removed Dart Bool, using C++ bool. I think length relates to types_ not to
length of the object.

http://codereview.chromium.org/8773026/diff/28002/runtime/vm/raw_object.h#new...
runtime/vm/raw_object.h:341: RawBool* is_canonical_;
On 2011/12/05 23:16:35, regis wrote:
> Why a dart bool?

Changed to C++ bool.

Powered by Google App Engine
This is Rietveld 408576698