Skip to content

[Incremental compilation] Rename "experimental dependencies" to "fine-grained dependencies" #28563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===--- ExperimentalDependencies.h -----------------------------*- C++ -*-===//
//===----- FineGrainedependencies.h -----------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
Expand All @@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_AST_EXPERIMENTAL_DEPENDENCIES_H
#define SWIFT_AST_EXPERIMENTAL_DEPENDENCIES_H
#ifndef SWIFT_AST_FINE_GRAINED_DEPENDENCIES_H
#define SWIFT_AST_FINE_GRAINED_DEPENDENCIES_H

#include "swift/Basic/Debug.h"
#include "swift/Basic/LLVM.h"
Expand All @@ -27,7 +27,7 @@
#include <unordered_set>
#include <vector>

// Summary: The ExperimentalDependency* files contain infrastructure for a
// Summary: The FineGrainedDependency* files contain infrastructure for a
// dependency system that, in the future, will be finer-grained than the current
// dependency system. At present--12/5/18--they are using the same input
// information as the current system and expected to produce the same results.
Expand All @@ -36,14 +36,14 @@
//
// The frontend uses the information from the compiler to built a
// SourceFileDepGraph consisting of SourceFileDepGraphNodes.
// ExperimentalDependencies.* define these structures, and
// ExperimentalDependenciesProducer has the frontend-unique code used to build
// FineGrainedDependencies.* define these structures, and
// FineGrainedDependenciesProducer has the frontend-unique code used to build
// the SourceFileDepGraph.
//
// The driver reads the SourceFileDepGraph and integrates it into its dependency
// graph, a ModuleDepGraph consisting of ModuleDepGraphNodes.

// This file holds the declarations for the experimental dependency system
// This file holds the declarations for the fine-grained dependency system
// that are used by both the driver and frontend.
// These include the graph structures common to both programs and also
// the frontend graph, which must be read by the driver.
Expand All @@ -59,7 +59,7 @@ class FrontendOptions;
class SourceFile;

/// Use a new namespace to help keep the experimental code from clashing.
namespace experimental_dependencies {
namespace fine_grained_dependencies {

using StringVec = std::vector<std::string>;

Expand Down Expand Up @@ -318,7 +318,7 @@ class BiIndexedTwoStageMap {
// End of general declarations

//==============================================================================
// MARK: Start of experimental-dependency-specific code
// MARK: Start of fine-grained-dependency-specific code
//==============================================================================

/// The entry point into this system from the frontend:
Expand Down Expand Up @@ -517,20 +517,20 @@ class DependencyKey {
// Name conversion helpers
static std::string demangleTypeAsContext(StringRef);
};
} // namespace experimental_dependencies
} // namespace fine_grained_dependencies
} // namespace swift

