Skip to content

Commit

Permalink
Version 2.17.0-91.0.dev
Browse files Browse the repository at this point in the history
Merge commit 'ef028410836f30a32b8aa41a1b0d7e3f7c74cb89' into 'dev'
  • Loading branch information
Dart CI committed Feb 9, 2022
2 parents 32fa7df + ef02841 commit b7eea44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 32 deletions.
44 changes: 13 additions & 31 deletions pkg/compiler/lib/src/native/enqueue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,11 @@ import '../universe/world_impact.dart'
import 'behavior.dart';
import 'resolver.dart' show NativeClassFinder;

/// This could be an abstract class but we use it as a stub for the
/// dart_backend.
class NativeEnqueuer {
/// Called when a [type] has been instantiated natively.
void onInstantiatedType(InterfaceType type) {}

/// Initial entry point to native enqueuer.
WorldImpact processNativeClasses(Iterable<Uri> libraries) =>
const WorldImpact();

/// Registers the [nativeBehavior]. Adds the liveness of its instantiated
/// types to the world.
void registerNativeBehavior(
WorldImpactBuilder impactBuilder, NativeBehavior nativeBehavior, cause) {}

/// Returns whether native classes are being used.
bool get hasInstantiatedNativeClasses => false;

/// Emits a summary information using the [log] function.
void logSummary(void log(String message)) {}
}

abstract class NativeEnqueuerBase implements NativeEnqueuer {
abstract class NativeEnqueuer {
final Set<ClassEntity> _registeredClasses = {};
final Set<ClassEntity> _unusedClasses = {};

@override
/// Returns whether native classes are being used.
bool get hasInstantiatedNativeClasses => !_registeredClasses.isEmpty;

/// Log message reported if all native types are used.
Expand All @@ -52,18 +30,21 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
final CommonElements _commonElements;

/// Subclasses of [NativeEnqueuerBase] are constructed by the backend.
NativeEnqueuerBase(this._options, this._elementEnvironment,
this._commonElements, this._dartTypes);
NativeEnqueuer(this._options, this._elementEnvironment, this._commonElements,
this._dartTypes);

bool get enableLiveTypeAnalysis => _options.enableNativeLiveTypeAnalysis;

@override
/// Called when a [type] has been instantiated natively.
void onInstantiatedType(InterfaceType type) {
if (_unusedClasses.remove(type.element)) {
_registeredClasses.add(type.element);
}
}

/// Initial entry point to native enqueuer.
WorldImpact processNativeClasses(Iterable<Uri> libraries);

/// Register [classes] as natively instantiated in [impactBuilder].
void _registerTypeUses(
WorldImpactBuilder impactBuilder, Set<ClassEntity> classes, cause) {
Expand All @@ -79,7 +60,8 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
}
}

@override
/// Registers the [nativeBehavior]. Adds the liveness of its instantiated
/// types to the world.
void registerNativeBehavior(
WorldImpactBuilder impactBuilder, NativeBehavior nativeBehavior, cause) {
_processNativeBehavior(impactBuilder, nativeBehavior, cause);
Expand Down Expand Up @@ -169,15 +151,15 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
});
}

@override
/// Emits a summary information using the [log] function.
void logSummary(void log(String message)) {
if (_allUsedMessage != null) {
log(_allUsedMessage);
}
}
}

class NativeResolutionEnqueuer extends NativeEnqueuerBase {
class NativeResolutionEnqueuer extends NativeEnqueuer {
final NativeClassFinder _nativeClassFinder;

/// The set of all native classes. Each native class is in [nativeClasses]
Expand Down Expand Up @@ -219,7 +201,7 @@ class NativeResolutionEnqueuer extends NativeEnqueuerBase {
}
}

class NativeCodegenEnqueuer extends NativeEnqueuerBase {
class NativeCodegenEnqueuer extends NativeEnqueuer {
final CodeEmitterTask _emitter;
final Iterable<ClassEntity> _nativeClasses;
final NativeData _nativeData;
Expand Down
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 2
MINOR 17
PATCH 0
PRERELEASE 90
PRERELEASE 91
PRERELEASE_PATCH 0

0 comments on commit b7eea44

Please sign in to comment.