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

Issue 10823184: Basic type inference skeleton (Closed)

Created:
8 years, 4 months ago by ahe
Modified:
8 years, 4 months ago
CC:
reviews_dartlang.org, ngeoffray, Lasse Reichstein Nielsen, sra1, karlklose, polux, Johnni Winther
Visibility:
Public.

Description

Basic type inference skeleton Committed: https://code.google.com/p/dart/source/detail?r=10328

Patch Set 1 #

Patch Set 2 : Ready for review #

Total comments: 2

Patch Set 3 : Address review comments #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+203 lines, -3 lines) Patch
M dart/lib/compiler/implementation/compiler.dart View 1 4 chunks +7 lines, -1 line 0 comments Download
M dart/lib/compiler/implementation/leg.dart View 1 chunk +1 line, -0 lines 0 comments Download
M dart/lib/compiler/implementation/lib/core.dart View 1 chunk +7 lines, -1 line 2 comments Download
M dart/lib/compiler/implementation/ssa/builder.dart View 1 2 3 chunks +15 lines, -0 lines 4 comments Download
M dart/lib/compiler/implementation/ssa/nodes.dart View 1 chunk +1 line, -1 line 0 comments Download
A dart/lib/compiler/implementation/types/types.dart View 1 2 1 chunk +172 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
ahe
8 years, 4 months ago (2012-08-07 07:56:37 UTC) #1
kasperl
LGTM. https://chromiumcodereview.appspot.com/10823184/diff/2001/dart/lib/compiler/implementation/types/types.dart File dart/lib/compiler/implementation/types/types.dart (right): https://chromiumcodereview.appspot.com/10823184/diff/2001/dart/lib/compiler/implementation/types/types.dart#newcode40 dart/lib/compiler/implementation/types/types.dart:40: void storeType(Element element, HInstruction instruction) { It would ...
8 years, 4 months ago (2012-08-07 08:03:42 UTC) #2
ahe
Thank you, Kasper. https://chromiumcodereview.appspot.com/10823184/diff/2001/dart/lib/compiler/implementation/types/types.dart File dart/lib/compiler/implementation/types/types.dart (right): https://chromiumcodereview.appspot.com/10823184/diff/2001/dart/lib/compiler/implementation/types/types.dart#newcode40 dart/lib/compiler/implementation/types/types.dart:40: void storeType(Element element, HInstruction instruction) { ...
8 years, 4 months ago (2012-08-07 08:32:14 UTC) #3
polux
lgtm
8 years, 4 months ago (2012-08-07 08:52:32 UTC) #4
ngeoffray
DBC https://chromiumcodereview.appspot.com/10823184/diff/6001/dart/lib/compiler/implementation/lib/core.dart File dart/lib/compiler/implementation/lib/core.dart (right): https://chromiumcodereview.appspot.com/10823184/diff/6001/dart/lib/compiler/implementation/lib/core.dart#newcode42 dart/lib/compiler/implementation/lib/core.dart:42: void print(var obj) { Why this change? https://chromiumcodereview.appspot.com/10823184/diff/6001/dart/lib/compiler/implementation/ssa/builder.dart ...
8 years, 4 months ago (2012-08-16 12:53:10 UTC) #5
ahe
8 years, 4 months ago (2012-08-16 17:26:53 UTC) #6
https://chromiumcodereview.appspot.com/10823184/diff/6001/dart/lib/compiler/i...
File dart/lib/compiler/implementation/lib/core.dart (right):

https://chromiumcodereview.appspot.com/10823184/diff/6001/dart/lib/compiler/i...
dart/lib/compiler/implementation/lib/core.dart:42: void print(var obj) {
On 2012/08/16 12:53:10, ngeoffray wrote:
> Why this change?

For hello world, I can infer that this method is only ever called with a string.
So the optimizer can eliminate the else branch. This means no call to toString.

https://chromiumcodereview.appspot.com/10823184/diff/6001/dart/lib/compiler/i...
File dart/lib/compiler/implementation/ssa/builder.dart (right):

https://chromiumcodereview.appspot.com/10823184/diff/6001/dart/lib/compiler/i...
dart/lib/compiler/implementation/ssa/builder.dart:3299: if (element ===
builder.compiler.boolClass) return HType.BOOLEAN;
On 2012/08/16 12:53:10, ngeoffray wrote:
> Should those be BOOLEAN_OR_NULL, ... ?

No. It has been inferred that it must be a bool. This is the "concrete" part of
concrete-type inference, and why it felt appropriate to use elements.

However, I think when Paul's changes land, we will probably switch to a cleaner
abstraction for concrete types.

See the discussion of concrete types vs abstract types in
http://labs.oracle.com/techrep/1996/smli_tr-96-52.pdf page 4.

https://chromiumcodereview.appspot.com/10823184/diff/6001/dart/lib/compiler/i...
dart/lib/compiler/implementation/ssa/builder.dart:3302: // TODO(ahe): How to map
listClass to HType?
On 2012/08/16 12:53:10, ngeoffray wrote:
> new HBoundedPotentialPrimitiveArray(element.computeType(), canBeNull: true)
> 
> (or something)

It can't be null and it will be a primitive array.

Powered by Google App Engine
This is Rietveld 408576698