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

Issue 8372041: Canonicalize types. (Closed)

Created:
9 years, 1 month ago by regis
Modified:
9 years, 1 month ago
Reviewers:
srdjan
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Patch Set 1 #

Total comments: 22

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+231 lines, -34 lines) Patch
M runtime/vm/class_finalizer.h View 1 3 chunks +5 lines, -4 lines 0 comments Download
M runtime/vm/class_finalizer.cc View 1 12 chunks +28 lines, -7 lines 0 comments Download
M runtime/vm/code_generator_ia32.cc View 1 1 chunk +3 lines, -3 lines 0 comments Download
M runtime/vm/object.h View 1 9 chunks +22 lines, -2 lines 0 comments Download
M runtime/vm/object.cc View 1 13 chunks +152 lines, -4 lines 0 comments Download
M runtime/vm/parser.cc View 1 4 chunks +17 lines, -13 lines 0 comments Download
M runtime/vm/raw_object.h View 1 2 chunks +2 lines, -0 lines 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 2 chunks +2 lines, -0 lines 0 comments Download
M tests/language/language.status View 1 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
regis
9 years, 1 month ago (2011-11-01 20:20:24 UTC) #1
srdjan
LGTM with comments and questions http://codereview.chromium.org/8372041/diff/1/runtime/vm/class_finalizer.cc File runtime/vm/class_finalizer.cc (right): http://codereview.chromium.org/8372041/diff/1/runtime/vm/class_finalizer.cc#newcode455 runtime/vm/class_finalizer.cc:455: super_type = super_type.Canonicalize(); Do ...
9 years, 1 month ago (2011-11-01 20:51:43 UTC) #2
regis
Thanks! http://codereview.chromium.org/8372041/diff/1/runtime/vm/class_finalizer.cc File runtime/vm/class_finalizer.cc (right): http://codereview.chromium.org/8372041/diff/1/runtime/vm/class_finalizer.cc#newcode455 runtime/vm/class_finalizer.cc:455: super_type = super_type.Canonicalize(); On 2011/11/01 20:51:43, srdjan wrote: ...
9 years, 1 month ago (2011-11-01 21:54:50 UTC) #3
srdjan
http://codereview.chromium.org/8372041/diff/1/runtime/vm/class_finalizer.cc File runtime/vm/class_finalizer.cc (right): http://codereview.chromium.org/8372041/diff/1/runtime/vm/class_finalizer.cc#newcode455 runtime/vm/class_finalizer.cc:455: super_type = super_type.Canonicalize(); On 2011/11/01 21:54:50, regis wrote: > ...
9 years, 1 month ago (2011-11-01 22:05:14 UTC) #4
regis
9 years, 1 month ago (2011-11-01 22:28:53 UTC) #5
Thanks for the additional feedback. I'll send you an another cl addressing it.

http://codereview.chromium.org/8372041/diff/1/runtime/vm/class_finalizer.cc
File runtime/vm/class_finalizer.cc (right):

http://codereview.chromium.org/8372041/diff/1/runtime/vm/class_finalizer.cc#n...
runtime/vm/class_finalizer.cc:455: super_type = super_type.Canonicalize();
On 2011/11/01 22:05:14, srdjan wrote:
> On 2011/11/01 21:54:50, regis wrote:
> > On 2011/11/01 20:51:43, srdjan wrote:
> > > Do you need to finalize the super_type that you may actually be throwing
> away?
> > > Maybe call FinalizeType after getting the type's canonical version?
> > 
> > The finalized and canonicalized super type is written back to the class on
the
> > following line. So this is not wasted work.
> 
> As I understand it the canonical super_type could already have been finalized,
> so the finalization of 'rejected' super_type instance is wasted. However, it
> seems from otehr comments that you need to finalize in order to properly
search
> for canonical version.

If the super_type was already finalized, the call to FinalizeType returns
immediately. In that case, the only wasted work is to canonicalize again. This
is why I will try to combine finalization with canonicalization.

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

http://codereview.chromium.org/8372041/diff/1/runtime/vm/object.cc#newcode2070
runtime/vm/object.cc:2070: }
On 2011/11/01 22:05:14, srdjan wrote:
> On 2011/11/01 21:54:50, regis wrote:
> > On 2011/11/01 20:51:43, srdjan wrote:
> > > I wonder if you need num_canonical_types variable. Instead you can use the
> > > canonical_types.Length() and abort once you meet type.IsNull.
> > 
> > There is not sentinel ending the array with a null type. I duplicated the
code
> > used for constants.
> 
> You do not need a NULL sentinel as you would iterate for length of array and
> break when null encountered. Grow operation fills array with null objects.
> 

Ah, I now see what you mean. Clever!
I missed the fact that we can rely on the Grow operation initializing the empty
space.
I will remove the num_canonical_types_ as well as the num_contants_ field.

http://codereview.chromium.org/8372041/diff/1/runtime/vm/object.cc#newcode2076
runtime/vm/object.cc:2076: (old_length == 0) ? kInitialCanonicalTypesLength :
old_length * 2;
On 2011/11/01 22:05:14, srdjan wrote:
> On 2011/11/01 21:54:50, regis wrote:
> > On 2011/11/01 20:51:43, srdjan wrote:
> > > The growth (old_length * 2) seems a little excessive. Why not +
> > kGrowthConstant
> > 
> > OK, I now add 2 elements each time the array grows. 
> 
> If you add only one, you can get rid of a field in class and make the
algorithm
> simpler :-).

Actually, I think I can still simplify and remove the field while incrementing
by 2 :-)

Powered by Google App Engine
This is Rietveld 408576698