template <>
struct std::hash<typename swift::experimental_dependencies::DependencyKey> {
struct std::hash<typename swift::fine_grained_dependencies::DependencyKey> {
size_t
operator()(const swift::experimental_dependencies::DependencyKey &key) const {
operator()(const swift::fine_grained_dependencies::DependencyKey &key) const {
return key.hash();
}
};
template <>
struct std::hash<typename swift::experimental_dependencies::DeclAspect> {
struct std::hash<typename swift::fine_grained_dependencies::DeclAspect> {
size_t
operator()(const swift::experimental_dependencies::DeclAspect aspect) const {
operator()(const swift::fine_grained_dependencies::DeclAspect aspect) const {
return size_t(aspect);
}
};
Expand Down Expand Up @@ -559,7 +559,7 @@ struct std::hash<typename swift::experimental_dependencies::DeclAspect> {
/// improving it.

namespace swift {
namespace experimental_dependencies {
namespace fine_grained_dependencies {
class DepGraphNode {
/// Def->use arcs go by DependencyKey. There may be >1 node for a given key.
DependencyKey key;
Expand Down Expand Up @@ -705,7 +705,7 @@ class SourceFileDepGraphNode : public DepGraphNode {
//==============================================================================

/// The dependency graph produced by the frontend and consumed by the driver.
/// See \ref Node in ExperimentalDependencies.h
/// See \ref Node in FineGrainedDependencies.h
class SourceFileDepGraph {
/// Every node in the graph. Indices used for serialization.
/// Use addNode instead of adding directly.
Expand Down Expand Up @@ -936,7 +936,7 @@ template <typename GraphT> class DotFileEmitter {
}
};

} // end namespace experimental_dependencies
} // end namespace fine_grained_dependencies
} // end namespace swift

//==============================================================================
Expand All @@ -948,32 +948,32 @@ template <typename GraphT> class DotFileEmitter {
#if !(defined(__linux__) || defined(_WIN64))
LLVM_YAML_DECLARE_SCALAR_TRAITS(size_t, QuotingType::None)
#endif
LLVM_YAML_DECLARE_ENUM_TRAITS(swift::experimental_dependencies::NodeKind)
LLVM_YAML_DECLARE_ENUM_TRAITS(swift::experimental_dependencies::DeclAspect)
LLVM_YAML_DECLARE_ENUM_TRAITS(swift::fine_grained_dependencies::NodeKind)
LLVM_YAML_DECLARE_ENUM_TRAITS(swift::fine_grained_dependencies::DeclAspect)
LLVM_YAML_DECLARE_MAPPING_TRAITS(
swift::experimental_dependencies::DependencyKey)
LLVM_YAML_DECLARE_MAPPING_TRAITS(swift::experimental_dependencies::DepGraphNode)
swift::fine_grained_dependencies::DependencyKey)
LLVM_YAML_DECLARE_MAPPING_TRAITS(swift::fine_grained_dependencies::DepGraphNode)

namespace llvm {
namespace yaml {
template <>
struct MappingContextTraits<
swift::experimental_dependencies::SourceFileDepGraphNode,
swift::experimental_dependencies::SourceFileDepGraph> {
swift::fine_grained_dependencies::SourceFileDepGraphNode,
swift::fine_grained_dependencies::SourceFileDepGraph> {
using SourceFileDepGraphNode =
swift::experimental_dependencies::SourceFileDepGraphNode;
swift::fine_grained_dependencies::SourceFileDepGraphNode;
using SourceFileDepGraph =
swift::experimental_dependencies::SourceFileDepGraph;
swift::fine_grained_dependencies::SourceFileDepGraph;

static void mapping(IO &io, SourceFileDepGraphNode &node,
SourceFileDepGraph &g);
};

template <>
struct SequenceTraits<
std::vector<swift::experimental_dependencies::SourceFileDepGraphNode *>> {
std::vector<swift::fine_grained_dependencies::SourceFileDepGraphNode *>> {
using SourceFileDepGraphNode =
swift::experimental_dependencies::SourceFileDepGraphNode;
swift::fine_grained_dependencies::SourceFileDepGraphNode;
using NodeVec = std::vector<SourceFileDepGraphNode *>;
static size_t size(IO &, NodeVec &vec);
static SourceFileDepGraphNode &element(IO &, NodeVec &vec, size_t index);
Expand All @@ -983,6 +983,6 @@ struct SequenceTraits<
} // namespace llvm

LLVM_YAML_DECLARE_MAPPING_TRAITS(
swift::experimental_dependencies::SourceFileDepGraph)
swift::fine_grained_dependencies::SourceFileDepGraph)

#endif // SWIFT_AST_EXPERIMENTAL_DEPENDENCIES_H
#endif // SWIFT_AST_FINE_GRAINED_DEPENDENCIES_H
4 changes: 2 additions & 2 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ namespace swift {

/// Scaffolding to permit experimentation with finer-grained dependencies
/// and faster rebuilds.
bool EnableExperimentalDependencies = false;
bool EnableFineGrainedDependencies = false;

/// To mimic existing system, set to false.
/// To experiment with including file-private and private dependency info,
/// set to true.
bool ExperimentalDependenciesIncludeIntrafileOnes = false;
bool FineGrainedDependenciesIncludeIntrafileOnes = false;

/// Whether to enable experimental differentiable programming features:
/// `@differentiable` declaration attribute, etc.
Expand Down
32 changes: 16 additions & 16 deletions include/swift/Driver/Compilation.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,17 @@ class Compilation {

/// Scaffolding to permit experimentation with finer-grained dependencies and
/// faster rebuilds.
const bool EnableExperimentalDependencies;
const bool EnableFineGrainedDependencies;

/// Helpful for debugging, but slows down the driver. So, only turn on when
/// needed.
const bool VerifyExperimentalDependencyGraphAfterEveryImport;
const bool VerifyFineGrainedDependencyGraphAfterEveryImport;
/// Helpful for debugging, but slows down the driver. So, only turn on when
/// needed.
const bool EmitExperimentalDependencyDotFileAfterEveryImport;
const bool EmitFineGrainedDependencyDotFileAfterEveryImport;

/// Experiment with inter-file dependencies
const bool ExperimentalDependenciesIncludeIntrafileOnes;
const bool FineGrainedDependenciesIncludeIntrafileOnes;

/// Experiment with source-range-based dependencies
const bool EnableSourceRangeDependencies;
Expand Down Expand Up @@ -309,10 +309,10 @@ class Compilation {
bool SaveTemps = false,
bool ShowDriverTimeCompilation = false,
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr,
bool EnableExperimentalDependencies = false,
bool VerifyExperimentalDependencyGraphAfterEveryImport = false,
bool EmitExperimentalDependencyDotFileAfterEveryImport = false,
bool ExperimentalDependenciesIncludeIntrafileOnes = false,
bool EnableFineGrainedDependencies = false,
bool VerifyFineGrainedDependencyGraphAfterEveryImport = false,
bool EmitFineGrainedDependencyDotFileAfterEveryImport = false,
bool FineGrainedDependenciesIncludeIntrafileOnes = false,
bool EnableSourceRangeDependencies = false,
bool CompareIncrementalSchemes = false,
StringRef CompareIncrementalSchemesPath = "");
Expand Down Expand Up @@ -374,20 +374,20 @@ class Compilation {
}
void disableIncrementalBuild(Twine why);

bool getEnableExperimentalDependencies() const {
return EnableExperimentalDependencies;
bool getEnableFineGrainedDependencies() const {
return EnableFineGrainedDependencies;
}

bool getVerifyExperimentalDependencyGraphAfterEveryImport() const {
return VerifyExperimentalDependencyGraphAfterEveryImport;
bool getVerifyFineGrainedDependencyGraphAfterEveryImport() const {
return VerifyFineGrainedDependencyGraphAfterEveryImport;
}

bool getEmitExperimentalDependencyDotFileAfterEveryImport() const {
return EmitExperimentalDependencyDotFileAfterEveryImport;
bool getEmitFineGrainedDependencyDotFileAfterEveryImport() const {
return EmitFineGrainedDependencyDotFileAfterEveryImport;
}

bool getExperimentalDependenciesIncludeIntrafileOnes() const {
return ExperimentalDependenciesIncludeIntrafileOnes;
bool getFineGrainedDependenciesIncludeIntrafileOnes() const {
return FineGrainedDependenciesIncludeIntrafileOnes;
}

bool getEnableSourceRangeDependencies() const {
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Driver/DependencyGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class DependencyGraph : public DependencyGraphImpl {
/// If \p node has already been marked, only its outgoing edges are updated.
/// The third argument is ignored here, but must be present so that the same
/// call site can polymorphically call \ref
/// experimental_dependencies::ModuleDepGraph::loadFromPath
/// fine_grained_dependencies::ModuleDepGraph::loadFromPath
LoadResult loadFromPath(T node, StringRef path, DiagnosticEngine &) {
return DependencyGraphImpl::loadFromPath(Traits::getAsVoidPointer(node),
path);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===--- ExperimentalDependencyModuleDepGraph.h ------------------*- C++-*-===//
//===---- FineGrainedDependencyModuleDepGraph.h ------------------*- C++-*-===//
//
// This source file is part of the Swift.org open source project
//
Expand All @@ -10,10 +10,10 @@
//
//===----------------------------------------------------------------------===//

#ifndef ExperimentalDependencyGraph_h
#define ExperimentalDependencyGraph_h
#ifndef SWIFT_DRIVER_FINE_GRAINED_DEPENDENCY_DRIVER_GRAPH_H
#define SWIFT_DRIVER_FINE_GRAINED_DEPENDENCY_DRIVER_GRAPH_H

#include "swift/AST/ExperimentalDependencies.h"
#include "swift/AST/FineGrainedDependencies.h"
#include "swift/Basic/Debug.h"
#include "swift/Basic/LLVM.h"
#include "swift/Basic/OptionSet.h"
Expand All @@ -34,11 +34,11 @@
#include <unordered_set>
#include <vector>

// Declarations for the portion experimental dependency system used by the
// Declarations for the portion fine-grained dependency system used by the
// driver.

namespace swift {
namespace experimental_dependencies {
namespace fine_grained_dependencies {

//==============================================================================
// MARK: ModuleDepGraphNode
Expand Down Expand Up @@ -117,7 +117,7 @@ class DependencyGraphImpl {
// MARK: ModuleDepGraph
//==============================================================================

/// See \ref Node in ExperimentalDependencies.h
/// See \ref Node in FineGrainedDependencies.h
class ModuleDepGraph {

/// Find nodes, first by the swiftDeps file, then by key.
Expand Down Expand Up @@ -186,8 +186,8 @@ class ModuleDepGraph {
/// files for the same name distinct, keep a sequence number for each name.
std::unordered_map<std::string, unsigned> dotFileSequenceNumber;

const bool verifyExperimentalDependencyGraphAfterEveryImport;
const bool emitExperimentalDependencyDotFileAfterEveryImport;
const bool verifyFineGrainedDependencyGraphAfterEveryImport;
const bool emitFineGrainedDependencyDotFileAfterEveryImport;

/// If tracing dependencies, holds the current node traversal path
Optional<std::vector<const ModuleDepGraphNode *>> currentPathIfTracing;
Expand Down Expand Up @@ -250,14 +250,14 @@ class ModuleDepGraph {
using NodeType = ModuleDepGraphNode;

/// \p stats may be null
ModuleDepGraph(const bool verifyExperimentalDependencyGraphAfterEveryImport,
const bool emitExperimentalDependencyDotFileAfterEveryImport,
ModuleDepGraph(const bool verifyFineGrainedDependencyGraphAfterEveryImport,
const bool emitFineGrainedDependencyDotFileAfterEveryImport,
const bool shouldTraceDependencies,
UnifiedStatsReporter *stats)
: verifyExperimentalDependencyGraphAfterEveryImport(
verifyExperimentalDependencyGraphAfterEveryImport),
emitExperimentalDependencyDotFileAfterEveryImport(
emitExperimentalDependencyDotFileAfterEveryImport),
: verifyFineGrainedDependencyGraphAfterEveryImport(
verifyFineGrainedDependencyGraphAfterEveryImport),
emitFineGrainedDependencyDotFileAfterEveryImport(
emitFineGrainedDependencyDotFileAfterEveryImport),
currentPathIfTracing(
shouldTraceDependencies
? llvm::Optional<std::vector<const ModuleDepGraphNode *>>(
Expand Down Expand Up @@ -473,7 +473,7 @@ class ModuleDepGraph {
return !currentPathIfTracing.hasValue() || currentPathIfTracing->empty();
}
};
} // namespace experimental_dependencies
} // namespace fine_grained_dependencies
} // namespace swift

#endif // ExperimentalDependencyGraph_h
#endif // SWIFT_DRIVER_FINE_GRAINED_DEPENDENCY_DRIVER_GRAPH_H
18 changes: 9 additions & 9 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def driver_always_rebuild_dependents :
Flag<["-"], "driver-always-rebuild-dependents">, InternalDebugOpt,
HelpText<"Always rebuild dependents of files that have been modified">;

def enable_experimental_dependencies :
Flag<["-"], "enable-experimental-dependencies">, Flags<[FrontendOption, HelpHidden]>,
def enable_fine_grained_dependencies :
Flag<["-"], "enable-fine-grained-dependencies">, Flags<[FrontendOption, HelpHidden]>,
HelpText<"Experimental work-in-progress to be more selective about incremental recompilation">;

def enable_source_range_dependencies :
Expand All @@ -158,18 +158,18 @@ Joined<["-"], "driver-compare-incremental-schemes-path=">, Flags<[]>,
Alias<driver_compare_incremental_schemes_path>;


def driver_verify_experimental_dependency_graph_after_every_import :
Flag<["-"], "driver-verify-experimental-dependency-graph-after-every-import">,
def driver_verify_fine_grained_dependency_graph_after_every_import :
Flag<["-"], "driver-verify-fine-grained-dependency-graph-after-every-import">,
InternalDebugOpt,
HelpText<"Debug DriverGraph by verifying it after every import">;

def driver_emit_experimental_dependency_dot_file_after_every_import :
Flag<["-"], "driver-emit-experimental-dependency-dot-file-after-every-import">,
def driver_emit_fine_grained_dependency_dot_file_after_every_import :
Flag<["-"], "driver-emit-fine-grained-dependency-dot-file-after-every-import">,
InternalDebugOpt,
HelpText<"Emit dot files every time driver imports an experimental swiftdeps file.">;
HelpText<"Emit dot files every time driver imports an fine-grained swiftdeps file.">;

def experimental_dependency_include_intrafile :
Flag<["-"], "experimental-dependency-include-intrafile">,
def fine_grained_dependency_include_intrafile :
Flag<["-"], "fine-grained-dependency-include-intrafile">,
InternalDebugOpt,
HelpText<"Include within-file dependencies.">;

Expand Down
4 changes: 2 additions & 2 deletions lib/AST/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ add_swift_host_library(swiftAST STATIC
DiagnosticList.cpp
DocComment.cpp
Evaluator.cpp
ExperimentalDependencies.cpp
ExperimentalDependenciesSourceFileDepGraphConstructor.cpp
Expr.cpp
FineGrainedDependencies.cpp
FineGrainedDependenciesSourceFileDepGraphConstructor.cpp
GenericEnvironment.cpp
GenericSignature.cpp
GenericSignatureBuilder.cpp
Expand Down
Loading