Version 2.17.0-73.0.dev

Merge commit 'e4942db83e2ad147de8710c0c96629f676fc91e3' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5cb4c0c..f525e29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -97,14 +97,6 @@
 
 [an issue]: https://github.com/dart-lang/sdk/issues/new
 
-- **Breaking Change** [#46100](https://github.com/dart-lang/sdk/issues/46100):
-  The deprecated standalone `pub` tool has been removed.
-  Its replacement is the `dart pub` command.
-  Should you find any issues, or missing features, in the replacement
-  command, kindly file [an issue][].
-
-[an issue]: https://github.com/dart-lang/pub/issues/new
-
 #### Pub
 
 - Fixed race conditions in `dart pub get`, `dart run` and `dart pub global run`.
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 5820062..6dc5ce0 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -2445,10 +2445,10 @@
       flow.tryCatchStatement_bodyBegin();
     }
     body.accept(this);
+    nullSafetyDeadCodeVerifier.flowEnd(node.body);
+    nullSafetyDeadCodeVerifier.tryStatementEnter(node);
     if (catchClauses.isNotEmpty) {
       flow.tryCatchStatement_bodyEnd(body);
-      nullSafetyDeadCodeVerifier.flowEnd(node.body);
-      nullSafetyDeadCodeVerifier.tryStatementEnter(node);
 
       var catchLength = catchClauses.length;
       for (var i = 0; i < catchLength; ++i) {
@@ -2464,8 +2464,8 @@
       }
 
       flow.tryCatchStatement_end();
-      nullSafetyDeadCodeVerifier.tryStatementExit(node);
     }
+    nullSafetyDeadCodeVerifier.tryStatementExit(node);
 
     if (finallyBlock != null) {
       flow.tryFinallyStatement_finallyBegin(
diff --git a/pkg/analyzer/test/src/diagnostics/dead_code_test.dart b/pkg/analyzer/test/src/diagnostics/dead_code_test.dart
index e2ba5bb..1ef5d39 100644
--- a/pkg/analyzer/test/src/diagnostics/dead_code_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/dead_code_test.dart
@@ -140,6 +140,24 @@
       error(HintCode.DEAD_CODE, 111, 10),
     ]);
   }
