diff --git a/core/includes/common.inc b/core/includes/common.inc
index 218bae4..69945a1 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -1310,6 +1310,10 @@ function drupal_flush_all_caches() {
   foreach ($theme_handler->listInfo() as $theme_name => $theme) {
     $keys[] = 'theme.active_theme.' . $theme_name;
   }
+
+  // Remove container definition.
+  //$keys[] = 'container_definition';
+
   \Drupal::state()->deleteMultiple($keys);
   // In case the active theme gets requested later in the same request we need
   // to reset the theme manager.
diff --git a/core/lib/Drupal/Core/Cache/ChainedFastBackend.php b/core/lib/Drupal/Core/Cache/ChainedFastBackend.php
index ce5ddd2..1f6aa36 100644
--- a/core/lib/Drupal/Core/Cache/ChainedFastBackend.php
+++ b/core/lib/Drupal/Core/Cache/ChainedFastBackend.php
@@ -44,9 +44,9 @@
 class ChainedFastBackend implements CacheBackendInterface, CacheTagsInvalidatorInterface {
 
   /**
-   * Cache key prefix for the bin-specific entry to track the last write.
+   * Cache tag prefix for the bin-specific tag to use for invalidations.
    */
-  const LAST_WRITE_TIMESTAMP_PREFIX = 'last_write_timestamp_';
+  const CACHE_TAG_PREFIX = 'chained_fast:';
 
   /**
    * @var string
@@ -68,11 +68,11 @@ class ChainedFastBackend implements CacheBackendInterface, CacheTagsInvalidatorI
   protected $fastBackend;
 
   /**
-   * The time at which the last write to this cache bin happened.
+   * The cache tags checksum provider.
    *
-   * @var float
+   * @var \Drupal\Core\Cache\CacheTagsChecksumInterface
    */
-  protected $lastWriteTimestamp;
+  protected $checksumProvider;
 
   /**
    * Constructs a ChainedFastBackend object.
@@ -84,11 +84,11 @@ class ChainedFastBackend implements CacheBackendInterface, CacheTagsInvalidatorI
    * @param string $bin
    *   The cache bin for which the object is created.
    */
-  public function __construct(CacheBackendInterface $consistent_backend, CacheBackendInterface $fast_backend, $bin) {
+  public function __construct(CacheBackendInterface $consistent_backend, CacheBackendInterface $fast_backend, $bin, CacheTagsChecksumInterface $checksum_provider) {
     $this->consistentBackend = $consistent_backend;
     $this->fastBackend = $fast_backend;
     $this->bin = 'cache_' . $bin;
-    $this->lastWriteTimestamp = NULL;
+    $this->checksumProvider = $checksum_provider;
   }
 
   /**
@@ -107,50 +107,41 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) {
     $cids_copy = $cids;
     $cache = array();
 
-    // If we can determine the time at which the last write to the consistent
-    // backend occurred (we might not be able to if it has been recently
-    // flushed/restarted), then we can use that to validate items from the fast
-    // backend, so try to get those first. Otherwise, we can't assume that
-    // anything in the fast backend is valid, so don't even bother fetching
-    // from there.
-    $last_write_timestamp = $this->getLastWriteTimestamp();
-    if ($last_write_timestamp) {
-      // Items in the fast backend might be invalid based on their timestamp,
-      // but we can't check the timestamp prior to getting the item, which
-      // includes unserializing it. However, unserializing an invalid item can
-      // throw an exception. For example, a __wakeup() implementation that
-      // receives object properties containing references to code or data that
-      // no longer exists in the application's current state.
-      //
-      // Unserializing invalid data, whether it throws an exception or not, is
-      // a waste of time, but we only incur it while a cache invalidation has
-      // not yet finished propagating to all the fast backend instances.
-      //
-      // Most cache backend implementations should not wrap their internal
-      // get() implementations with a try/catch, because they have no reason to
-      // assume that their data is invalid, and doing so would mask
-      // unserialization errors of valid data. We do so here, only because the
-      // fast backend is non-authoritative, and after discarding its
-      // exceptions, we proceed to check the consistent (authoritative) backend
-      // and allow exceptions from that to bubble up.
-      try {
-        $items = $this->fastBackend->getMultiple($cids, $allow_invalid);
-      }
-      catch (\Exception $e) {
-        $cids = $cids_copy;
-        $items = array();
-      }
+    // Items in the fast backend might be invalid based on their cache tag, but
+    // we can't check the timestamp prior to getting the item, which includes
+    // unserializing it. However, unserializing an invalid item can throw an
+    // exception. For example, a __wakeup() implementation that receives object
+    // properties containing references to code or data that no longer exists in
+    // the application's current state.
+    //
+    // Unserializing invalid data, whether it throws an exception or not, is a
+    // waste of time, but we only incur it while a cache invalidation has not
+    // yet finished propagating to all the fast backend instances.
+    //
+    // Most cache backend implementations should not wrap their internal get()
+    // implementations with a try/catch, because they have no reason to assume
+    // that their data is invalid, and doing so would mask unserialization
+    // errors of valid data. We do so here, only because the fast backend is
+    // non-authoritative, and after discarding its exceptions, we proceed to
+    // check the consistent (authoritative) backend and allow exceptions from
+    // that to bubble up.
+    try {
+      $items = $this->fastBackend->getMultiple($cids, $allow_invalid);
+    }
+    catch (\Exception $e) {
+      $cids = $cids_copy;
+      $items = array();
+    }
 
-      // Even if items were successfully fetched from the fast backend, they
-      // are potentially invalid if older than the last time the bin was
-      // written to in the consistent backend, so only keep ones that aren't.
-      foreach ($items as $item) {
-        if ($item->created < $last_write_timestamp) {
-          $cids[array_search($item->cid, $cids_copy)] = $item->cid;
-        }
-        else {
-          $cache[$item->cid] = $item;
-        }
+    // Even if items were successfully fetched from the fast backend, they are
+    // potentially invalid if their cache tag has been invalidated since the bin
+    // was written to in the consistent backend, so only keep ones that aren't.
+    foreach ($items as $item) {
+      if (!$this->checksumProvider->isValid($item->checksum, $item->tags)) {
+        $cids[array_search($item->cid, $cids_copy)] = $item->cid;
+      }
+      else {
+        $cache[$item->cid] = $item;
       }
     }
 
@@ -173,11 +164,14 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) {
    * {@inheritdoc}
    */
   public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) {
+    // Append the chained fast tag.
+    $tags[] = self::CACHE_TAG_PREFIX . $this->bin;
     $this->consistentBackend->set($cid, $data, $expire, $tags);
     $this->markAsOutdated();
-    // Don't write the cache tags to the fast backend as any cache tag
-    // invalidation results in an invalidation of the whole fast backend.
-    $this->fastBackend->set($cid, $data, $expire);
+    // Don't write all the cache tags to the fast backend as any cache tag
+    // invalidation results in an invalidation of the whole fast backend. Only
+    // write the chained fast invalidation tag.
+    $this->fastBackend->set($cid, $data, $expire, [self::CACHE_TAG_PREFIX . $this->bin]);
   }
 
   /**
@@ -186,10 +180,12 @@ public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array
   public function setMultiple(array $items) {
     $this->consistentBackend->setMultiple($items);
     $this->markAsOutdated();
-    // Don't write the cache tags to the fast backend as any cache tag
-    // invalidation results in an invalidation of the whole fast backend.
+    // Only write the chained fast invalidation tag to the fast backend as any
+    // cache tag invalidation results in an invalidation of the whole fast
+    // backend.
     foreach ($items as &$item) {
       unset($item['tags']);
+      $item['tags'] = [self::CACHE_TAG_PREFIX . $this->bin];
     }
     $this->fastBackend->setMultiple($items);
   }
@@ -237,6 +233,17 @@ public function invalidateMultiple(array $cids) {
    * {@inheritdoc}
    */
   public function invalidateTags(array $tags) {
+    // Do not invalidate the fast chained tag or looping results.
+    // @see self::markAsOutdated()
+    foreach ($tags as $key => $tag) {
+      if (strpos($tag, self::CACHE_TAG_PREFIX) === 0) {
+        unset($tags[$key]);
+      }
+    }
+    if (empty($tags)) {
+      return;
+    }
+
     if ($this->consistentBackend instanceof CacheTagsInvalidatorInterface) {
       $this->consistentBackend->invalidateTags($tags);
     }
@@ -275,32 +282,10 @@ public function reset() {
   }
 
   /**
-   * Gets the last write timestamp.
-   */
-  protected function getLastWriteTimestamp() {
-    if ($this->lastWriteTimestamp === NULL) {
-      $cache = $this->consistentBackend->get(self::LAST_WRITE_TIMESTAMP_PREFIX . $this->bin);
-      $this->lastWriteTimestamp = $cache ? $cache->data : 0;
-    }
-    return $this->lastWriteTimestamp;
-  }
-
-  /**
    * Marks the fast cache bin as outdated because of a write.
    */
   protected function markAsOutdated() {
-    // Clocks on a single server can drift. Multiple servers may have slightly
-    // differing opinions about the current time. Given that, do not assume
-    // 'now' on this server is always later than our stored timestamp.
-    // Also add 1 millisecond, to ensure that caches written earlier in the same
-    // millisecond are invalidated. It is possible that caches will be later in
-    // the same millisecond and are then incorrectly invalidated, but that only
-    // costs one additional roundtrip to the persistent cache.
-    $now = round(microtime(TRUE) + .001, 3);
-    if ($now > $this->getLastWriteTimestamp()) {
-      $this->lastWriteTimestamp = $now;
-      $this->consistentBackend->set(self::LAST_WRITE_TIMESTAMP_PREFIX . $this->bin, $this->lastWriteTimestamp);
-    }
+    Cache::invalidateTags([self::CACHE_TAG_PREFIX . $this->bin]);
   }
 
 }
diff --git a/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php b/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php
index bba9d94..739e3bf 100644
--- a/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php
+++ b/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\Core\Cache;
+
 use Drupal\Core\Site\Settings;
 use Symfony\Component\DependencyInjection\ContainerAwareTrait;
 
@@ -31,6 +32,13 @@ class ChainedFastBackendFactory implements CacheFactoryInterface {
   protected $fastServiceName;
 
   /**
+   * The service name of the checksum provider.
+   *
+   * @var string
+   */
+  protected $checksumProviderName;
+
+  /**
    * Constructs ChainedFastBackendFactory object.
    *
    * @param \Drupal\Core\Site\Settings|NULL $settings
@@ -44,8 +52,10 @@ class ChainedFastBackendFactory implements CacheFactoryInterface {
    *   (optional) The service name of the fast backend factory. Defaults to:
    *   - 'cache.backend.apcu' (if the PHP process has APCu enabled)
    *   - NULL (if the PHP process doesn't have APCu enabled)
+   * @param string $checksum_provider_name
+   *   (optional) The service name of the cache tag checksum provider.
    */
-  public function __construct(Settings $settings = NULL, $consistent_service_name = NULL, $fast_service_name = NULL) {
+  public function __construct(Settings $settings = NULL, $consistent_service_name = NULL, $fast_service_name = NULL, $checksum_provider_name = NULL) {
     // Default the consistent backend to the site's default backend.
     if (!isset($consistent_service_name)) {
       $cache_settings = isset($settings) ? $settings->get('cache') : array();
@@ -59,12 +69,15 @@ public function __construct(Settings $settings = NULL, $consistent_service_name
 
     $this->consistentServiceName = $consistent_service_name;
 
+    $this->checksumProviderName = $checksum_provider_name ?: 'cache_tags.invalidator.checksum';
+
     // Do not use the fast chained backend during installation. In those cases,
     // we expect many cache invalidations and writes, the fast chained cache
     // backend performs badly in such a scenario.
     if (!drupal_installation_attempted()) {
       $this->fastServiceName = $fast_service_name;
     }
+
   }
 
   /**
@@ -83,7 +96,8 @@ public function get($bin) {
       return new ChainedFastBackend(
         $this->container->get($this->consistentServiceName)->get($bin),
         $this->container->get($this->fastServiceName)->get($bin),
-        $bin
+        $bin,
+        $this->container->get($this->checksumProviderName)
       );
     }
     else {
diff --git a/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php b/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php
new file mode 100644
index 0000000..46c695b
--- /dev/null
+++ b/core/lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php
@@ -0,0 +1,362 @@
+<?php
+
+/*
+ * @file
+ * Contains \Drupal\Core\DependencyInjection\Dumper
+ */
+
+namespace Drupal\Core\DependencyInjection\Dumper;
+
+use Symfony\Component\DependencyInjection\Alias;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\Parameter;
+use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\DependencyInjection\Exception\RuntimeException;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Dumper\Dumper;
+use Symfony\Component\ExpressionLanguage\Expression;
+
+/**
+ * PhpArrayDumper dumps a service container as a serialized PHP array.
+ */
+class PhpArrayDumper extends Dumper
+{
+  /**
+   * {@inheritdoc}
+   */
+  public function dump(array $options = array())
+  {
+    return serialize($this->getArray());
+  }
+
+  /**
+   * Returns the service container as a PHP array.
+   *
+   * @return array
+   *  A PHP array represention of the service container
+   */
+  public function getArray()
+  {
+    $definition = [];
+    $definition['parameters'] = $this->getParameters();
+    $definition['services'] = $this->getServiceDefinitions();
+    return $definition;
+  }
+
+
+  /**
+   * Returns parameters of the container as a PHP Array.
+   *
+   * @return array
+   *   The escaped and prepared parameters of the container.
+   */
+  protected function getParameters()
+  {
+    if (!$this->container->getParameterBag()->all()) {
+      return [];
+    }
+
+    $parameters = $this->container->getParameterBag()->all();
+    $is_frozen = $this->container->isFrozen();
+    return $this->prepareParameters($parameters, $is_frozen);
+  }
+
+  /**
+   * Returns services of the container as a PHP Array.
+   *
+   * @return array
+   *   The service definitions.
+   */
+  protected function getServiceDefinitions()
+  {
+    if (!$this->container->getDefinitions()) {
+      return [];
+    }
+
+    $services = [];
+    foreach ($this->container->getDefinitions() as $id => $definition) {
+      $services[$id] = $this->getServiceDefinition($definition);
+    }
+
+    $aliases = $this->container->getAliases();
+    foreach ($aliases as $alias => $id) {
+      while (isset($aliases[(string) $id])) {
+        $id = $aliases[(string) $id];
+      }
+      $services[$alias] = $this->getServiceAliasDefinition($id);
+    }
+
+    return $services;
+  }
+
+  /**
+   * Prepares parameters.
+   *
+   * @param array $parameters
+   * @param bool  $escape
+   *
+   * @return array
+   */
+  protected function prepareParameters($parameters, $escape = true)
+  {
+    $filtered = array();
+    foreach ($parameters as $key => $value) {
+      if (is_array($value)) {
+        $value = $this->prepareParameters($value, $escape);
+      }
+      elseif ($value instanceof Reference) {
+        $value = '@'.$value;
+      }
+
+      $filtered[$key] = $value;
+    }
+
+    return $escape ? $this->escape($filtered) : $filtered;
+  }
+
+  /**
+   * Escapes arguments.
+   *
+   * @param array $arguments
+   *   The arguments to escape.
+   *
+   * @return array
+   *   The escaped arguments.
+   */
+  protected function escape($arguments)
+  {
+    $args = array();
+    foreach ($arguments as $k => $v) {
+      if (is_array($v)) {
+        $args[$k] = $this->escape($v);
+      }
+      elseif (is_string($v)) {
+        $args[$k] = str_replace('%', '%%', $v);
+      }
+      else {
+        $args[$k] = $v;
+      }
+    }
+
+    return $args;
+  }
+
+  /**
+   * Gets a service definition as PHP array.
+   *
+   * @param \Symfony\Component\DependencyInjection\Definition $definition
+   *   The definition to process.
+   *
+   * @return array
+   *   The service definition as PHP array.
+   */
+  protected function getServiceDefinition($definition)
+  {
+    $service = [];
+    if ($definition->getClass()) {
+      $service['class'] = $definition->getClass();
+    }
+
+    if (!$definition->isPublic()) {
+      $service['public'] = FALSE;
+    }
+
+/*
+    $tagsCode = '';
+    foreach ($definition->getTags() as $name => $tags) {
+      foreach ($tags as $attributes) {
+        $att = array();
+        foreach ($attributes as $key => $value) {
+          $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value));
+        }
+        $att = $att ? ', '.implode(', ', $att) : '';
+
+        $tagsCode .= sprintf("      - { name: %s%s }\n", $this->dumper->dump($name), $att);
+      }
+    }
+    if ($tagsCode) {
+      $code .= "    tags:\n".$tagsCode;
+    }
+*/
+
+    if ($definition->getFile()) {
+      $service['file'] = $definition->getFile();
+    }
+
+    if ($definition->isSynthetic()) {
+      $service['synthetic'] = TRUE;
+    }
+
+    if ($definition->isLazy()) {
+      $service['lazy'] = TRUE;
+    }
+
+    if ($definition->getArguments()) {
+      $service['arguments'] = $this->dumpValue($definition->getArguments());
+    }
+
+    if ($definition->getProperties()) {
+      $service['properties'] = $this->dumpValue($definition->getProperties());
+    }
+
+    if ($definition->getMethodCalls()) {
+      $service['calls'] = $this->dumpValue($definition->getMethodCalls());
+    }
+
+    if (($scope = $definition->getScope()) !== ContainerInterface::SCOPE_CONTAINER) {
+      $service['scope'] = $scope;
+    }
+
+    if (($decorated = $definition->getDecoratedService()) !== NULL) {
+      $service['decorates'] = $decorated;
+    }
+
+    if ($callable = $definition->getFactory()) {
+      $service['factory'] = $this->dumpCallable($callable);
+    }
+
+    if ($callable = $definition->getConfigurator()) {
+      $service['configurator'] = $this->dumpCallable($callable);
+    }
+
+    return $service;
+  }
+
+  /**
+   * Returns a service alias definiton.
+   *
+   * @param string $alias
+   * @param Alias  $id
+   *
+   * @return string
+   */
+  protected function getServiceAliasDefinition($id)
+  {
+    if ($id->isPublic()) {
+      return [
+        'alias' => '@' . $id,
+      ];
+    } else {
+      return [
+        'alias' => '@' . $id,
+        'public' => FALSE,
+      ];
+    }
+  }
+  /**
+   * Dumps callable to YAML format
+   *
+   * @param callable $callable
+   *
+   * @return callable
+   */
+  protected function dumpCallable($callable)
+  {
+    if (is_array($callable)) {
+      if ($callable[0] instanceof Reference) {
+        $callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]);
+      }
+      elseif ($callable[0] instanceof Definition) {
+        $callable[0] = $this->getPrivateService($callable[0]);
+        $callable = array($callable[0], $callable[1]);
+      }
+      else {
+        $callable = array($callable[0], $callable[1]);
+      }
+    }
+
+    return $callable;
+  }
+
+  /**
+   * Returns a private service definition in a suitable format.
+   *
+   * @param \Symfony\Component\DependencyInjection\Definition $definition
+   *   The definition to process.
+   *
+   * @return \stdClass
+   *   A very lightweight private service value object.
+   */
+  protected function getPrivateService(Definition $definition) {
+    $service_definition = $this->getServiceDefinition($definition);
+    $hash = sha1(serialize($service_definition));
+    return (object) [
+      'type' => 'service',
+      'id' => 'private__' . $hash,
+      'value' => $service_definition,
+    ];
+  }
+
+  /**
+   * Dumps the value to YAML format.
+   *
+   * @param mixed $value
+   *
+   * @return mixed
+   *
+   * @throws RuntimeException When trying to dump object or resource
+   */
+  protected function dumpValue($value)
+  {
+    if (is_array($value)) {
+      $code = array();
+      foreach ($value as $k => $v) {
+        $code[$k] = $this->dumpValue($v);
+      }
+
+      return $code;
+    } elseif ($value instanceof Reference) {
+      return $this->getServiceCall((string) $value, $value);
+    } elseif ($value instanceof Definition) {
+      return $this->getPrivateService($value);
+    } elseif ($value instanceof Parameter) {
+      return $this->getParameterCall((string) $value);
+    } elseif ($value instanceof Expression) {
+      return $this->getExpressionCall((string) $value);
+    } elseif (is_object($value)) {
+      if (isset($value->_serviceId)) {
+        return '@' . $value->_serviceId;
+      }
+      throw new RuntimeException('Unable to dump a service container if a parameter is an object without _serviceId.');
+    } elseif (is_resource($value)) {
+      throw new RuntimeException('Unable to dump a service container if a parameter is a resource.');
+    }
+
+    return $value;
+  }
+
+  /**
+   * Gets the service call.
+   *
+   * @param string  $id
+   * @param Reference $reference
+   *
+   * @return string
+   */
+  protected function getServiceCall($id, Reference $reference = null)
+  {
+    if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
+      return sprintf('@?%s', $id);
+    }
+
+    return sprintf('@%s', $id);
+  }
+
+  /**
+   * Gets parameter call.
+   *
+   * @param string $id
+   *
+   * @return string
+   */
+  protected function getParameterCall($id)
+  {
+    return sprintf('%%%s%%', $id);
+  }
+
+  protected function getExpressionCall($expression)
+  {
+    return sprintf('@=%s', $expression);
+  }
+}
diff --git a/core/lib/Drupal/Core/DependencyInjection/PhpArray/Container.php b/core/lib/Drupal/Core/DependencyInjection/PhpArray/Container.php
new file mode 100644
index 0000000..2ca8a91
--- /dev/null
+++ b/core/lib/Drupal/Core/DependencyInjection/PhpArray/Container.php
@@ -0,0 +1,387 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Core\DependencyInjection\PhpArray\Container
+ */
+
+namespace Drupal\Core\DependencyInjection\PhpArray;
+
+use ReflectionClass;
+use RuntimeException;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
+use Symfony\Component\DependencyInjection\ScopeInterface;
+
+/**
+ * Container is a DI container that provides services to users of the class.
+ *
+ * @ingroup dic
+ */
+class Container implements IntrospectableContainerInterface {
+
+  /**
+   * The parameters of the container.
+   *
+   * @var array
+   */
+  protected $parameters = array();
+
+  /**
+   * The service definitions of the container.
+   *
+   * @var array
+   */
+  protected $serviceDefinitions = array();
+
+  /**
+   * The instantiated services.
+   *
+   * @var array
+   */
+  protected $services = array();
+
+  /**
+   * The currently loading services.
+   *
+   * @var array
+   */
+  protected $loading = array();
+
+  /**
+   * Can the container parameters still be changed.
+   *
+   * For testing purposes the container needs to be changed.
+   *
+   * @var bool
+   */
+  protected $frozen = TRUE;
+
+  /**
+   * Constructs a new Container instance.
+   *
+   * @param array $container_definition
+   *   An array containing the 'services' and 'parameters'
+   * @param bool $frozen
+   *   (optional) Determines whether the container parameters can be changed,
+   *   defaults to TRUE;
+   */
+  public function __construct(array $container_definition, $frozen = TRUE) {
+    $this->parameters = $container_definition['parameters'];
+    $this->serviceDefinitions = $container_definition['services'];
+    $this->services['service_container'] = $this;
+    $this->frozen = $frozen;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function get($name, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+    if (isset($this->services[$name]) || ($invalidBehavior === ContainerInterface::NULL_ON_INVALID_REFERENCE && array_key_exists($name, $this->services))) {
+      return $this->services[$name];
+    }
+
+    if (isset($this->loading[$name])) {
+      throw new RuntimeException(sprintf('Circular reference detected for service "%s", path: "%s".', $name, implode(' -> ', array_keys($this->loading))));
+    }
+
+    $definition = $this->getDefinition($name, $invalidBehavior === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
+
+    if (!$definition) {
+      $this->services[$name] = NULL;
+      return $this->services[$name];
+    }
+
+    if (isset($definition['alias'])) {
+      return $this->get(substr($definition['alias'], 1), $invalidBehavior);
+    }
+
+    $this->loading[$name] = TRUE;
+
+    $definition += array(
+      'class' => '',
+      'factory' => '',
+      'factory_class' => '',
+      'factory_method' => '',
+      'factory_service' => '',
+      'arguments' => array(),
+      'properties' => array(),
+      'calls' => array(),
+      'tags' => array(),
+    ); // @codeCoverageIgnore
+
+    try {
+      $arguments = $this->expandArguments($definition['arguments'], $invalidBehavior);
+      if (!empty($definition['factory'])) {
+        $factory = $definition['factory'];
+        if (is_array($factory)) {
+          $factory = $this->expandArguments($factory, $invalidBehavior);
+        }
+        $service = call_user_func_array($factory, $arguments);
+      }
+      elseif (!empty($definition['factory_method'])) {
+        $method = $definition['factory_method'];
+
+        if (!empty($definition['factory_class'])) {
+          $factory = $definition['factory_class'];
+        }
+        elseif (!empty($definition['factory_service'])) {
+          $factory = $this->get($definition['factory_service'], $invalidBehavior);
+        }
+        else {
+          throw new RuntimeException(sprintf('Cannot create service "%s" from factory method without a factory service or factory class.', $name));
+        }
+        $service = call_user_func_array(array($factory, $method), $arguments);
+      }
+      else {
+        // @todo Allow dynamic class definitions via parameters.
+        $class = $definition['class'];
+        $length = count($arguments);
+
+        switch ($length) {
+          case 0:
+            $service = new $class();
+            break;
+          case 1:
+            $service = new $class($arguments[0]);
+            break;
+          case 2:
+            $service = new $class($arguments[0], $arguments[1]);
+            break;
+          case 3:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2]);
+            break;
+          case 4:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3]);
+            break;
+          case 5:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4]);
+            break;
+          case 6:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5]);
+            break;
+          case 7:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5], $arguments[6]);
+            break;
+          case 8:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5], $arguments[6], $arguments[7]);
+            break;
+          case 9:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5], $arguments[6], $arguments[7], $arguments[8]);
+            break;
+          case 10:
+            $service = new $class($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5], $arguments[6], $arguments[7], $arguments[8], $arguments[9]);
+            break;
+          default:
+            $r = new ReflectionClass($class);
+            $service = $r->newInstanceArgs($arguments);
+            break;
+        }
+      }
+    }
+    catch (\Exception $e) {
+      unset($this->loading[$name]);
+      throw $e;
+    }
+    $this->services[$name] = $service;
+    unset($this->loading[$name]);
+
+    foreach ($definition['calls'] as $call) {
+      $method = $call[0];
+      $arguments = array();
+      if (!empty($call[1])) {
+        $arguments = $this->expandArguments($call[1], $invalidBehavior);
+      }
+      call_user_func_array(array($service, $method), $arguments);
+    }
+    foreach ($definition['properties'] as $key => $value) {
+      $service->{$key} = $value;
+    }
+
+    return $this->services[$name];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function set($id, $service, $scope = self::SCOPE_CONTAINER) {
+    if (isset($service)) {
+      $service->_serviceId = $id;
+    }
+    $this->services[$id] = $service;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function has($id) {
+    return isset($this->services[$id]) || isset($this->serviceDefinitions[$id]);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDefinition($plugin_id, $exception_on_invalid = TRUE) {
+    $definition = isset($this->serviceDefinitions[$plugin_id]) ? $this->serviceDefinitions[$plugin_id] : NULL;
+
+    if (!$definition && $exception_on_invalid) {
+      throw new RuntimeException(sprintf('The "%s" service definition does not exist.', $plugin_id));
+    }
+
+    return $definition;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDefinitions() {
+    return $this->serviceDefinitions;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function hasDefinition($plugin_id) {
+    return isset($this->serviceDefinitions[$plugin_id]);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getParameter($name) {
+    return isset($this->parameters[$name]) ? $this->parameters[$name] : NULL;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function hasParameter($name) {
+    return isset($this->parameters[$name]);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setParameter($name, $value) {
+    if ($this->frozen) {
+      throw new \BadMethodCallException("Container parameters can't be changed on runtime.");
+    }
+    $this->parameters[$name] = $value;
+  }
+
+  /**
+   * Expands arguments from %parameter and @service to the resolved values.
+   *
+   * @param array $arguments
+   *   The arguments to expand.
+   * @param int $invalidBehavior
+   *   The behavior when the service does not exist
+   *
+   * @return array
+   *   The expanded arguments.
+   *
+   * @throws \RuntimeException if a parameter/service could not be resolved.
+   */
+  protected function expandArguments($arguments, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+    foreach ($arguments as $key => $argument) {
+      if ($argument instanceof \stdClass) {
+        $name = $argument->id;
+        $this->serviceDefinitions[$name] = $argument->value;
+        $arguments[$key] = $this->get($name, $invalidBehavior);
+        unset($this->serviceDefinitions[$name]);
+        unset($this->services[$name]);
+        continue;
+      }
+
+      if (is_array($argument)) {
+        $arguments[$key] = $this->expandArguments($argument, $invalidBehavior);
+        continue;
+      }
+
+      if (!is_string($argument)) {
+        continue;
+      }
+
+      if (strpos($argument, '%') === 0) {
+        $name = substr($argument, 1, -1);
+        if (!isset($this->parameters[$name])) {
+          if ($invalidBehavior === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+            throw new RuntimeException("Could not find parameter: $name");
+          }
+          $arguments[$key] = NULL;
+          continue;
+        }
+        $arguments[$key] = $this->parameters[$name];
+      }
+      else if (strpos($argument, '@') === 0) {
+        $name = substr($argument, 1);
+        if (strpos($name, '?') === 0) {
+          $name = substr($name, 1);
+          $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
+        }
+        if (!isset($this->serviceDefinitions[$name])) {
+          if ($invalidBehavior === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
+            throw new RuntimeException("Could not find service: $name");
+          }
+          $arguments[$key] = NULL;
+          continue;
+        }
+        $arguments[$key] = $this->get($name, $invalidBehavior);
+      }
+    }
+
+    return $arguments;
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function enterScope($name) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function leaveScope($name) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function addScope(ScopeInterface $scope) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function hasScope($name) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * @codeCoverageIgnore
+   */
+  public function isScopeActive($name) {
+    throw new \BadMethodCallException(sprintf("'%s' is not implemented", __FUNCTION__));
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function initialized($id) {
+    return isset($this->services[$id]);
+  }
+
+}
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index b8eeb4f..4f18ee1 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -15,9 +15,11 @@
 use Drupal\Core\Config\BootstrapConfigStorageFactory;
 use Drupal\Core\Config\NullStorage;
 use Drupal\Core\Database\Database;
+use Drupal\Core\DependencyInjection\PhpArray\Container as PhpArrayContainer;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\DependencyInjection\ServiceProviderInterface;
 use Drupal\Core\DependencyInjection\YamlFileLoader;
+use Drupal\Core\DependencyInjection\Dumper\PhpArrayDumper;
 use Drupal\Core\Extension\ExtensionDiscovery;
 use Drupal\Core\File\MimeType\MimeTypeGuesser;
 use Drupal\Core\Http\TrustedHostsRequestFactory;
@@ -29,6 +31,8 @@
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
+use Symfony\Component\DependencyInjection\Dumper\YamlDumper;
+use Symfony\Component\DependencyInjection\Dumper\XmlDumper;
 use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\HttpFoundation\Request;
@@ -57,6 +61,45 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
   const CONTAINER_BASE_CLASS = '\Drupal\Core\DependencyInjection\Container';
 
   /**
+   * Holds the bootstrap container definition.
+   *
+   * @var array
+   */
+  protected static $bootstrapContainerDefinition = [
+    'parameters' => [],
+    'services' => [
+      'database' => [
+        'class' => 'Drupal\Core\Database\Connection',
+        'factory_class' => 'Drupal\Core\Database\Database',
+        'factory_method' => 'getConnection',
+        'arguments' => ['default'],
+      ],
+      'lock' => [
+        'class' => 'Drupal\Core\Lock\DatabaseLockBackend',
+        'arguments' => ['@database'],
+      ],
+      'serialization.phpserialize' => [
+        'class' => 'Drupal\Component\Serialization\PhpSerialize',
+      ],
+      'keyvalue' => [
+        'class' => 'Drupal\Core\KeyValueStore\KeyValueDatabaseFactory',
+        'arguments' => ['@serialization.phpserialize', '@database'],
+      ],
+      'state' => [
+        'class' => 'Drupal\Core\State\State',
+        'arguments' => array('@keyvalue'),
+      ],
+    ],
+  ];
+
+  /**
+   * Holds the boostrap container instance.
+   *
+   * @var \Symfony\Component\DependencyInjection\ContainerInterface
+   */
+  protected $bootstrapContainer;
+
+  /**
    * Holds the container instance.
    *
    * @var \Symfony\Component\DependencyInjection\ContainerInterface
@@ -390,6 +433,8 @@ public function boot() {
     FileCacheFactory::setConfiguration($configuration);
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
 
+    $this->bootstrapContainer = new PhpArrayContainer(Settings::get('bootstrap_container_definition', static::$bootstrapContainerDefinition));
+
     // Initialize the container.
     $this->initializeContainer();
 
@@ -764,25 +809,30 @@ protected function initializeContainer($rebuild = FALSE) {
       }
     }
 
+    //$state = $this->bootstrapContainer->get('state');
+
     // If the module list hasn't already been set in updateModules and we are
     // not forcing a rebuild, then try and load the container from the disk.
     if (empty($this->moduleList) && !$rebuild) {
-      $fully_qualified_class_name = '\\' . $this->getClassNamespace() . '\\' . $this->getClassName();
-
-      // First, try to load from storage.
-      if (!class_exists($fully_qualified_class_name, FALSE)) {
-        $this->storage()->load($this->getClassName() . '.php');
-      }
-      // If the load succeeded or the class already existed, use it.
-      if (class_exists($fully_qualified_class_name, FALSE)) {
-        $container = new $fully_qualified_class_name;
+      // @todo State service does fail tests atm. as table is not created automatically.
+      // @todo Use cache service?
+      //$container_definition = $state->get('container_definition');
+      if ($file = $this->storage()->getFullPath('container_definition.php')) {
+        $container_definition = @include $file;
+        if (!$container_definition) {
+          $container_definition = NULL;
+        }
       }
     }
 
-    if (!isset($container)) {
-      $container = $this->compileContainer();
+    if (!isset($container_definition)) {
+      $container_builder = $this->compileContainerWithLock();
+      $dumper = new PhpArrayDumper($container_builder);
+      $container_definition = $dumper->getArray();
     }
 
+    $container = new PhpArrayContainer($container_definition);
+
     $this->attachSynthetic($container);
 
     $this->container = $container;
@@ -807,7 +857,7 @@ protected function initializeContainer($rebuild = FALSE) {
     \Drupal::setContainer($this->container);
 
     // If needs dumping flag was set, dump the container.
-    if ($this->containerNeedsDumping && !$this->dumpDrupalContainer($this->container, static::CONTAINER_BASE_CLASS)) {
+    if ($this->containerNeedsDumping && !$this->cacheDrupalContainer($container_definition)) {
       $this->container->get('logger.factory')->get('DrupalKernel')->notice('Container cannot be written to disk');
     }
 
@@ -1038,6 +1088,16 @@ protected function attachSynthetic(ContainerInterface $container) {
   }
 
   /**
+   * Compiles a new service container using a lock.
+   *
+   * @return ContainerBuilder The compiled service container
+   */
+  protected function compileContainerWithLock() {
+    // @todo Implement lock here.
+    return $this->compileContainer();
+  }
+
+  /**
    * Compiles a new service container.
    *
    * @return ContainerBuilder The compiled service container
@@ -1161,36 +1221,24 @@ protected function getContainerBuilder() {
   }
 
   /**
-   * Dumps the service container to PHP code in the config directory.
-   *
-   * This method is based on the dumpContainer method in the parent class, but
-   * that method is reliant on the Config component which we do not use here.
-   *
-   * @param ContainerBuilder $container
-   *   The service container.
-   * @param string $baseClass
-   *   The name of the container's base class
+   * Stores the container definition in a cache.
    *
    * @return bool
-   *   TRUE if the container was successfully dumped to disk.
+   *   TRUE if the container was successfully cached.
    */
-  protected function dumpDrupalContainer(ContainerBuilder $container, $baseClass) {
+  protected function cacheDrupalContainer($container_definition) {
+    // @todo Use a cache backend - if possible.
+    // @todo State service does fail tests atm. as table is not created automatically.
+    //return $this->bootstrapContainer->get('state')->set('container_definition', $container_definition);
     if (!$this->storage()->writeable()) {
       return FALSE;
     }
-    // Cache the container.
-    $dumper = new PhpDumper($container);
-    $dumper->setProxyDumper(new ProxyDumper(new ProxyBuilder()));
-    $class = $this->getClassName();
-    $namespace = $this->getClassNamespace();
-    $content = $dumper->dump([
-      'class' => $class,
-      'base_class' => $baseClass,
-      'namespace' => $namespace,
-    ]);
-    return $this->storage()->save($class . '.php', $content);
-  }
 
+    $code = var_export($container_definition, TRUE);
+    $code = str_replace("stdClass::__set_state", "(object)", $code);
+
+    return $this->storage()->save('container_definition.php', '<?php return ' . $code . ';');
+  }
 
   /**
    * Gets a http kernel from the container
diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php
index c757d1e..ef24014 100644
--- a/core/lib/Drupal/Core/Site/Settings.php
+++ b/core/lib/Drupal/Core/Site/Settings.php
@@ -107,15 +107,17 @@ public static function getAll() {
    *   The class loader that is used for this request. Passed by reference and
    *   exposed to the local scope of settings.php, so as to allow it to be
    *   decorated with Symfony's ApcClassLoader, for example.
+   * @param array $settings
+   *   Initial settings, set by DrupalKernel.
    *
    * @see default.settings.php
    */
   public static function initialize($app_root, $site_path, &$class_loader) {
     // Export these settings.php variables to the global namespace.
     global $base_url, $config_directories, $config;
-    $settings = array();
     $config = array();
     $databases = array();
+    $settings = array();
 
     if (is_readable($app_root . '/' . $site_path . '/settings.php')) {
       require $app_root . '/' . $site_path . '/settings.php';
diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index 481b031..d890b41 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -289,6 +289,7 @@ protected function tearDown() {
   public function containerBuild(ContainerBuilder $container) {
     // Keep the container object around for tests.
     $this->container = $container;
+    $this->containerBuilder = $container;
 
     // Set the default language on the minimal container.
     $this->container->setParameter('language.default_values', $this->defaultLanguageData());
@@ -298,7 +299,7 @@ public function containerBuild(ContainerBuilder $container) {
 
     $container
       ->register('config.storage', 'Drupal\Core\Config\DatabaseStorage')
-      ->addArgument(Database::getConnection())
+      ->addArgument(new Reference('database'))
       ->addArgument('config');
 
     if ($this->strictConfigSchema) {
@@ -312,6 +313,7 @@ public function containerBuild(ContainerBuilder $container) {
     $keyvalue_options['default'] = 'keyvalue.memory';
     $container->setParameter('factory.keyvalue', $keyvalue_options);
     $container->set('keyvalue.memory', $this->keyValueFactory);
+    $container->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory')->setSynthetic(TRUE);
     if (!$container->has('keyvalue')) {
       // TestBase::setUp puts a completely empty container in
       // $this->container which is somewhat the mirror of the empty
@@ -507,6 +509,10 @@ protected function enableModules(array $modules) {
     $module_filenames = $module_handler->getModuleList();
     $this->kernel->updateModules($module_filenames, $module_filenames);
 
+    // Get a fresh container, because ::containerBuild set $this->container to
+    // the active container builder, but that is no longer the active container.
+    $this->container = $this->kernel->getContainer();
+
     // Ensure isLoaded() is TRUE in order to make _theme() work.
     // Note that the kernel has rebuilt the container; this $module_handler is
     // no longer the $module_handler instance from above.
diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index 5471ed6..ea594b7 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -277,6 +277,13 @@
   protected $container;
 
   /**
+   * The dependency injection container builder used in the test.
+   *
+   * @var \Symfony\Component\DependencyInjection\ContainerBuilder
+   */
+  protected $containerBuilder;
+
+  /**
    * The config importer that can used in a test.
    *
    * @var \Drupal\Core\Config\ConfigImporter
diff --git a/core/modules/system/src/Tests/Cache/ChainedFastBackendUnitTest.php b/core/modules/system/src/Tests/Cache/ChainedFastBackendUnitTest.php
index c34563c..2f982e1 100644
--- a/core/modules/system/src/Tests/Cache/ChainedFastBackendUnitTest.php
+++ b/core/modules/system/src/Tests/Cache/ChainedFastBackendUnitTest.php
@@ -27,7 +27,7 @@ class ChainedFastBackendUnitTest extends GenericCacheBackendUnitTestBase {
   protected function createCacheBackend($bin) {
     $consistent_backend = new DatabaseBackend(\Drupal::service('database'), \Drupal::service('cache_tags.invalidator.checksum'), $bin);
     $fast_backend = new PhpBackend($bin, \Drupal::service('cache_tags.invalidator.checksum'));
-    $backend = new ChainedFastBackend($consistent_backend, $fast_backend, $bin);
+    $backend = new ChainedFastBackend($consistent_backend, $fast_backend, $bin, \Drupal::service('cache_tags.invalidator.checksum'));
     // Explicitly register the cache bin as it can not work through the
     // cache bin list in the container.
     \Drupal::service('cache_tags.invalidator')->addInvalidator($backend);
diff --git a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
index 84178a1..878f3d1 100644
--- a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
+++ b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
@@ -98,9 +98,7 @@ public function testCompileDIC() {
     $kernel = $this->getTestKernel($request);
     $container = $kernel->getContainer();
     $refClass = new \ReflectionClass($container);
-    $is_compiled_container =
-      $refClass->getParentClass()->getName() == 'Drupal\Core\DependencyInjection\Container' &&
-      !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
+    $is_compiled_container = !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
     $this->assertTrue($is_compiled_container);
     // Verify that the list of modules is the same for the initial and the
     // compiled container.
@@ -113,9 +111,7 @@ public function testCompileDIC() {
       ->getContainer();
 
     $refClass = new \ReflectionClass($container);
-    $is_compiled_container =
-      $refClass->getParentClass()->getName() == 'Drupal\Core\DependencyInjection\Container' &&
-      !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
+    $is_compiled_container = !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
     $this->assertTrue($is_compiled_container);
 
     // Verify that the list of modules is the same for the initial and the
@@ -146,7 +142,7 @@ public function testCompileDIC() {
 
     $refClass = new \ReflectionClass($container);
     $is_container_builder = $refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
-    $this->assertTrue($is_container_builder, 'Container is a builder');
+    $this->assertFalse($is_container_builder, 'Container is not a builder');
 
     // Assert that the new module's bundle was registered to the new container.
     $this->assertTrue($container->has('service_provider_test_class'), 'Container has test service');
diff --git a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php b/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
index 3096310..4e9feee 100644
--- a/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
+++ b/core/modules/system/src/Tests/HttpKernel/StackKernelIntegrationTest.php
@@ -53,19 +53,19 @@ public function testRequest() {
    * Tests that late middlewares are automatically flagged lazy.
    */
   public function testLazyLateMiddlewares() {
-    $this->assertFalse($this->container->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
-    $this->assertFalse($this->container->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is not set');
-    $this->assertFalse($this->container->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is not set');
-    $this->assertFalse($this->container->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is not set');
 
     \Drupal::service('module_installer')->install(['page_cache']);
     $this->container = $this->kernel->rebuildContainer();
 
-    $this->assertFalse($this->container->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
-    $this->assertFalse($this->container->getDefinition('http_middleware.page_cache')->isLazy(), 'lazy flag on http_middleware.page_cache definition is not set');
-    $this->assertTrue($this->container->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is automatically set if page_cache is enabled.');
-    $this->assertTrue($this->container->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is automatically set if page_cache is enabled.');
-    $this->assertTrue($this->container->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is automatically set if page_cache is enabled.');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.reverse_proxy')->isLazy(), 'lazy flag on http_middleware.reverse_proxy definition is not set');
+    $this->assertFalse($this->containerBuilder->getDefinition('http_middleware.page_cache')->isLazy(), 'lazy flag on http_middleware.page_cache definition is not set');
+    $this->assertTrue($this->containerBuilder->getDefinition('http_middleware.kernel_pre_handle')->isLazy(), 'lazy flag on http_middleware.kernel_pre_handle definition is automatically set if page_cache is enabled.');
+    $this->assertTrue($this->containerBuilder->getDefinition('http_middleware.session')->isLazy(), 'lazy flag on http_middleware.session definition is automatically set if page_cache is enabled.');
+    $this->assertTrue($this->containerBuilder->getDefinition('http_kernel.basic')->isLazy(), 'lazy flag on http_kernel.basic definition is automatically set if page_cache is enabled.');
   }
 
 }
diff --git a/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php b/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php
index 9b67692..53b5a00 100644
--- a/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php
+++ b/core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php
@@ -27,7 +27,9 @@ class ServiceProviderTest extends WebTestBase {
    * Tests that services provided by module service providers get registered to the DIC.
    */
   function testServiceProviderRegistration() {
-    $this->assertTrue(\Drupal::getContainer()->getDefinition('file.usage')->getClass() == 'Drupal\\service_provider_test\\TestFileUsage', 'Class has been changed');
+    // @todo This wants to test the container builder, but that is not available at run-time.
+    $definition = \Drupal::getContainer()->getDefinition('file.usage');
+    $this->assertTrue($definition['class'] == 'Drupal\\service_provider_test\\TestFileUsage', 'Class has been changed');
     $this->assertTrue(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service has been registered to the DIC');
     // The event subscriber method in the test class calls drupal_set_message with
     // a message saying it has fired. This will fire on every page request so it
diff --git a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
index 11e1600..bcbb273 100644
--- a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
@@ -43,22 +43,23 @@ class ChainedFastBackendTest extends UnitTestCase {
    */
   public function testGetDoesntHitConsistentBackend() {
     $consistent_cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
-    $timestamp_cid = ChainedFastBackend::LAST_WRITE_TIMESTAMP_PREFIX . 'cache_foo';
-    // Use the request time because that is what we will be comparing against.
-    $timestamp_item = (object) array('cid' => $timestamp_cid, 'data' => (int) $_SERVER['REQUEST_TIME'] - 60);
-    $consistent_cache->expects($this->once())
-      ->method('get')->with($timestamp_cid)
-      ->will($this->returnValue($timestamp_item));
+    $consistent_cache->expects($this->never())
+      ->method('get');
     $consistent_cache->expects($this->never())
       ->method('getMultiple');
 
     $fast_cache = new MemoryBackend('foo');
     $fast_cache->set('foo', 'baz');
 
+    $checksum_provider = $this->getMock('Drupal\Core\Cache\CacheTagsChecksumInterface');
+    $checksum_provider->expects($this->once())
+      ->method('isValid')
+      ->willReturn(TRUE);
     $chained_fast_backend = new ChainedFastBackend(
       $consistent_cache,
       $fast_cache,
-      'foo'
+      'foo',
+      $checksum_provider
     );
     $this->assertEquals('baz', $chained_fast_backend->get('foo')->data);
   }
@@ -67,48 +68,44 @@ public function testGetDoesntHitConsistentBackend() {
    * Tests a fast cache miss gets data from the consistent cache backend.
    */
   public function testFallThroughToConsistentCache() {
-    $timestamp_item = (object) array(
-      'cid' => ChainedFastBackend::LAST_WRITE_TIMESTAMP_PREFIX . 'cache_foo',
-      'data' => time() + 60, // Time travel is easy.
-    );
     $cache_item = (object) array(
       'cid' => 'foo',
       'data' => 'baz',
       'created' => time(),
       'expire' => time() + 3600,
       'tags' => ['tag'],
+      'checksum' => 'checksum',
     );
 
     $consistent_cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
     $fast_cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
 
-    // We should get a call for the timestamp on the consistent backend.
-    $consistent_cache->expects($this->once())
-      ->method('get')
-      ->with($timestamp_item->cid)
-      ->will($this->returnValue($timestamp_item));
-
     // We should get a call for the cache item on the consistent backend.
     $consistent_cache->expects($this->once())
       ->method('getMultiple')
-      ->with(array($cache_item->cid))
-      ->will($this->returnValue(array($cache_item->cid => $cache_item)));
+      ->with([$cache_item->cid])
+      ->will($this->returnValue([$cache_item->cid => $cache_item]));
 
     // We should get a call for the cache item on the fast backend.
     $fast_cache->expects($this->once())
       ->method('getMultiple')
-      ->with(array($cache_item->cid))
-      ->will($this->returnValue(array($cache_item->cid => $cache_item)));
+      ->with([$cache_item->cid])
+      ->will($this->returnValue([$cache_item->cid => $cache_item]));
 
     // We should get a call to set the cache item on the fast backend.
     $fast_cache->expects($this->once())
       ->method('set')
       ->with($cache_item->cid, $cache_item->data, $cache_item->expire);
 
+    $checksum_provider = $this->getMock('Drupal\Core\Cache\CacheTagsChecksumInterface');
+    $checksum_provider->expects($this->once())
+      ->method('isValid')
+      ->willReturn(FALSE);
     $chained_fast_backend = new ChainedFastBackend(
       $consistent_cache,
       $fast_cache,
-      'foo'
+      'foo',
+      $checksum_provider
     );
     $this->assertEquals('baz', $chained_fast_backend->get('foo')->data);
   }
diff --git a/core/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php b/core/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php
index 0a78967..cd40934 100644
--- a/core/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php
+++ b/core/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php
@@ -30,6 +30,8 @@ class ResolveParameterPlaceHoldersPass implements CompilerPassInterface
      */
     public function process(ContainerBuilder $container)
     {
+// @todo Remove compiler pass via getPasses() / setPasses().
+return;
         $parameterBag = $container->getParameterBag();
 
         foreach ($container->getDefinitions() as $id => $definition) {
