Commit Graph

18 Commits

Author SHA1 Message Date
Vyacheslav Egorov 6bb73bd2e4 Background compiler should validate CHA decisions before committing the code.
CHA::HasOverride skips non-finalized classes when looking for overrides which means that we will install incorrect code if some subclass with an override was finalized while compilation was in progress.

To catch situations like this we record the number of finalized subclasses that class had
when CHA made the first negative decision about it (e.g. that it has no subclasses or that it has no overrides for some function) and before installing the code we check that number of subclasses matches.

Additionally renamed "leaf classes" to "guarded classes" because those classes are not necessarily leaf.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/2002583002 .
2016-05-20 13:48:29 +02:00
Ryan Macnak e048774776 Precompilation: Specialize instance calls when the call receiver is the method receiver and the method class has a small number of concrete subclasses (currently 5).
CompileOnceHelloHtml (ARMv7HF) +17.194%
DeltaBlueClosures (ARMv7HF) +28.379%
DeltaBlue (ARMv7HF) +30.190%

precompiled dart2js arm 19071745 -> 19504726 (+2.3%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1867913004 .
2016-04-11 12:52:28 -07:00
Regis Crelier 7f57ebcfa1 Remove signature classes from the VM.
They were used as the class of closure instances and as the type class of
function types.
All closure instances now have class _Closure and function types are represented
by a new class FunctionType extending AbstractType.
Fix issue 24567 and add regression test.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1584223006 .
2016-01-19 16:32:59 -08:00
Florian Schneider 36e63481e0 More general CHA-based inlining and devirtualization for precompiled code.
Generalize current approach used for implicit getters/setters to all instance calls.

Additionally use propagated type to resolve targets if no concrete cid
is known:

class A {
  void m() { }
  void n() => m();
}
class B extends A { }

Even though the receiver type in n() can be A or B (concrete cid unknown), we can still
call m() directly since it is not overridden.

Also, allow inlining of methods that were not compiled yet in precompiled code.

BUG=
R=rmacnak@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1410733006 .
2015-10-23 13:34:32 +02:00
Srdjan Mitrovic 5ce63657af Some cleanup and be more conservative when guessing cids: use only current leaf classes; otherwise we may get the cid of e.g., _StringBase, which confuses the VM since an object of that cid is never instantiated.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1186113011.
2015-06-19 10:16:11 -07:00
Srdjan Mitrovic d7d0d92ec3 Do not eagerly add guarded leaf classes with CHA; do not add them for private names.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1158673004
2015-05-29 08:57:34 -07:00
koda@google.com 02240f100e Move CHA state keeping from Isolate to Thread.
This prepares for the Isolate/Thread split, and also enables us to remove the GrowableArray(Isolate*) interface.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1016973002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44549 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-18 00:29:26 +00:00
johnmccutchan@google.com eeeda72067 Do not ignore core libraries from CHA analysis.
I ran into issues with the collections library where classes and types were being finalized very late, affecting cha analysis.

class _LinkedCustomHashMap<K, V> extends _CustomHashMap<K, V> with _LinkedHashMapMixin<K, V>

abstract class _LinkedHashMapMixin<K, V> implements LinkedHashMap<K, V> {

Even though LinkedHashMap is a builtin object it can still be implemented after startup.

R=fschneider@google.com, iposva@google.com

Review URL: https://codereview.chromium.org//846213004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42874 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-14 17:03:45 +00:00
fschneider@google.com 881060b433 Fix type propagation for signature classes.
After I enabled nullability tracking for checked mode type assertions,
we need to fix type propagation for signature classes: We can't use
the asserted type to infer a cid for those since it may cause unnecessary
deoptimizations.

R=vegorov@google.com

Review URL: https://codereview.chromium.org//465343002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39197 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-13 13:45:01 +00:00
fschneider@google.com 54a7410866 Fix bug with CHA dependencies by recording a set of classes for registering code.
CHA is not only used with the receiver class, but also with other classes
when doing type propagation. The optimized code has to be registered with
all classes that are affected by CHA so that deoptimization occurs whenever
the set of subclasses changes for these classes.

R=vegorov@google.com

Review URL: https://codereview.chromium.org//463103002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39194 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-13 12:43:03 +00:00
srdjan@google.com 8b7ebed54f Mark optimized code that used CHA for optimization so that lazy class 'finalization' does not invalidate that code.
R=fschneider@google.com

Review URL: https://codereview.chromium.org//150923002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32335 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-05 20:31:57 +00:00
srdjan@google.com 3485989ae7 Do not eagerly finalize classes in CHA, instead regard unfinalized classes as ’non-existent’ and only invalidate optimized code at finalization of the class.
Rename FinalizePendingClasses to FinalizePendingClassInterfaces as the class finalization occurs lazily.
TODO: add dependency information to deoptimize/remove only relevant optimized code.

R=regis@google.com

Review URL: https://codereview.chromium.org//81333003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30582 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-22 17:59:23 +00:00
fschneider@google.com 46f3bea12f VM: Fix CHA for Object.
Class hierarchy analysis does not track subclasses of Object.
Therefore, it needs to safely assume that any functions has an override.

This fixes test failures when running with --optimization-counter-threshold=5.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//24558002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27874 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 11:04:55 +00:00
asiva@google.com f4fe42c280 Added macros OBJECT_IMPLEMENTATION and FINAL_OBJECT_IMPLEMENTATION
which have different implementations of 'operator=' and 'operator^='.
In the case of FINAL_OBJECT_IMPLEMENTATION we do not do the vtable setting
in these methods (Note the |= operator functionality is now subsumed into
the new implementation of "operator^=")
Review URL: https://codereview.chromium.org//12052033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17491 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-23 20:01:31 +00:00
srdjan@google.com d1c4735609 Transition ^= to |=
Review URL: https://codereview.chromium.org//11867022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17309 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 19:53:17 +00:00
srdjan@google.com 251169951b Do not recompute unary_checks repeatedly. Add special (and quicker) way to check for method overrides using CHA.
Review URL: https://codereview.chromium.org//11275110

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14434 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-01 21:06:36 +00:00
asiva@google.com 596a5f1af9 Use kInstanceCid instead of object_store()->object_class() when checking to see if the class is object class.
Review URL: https://chromiumcodereview.appspot.com//10873004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11190 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-22 22:21:44 +00:00
regis@google.com 3790edb5e1 Move class hierarchy analysis to its own source.
Review URL: https://chromiumcodereview.appspot.com//10827450

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11097 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 21:09:28 +00:00