+
+  test_try_finally() async {
+    await assertErrorsInCode('''
+main() {
+  try {
+    foo();
+    print('dead');
+  } finally {
+    print('alive');
+  }
+  print('dead');
+}
+Never foo() => throw 'exception';
+''', [
+      error(HintCode.DEAD_CODE, 32, 14),
+      error(HintCode.DEAD_CODE, 87, 14),
+    ]);
+  }
 }
 
 mixin DeadCodeTestCases on PubPackageResolutionTest {
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index 08ff0cc..5147fdc 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -1582,7 +1582,8 @@
       // Initialize the result's data pointer field.
       body += LoadLocal(typed_data_object);
       body += LoadLocal(arg_pointer);
-      body += LoadNativeField(Slot::Pointer_data_field());
+      body += LoadUntagged(compiler::target::Pointer::data_field_offset());
+      body += ConvertUntaggedToUnboxed(kUnboxedIntPtr);
       body += StoreNativeField(Slot::TypedDataBase_data_field(),
                                StoreInstanceFieldInstr::Kind::kInitializing,
                                kNoStoreBarrier);
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 8e6a103..867dd32 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -39,6 +39,7 @@
 # ......dartanalyzer
 # ......dartdevc
 # ......utils/gen_snapshot or utils/gen_snapshot.exe (if not on ia32)
+# ......pub
 # ......snapshots/
 # ........analysis_server.dart.snapshot
 # ........dart2js.dart.snapshot
@@ -87,12 +88,16 @@
 # ......api_readme.md
 
 # Scripts that go under bin/
-_platform_sdk_scripts = [ "dartanalyzer" ]
+_platform_sdk_scripts = [
+  "dartanalyzer",
+  "pub",
+]
 
 _full_sdk_scripts = [
   "dart2js",
   "dartanalyzer",
   "dartdevc",
+  "pub",
 ]
 
 # Snapshots that go under bin/snapshots
diff --git a/sdk/bin/pub.bat b/sdk/bin/pub.bat
new file mode 100644
index 0000000..7eb8b0d
--- /dev/null
+++ b/sdk/bin/pub.bat
@@ -0,0 +1,56 @@
+@echo off
+REM Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
+REM for details. All rights reserved. Use of this source code is governed by a
+REM BSD-style license that can be found in the LICENSE file.
+
+rem Run pub.dart on the Dart VM. This script is only used when running pub from
+rem within the Dart source repo. The shipped SDK instead uses "pub_sdk.bat",
+rem which is renamed to "pub.bat" when the SDK is built.
+
+setlocal
+rem Handle the case where dart-sdk/bin has been symlinked to.
+set DIR_NAME_WITH_SLASH=%~dp0
+set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
+call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
+rem Get rid of surrounding quotes.
+for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
+
+rem Get absolute full name for SDK_DIR.
+for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
+
+rem Remove trailing backslash if there is one
+IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
+
+set VM_OPTIONS=
+
+rem We allow extra vm options to be passed in through an environment variable.
+if not "_%DART_VM_OPTIONS%_" == "__" (
+  set VM_OPTIONS=%VM_OPTIONS% %DART_VM_OPTIONS%
+)
+
+rem Use the Dart binary in the built SDK so pub can find the version file next
+rem to it.
+set BUILD_DIR=%SDK_DIR%\..\out\ReleaseX64
+set DART=%BUILD_DIR%\dart-sdk\bin\dart
+
+rem Run pub.
+set PUB="%SDK_DIR%\..\third_party\pkg\pub\bin\pub.dart"
+"%DART%" "--packages=%SDK_DIR%\..\.packages" %VM_OPTIONS% "%PUB%" %*
+
+endlocal
+
+exit /b %errorlevel%
+
+:follow_links
+setlocal
+for %%i in (%1) do set result=%%~fi
+set current=
+for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
+                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
+  set current=%%i
+)
+if not "%current%"=="" call :follow_links "%current%", result
+endlocal & set %~2=%result%
+goto :eof
+
+:end
diff --git a/sdk/bin/pub_sdk b/sdk/bin/pub_sdk
new file mode 100755
index 0000000..17ce14c
--- /dev/null
+++ b/sdk/bin/pub_sdk
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+# Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# Run pub.dart on the Dart VM. This script assumes the Dart SDK's directory
+# structure.
+
+function follow_links() {
+  file="$1"
+  while [ -h "$file" ]; do
+    # On Mac OS, readlink -f doesn't work.
+    file="$(readlink "$file")"
+  done
+  echo "$file"
+}
+
+function array_contains() {
+  local needle="$1"
+  local element
+  shift
+  for element; do [ "$element" = "$needle" ] && return 0; done
+  return 1
+}
+
+# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
+PROG_NAME="$(follow_links "$BASH_SOURCE")"
+
+# Handle the case where dart-sdk/bin has been symlinked to.
+BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
+DART="$BIN_DIR/dart"
+
+unset VM_OPTIONS
+declare -a VM_OPTIONS
+
+# Allow extra VM options to be passed in through an environment variable.
+if [[ $DART_VM_OPTIONS ]]; then
+  read -a OPTIONS <<< "$DART_VM_OPTIONS"
+  VM_OPTIONS+=("${OPTIONS[@]}")
+fi
+
+if [ -t 2 ]; then # Only print warning when run in terminal.
+  >&2 echo 'The top level `pub` command is deprecated. Use `dart pub` instead.'
+fi
+
+# Forward to the `dart __deprecatedpub` command.
+exec "$DART" "${VM_OPTIONS[@]}" __deprecated_pub "$@"
diff --git a/sdk/bin/pub_sdk.bat b/sdk/bin/pub_sdk.bat
new file mode 100644
index 0000000..e882aac
--- /dev/null
+++ b/sdk/bin/pub_sdk.bat
@@ -0,0 +1,50 @@
+@echo off
+REM Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+REM for details. All rights reserved. Use of this source code is governed by a
+REM BSD-style license that can be found in the LICENSE file.
+
+setlocal
+rem Handle the case where dart-sdk/bin has been symlinked to.
+set DIR_NAME_WITH_SLASH=%~dp0
+set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
+call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
+rem Get rid of surrounding quotes.
+for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
+
+rem Get absolute full name for SDK_DIR.
+for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
+
+rem Remove trailing backslash if there is one
+IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
+
+set VM_OPTIONS=
+set USING_DART_1=
+
+rem We allow extra vm options to be passed in through an environment variable.
+if not "_%DART_VM_OPTIONS%_" == "__" (
+  set VM_OPTIONS=%VM_OPTIONS% %DART_VM_OPTIONS%
+  for %%o in (%DART_VM_OPTIONS%) do (
+    if "%%o" equ "--no-preview-dart-2" set USING_DART_1=y
+  )
+)
+
+echo "The top level `pub.bat` command is deprecated. Use `dart pub` instead." 1>&2
+"%BIN_DIR%\dart" %VM_OPTIONS% __deprecated_pub %*
+
+endlocal
+
+exit /b %errorlevel%
+
+:follow_links
+setlocal
+for %%i in (%1) do set result=%%~fi
+set current=
+for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
+                                             ^| %SystemRoot%\System32\find.exe ">     %~n1 [" 2^>nul`) do (
+  set current=%%i
+)
+if not "%current%"=="" call :follow_links "%current%", result
+endlocal & set %~2=%result%
+goto :eof
+
+:end
diff --git a/tests/ffi/regress_flutter97301_test.dart b/tests/ffi/regress_flutter97301_test.dart
new file mode 100644
index 0000000..c330d70
--- /dev/null
+++ b/tests/ffi/regress_flutter97301_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Verifies that there are no deoptimizing IntConverter instructions
+// used when converting Pointer to TypedData.
+// Regression test for https://github.com/flutter/flutter/issues/97301.
+
+import "dart:ffi";
+import "package:ffi/ffi.dart";
+
+@pragma("vm:never-inline")
+Pointer<Uint32> foo() => calloc(4);
+
+main() {
+  final Pointer<Uint32> offsetsPtr = foo();
+
+  for (var i = 0; i < 2; i++) {
+    print(offsetsPtr.asTypedList(1));
+  }
+}
diff --git a/tests/ffi_2/regress_flutter97301_test.dart b/tests/ffi_2/regress_flutter97301_test.dart
new file mode 100644
index 0000000..1417a7a
--- /dev/null
+++ b/tests/ffi_2/regress_flutter97301_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Verifies that there are no deoptimizing IntConverter instructions
+// used when converting Pointer to TypedData.
+// Regression test for https://github.com/flutter/flutter/issues/97301.
+
+// @dart = 2.9
+
+import "dart:ffi";
+import "package:ffi/ffi.dart";
+
+@pragma("vm:never-inline")
+Pointer<Uint32> foo() => calloc(4);
+
+main() {
+  final Pointer<Uint32> offsetsPtr = foo();
+
+  for (var i = 0; i < 2; i++) {
+    print(offsetsPtr.asTypedList(1));
+  }
+}
diff --git a/tools/VERSION b/tools/VERSION
index bdc251a..d4f4541 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 17
 PATCH 0
-PRERELEASE 72
+PRERELEASE 73
 PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/pub_integration_test.py b/tools/bots/pub_integration_test.py
index 4f35ae6..f80c554 100755
--- a/tools/bots/pub_integration_test.py
+++ b/tools/bots/pub_integration_test.py
@@ -35,10 +35,10 @@
     mode = ('Debug' if options.mode == 'debug' else 'Release')
 
     out_dir = 'xcodebuild' if sys.platform == 'darwin' else 'out'
-    extension = '' if not sys.platform == 'win32' else '.exe'
-    dart = os.path.abspath('%s/%s%s/dart-sdk/bin/dart%s' %
-                           (out_dir, mode, arch, extension))
-    print(dart)
+    extension = '' if not sys.platform == 'win32' else '.bat'
+    pub = os.path.abspath('%s/%s%s/dart-sdk/bin/pub%s' %
+                          (out_dir, mode, arch, extension))
+    print(pub)
 
     working_dir = tempfile.mkdtemp()
     try:
@@ -49,15 +49,11 @@
         with open(working_dir + '/pubspec.yaml', 'w') as pubspec_yaml:
             pubspec_yaml.write(PUBSPEC)
 
-        exit_code = subprocess.call([dart, 'pub', 'get'],
-                                    cwd=working_dir,
-                                    env=env)
+        exit_code = subprocess.call([pub, 'get'], cwd=working_dir, env=env)
         if exit_code != 0:
             return exit_code
 
-        exit_code = subprocess.call([dart, 'pub', 'upgrade'],
-                                    cwd=working_dir,
-                                    env=env)
+        exit_code = subprocess.call([pub, 'upgrade'], cwd=working_dir, env=env)
         if exit_code != 0:
             return exit_code
     finally:
diff --git a/tools/linux_dist_support/linux_distribution_support.py b/tools/linux_dist_support/linux_distribution_support.py
index cb739d4..35b7b07 100644
--- a/tools/linux_dist_support/linux_distribution_support.py
+++ b/tools/linux_dist_support/linux_distribution_support.py
@@ -123,6 +123,9 @@
         Run(['/usr/lib/dart/bin/dart', 'analyze', test_file])
         Run(['/usr/lib/dart/bin/dart', test_file])
 
+    # Sanity check that pub can start up and print the version
+    Run(['/usr/lib/dart/bin/pub', '--version'])
+
     UninstallDart()
     TestInstallation(assume_installed=False)