When VM starts, it will try to find kernel service snapshot which is located together with exe file. However, if symbolic link is provided, the directory to search will become the parent directory of link but not the actual target.
This cl will resolve the symbolic link to find the kernel service snapshot.
Bug: https://github.com/dart-lang/sdk/issues/35188
Change-Id: I842973a9b73439003a748122d9416158d155892e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129380
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Also build Dart_LoadELF_Fd on Linux as well to get minimal coverage for Fuchsia.
Change-Id: I4be3eeae3e4559e95413fd60a26b9e6d2edabb32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127644
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Loading of appended snapshots used to try read the executable itself
via arg[0] which holds the "path" to the executable.
However, when the executable is being invoked via PATH the "path"
can be just the name of the executable with no actual path.
This would cause the file reading to fail to find the file and
therefore fail to read.
This in turn caused standalone executables to fail to run when invoked
via PATH.
Bug: https://github.com/dart-lang/sdk/issues/38912
Change-Id: I08501661441db90ce6cff96a9337a5770ec3524d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121853
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Also switch some CQ bots using blobs to ELF. Once all embedders have migrated, we will remove blobs
support entirely.
Change-Id: Ie5e8c1187ad6c1af362b5715daafd3641bc8cc0e
Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-bare-linux-release-simarm-try,vm-kernel-precomp-mac-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-android-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116620
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Prior to this change, on Linux, if one created a symbolic link to the
dart executable and ran that, the kernel-service snapshot would not be
found. This has the effect of compiling the input script on a
non-trained kernel service, meaning the startup is slower.
This is particularly bad as the debian install of dart creates a symbolic
link to dart as /usr/bin/dart with the target being /usr/lib/dart/bin/dart
meaning that for instance running a hello-world script like one normally
would, `dart hello.dart` would take something along the lines of 3-4 times
longer than if running `/usr/lib/dart/bin/dart hello.dart`.
On my Pixelbook (in crostini) this is ~755 ms vs ~210 ms.
This change does *NOT* fix it on other platforms.
Change-Id: I6c9105d49205f3e4b9ea64e8ddb95a1d36ae21a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117144
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Change some static_libraries to source_sets to make ODR violations link-time errors.
This is needed to enable (stop suppressing) -fvisibility=hidden in Fuchsia product builds.
Change-Id: I699cec8d4b516beab9cebf9db0a522a7ff99e004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99822
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit 2d4c606e63.
The fix for the debug buildbot breakage now consists of skipping wide to utf8 conversion
altogether, instead move uri to path conversion directly into newly added File::OpenUri method.
Change-Id: Id3d7457d6a6b5045e5f38678548f4d7bed6d2c43
Reviewed-on: https://dart-review.googlesource.com/39801
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
The content handlers on Fuchsia can potentially give each Isolate
different handles to use for stdout and stderr. This change provides
a hook for an embedder to call to supply the handles to Dart, and
removes hardcoding of stdio handles to 0, 1, 2.
Change-Id: Ic03b77adc9a911e9c754562fa6a91f9929e10dfc
Reviewed-on: https://dart-review.googlesource.com/36122
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Fuchsia requires the ability to sandbox Isolates w.r.t. file IO.
When a new Isolate starts, Fuchsia will pass the Isolate an object
called a namespace. We can translate the namespace object into a
file descriptor suitable for passing to the *at() family of
POSIX file system calls. The file system calls will then
have visibility only into the specified namespace.
We also plumb Namespaces through on all the other platforms as well to
make the change easier to test and so that in the future we can
implement e.g. per-isolate cwds.
This change adds a new internal class to dart:io called _Namespace,
which is implemented in a patch file. See:
sdk/lib/io/namespace_impl.dart
runtime/bin/namespace_patch.dart
The embedder can set up a non-default namespace by calling
_Namespace._setupNamespace during Isolate setup.
Instances of _Namespace have a native field that holds a pointer
to a native Namespace object. See:
runtime/bin/namespace.h
Calls from e.g. file_impl.dart are now also passed a
_Namespace object. The implementations in e.g. file.cc and
file_linux.cc then extract the namespace, and use it to compute a
file descriptor and path suitable for passing to e.g. openat().
related US-313
R=asiva@google.com, rmacnak@google.com
Review-Url: https://codereview.chromium.org/3007703002 .
- Don't try to mmap an empty file.
- Use correct filename for mapping errors.
- Don't set the root library for core-jit snapshots.
- Accept hyphen variants of options for entry points and compilation traces.
R=zra@google.com
Review-Url: https://codereview.chromium.org/2928663002 .
If an Isolate touches the 'stdio' getter, a _NativeSocket with
attached finalizer is created for it. Previously, when such an
Isolate exited, the finalizer would close the underlying
file descriptor. This CL changes the finalizer for stdin such
that the native objects will be cleaned up, but the underlying
file descriptor will not be closed. The underlying file
descriptor will now only be closed if the stdin stream
subscription is explicitly canceled.
Accessing the stdin getter after the stream is explicitly
canceled will result in a FileSystemException.
See also: https://github.com/dart-lang/test/issues/583fixes#29229R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2791423002 .
This CL changes File::Write on Windows to call directly to WriteFile()
instead of using _write(). This avoids a number of complexities:
1. Don't need to bother with text vs. binary mode.
2. Don't need to check both errno and GetLastError if _write() fails.
3. Don't need to convert to a wchar_t* for console output since we've
already set the code page to UTF8.
fixes#29101R=fschneider@google.com
Review-Url: https://codereview.chromium.org/2761673002 .
Like HOST_ARCH_*, HOST_OS_* describes the OS the VM is running on, which may be different from the OS the VM is generating code for during AOT compilation.
Currently we conflate the two when emitting AOT as assembly, and we get away with it because Flutter only uses assembly for targeting iOS and one can only target iOS from a Mac, but we expect to use assembly for Android as well so native tools can unwind Dart frames.
R=zra@google.com
Review-Url: https://codereview.chromium.org/2750843003 .
This change has two pieces.
- Set the console code page to UTF8.
- This makes strings printed with print() display correctly
- Set the file translation mode to _O_WTEXT when writing to a
stdout or stderr that is connected to a console.
- This makes strings printed with e.g. stdout.writeln()
display correctly.
fixes#28571R=asiva@google.com, fschneider@google.com
Review-Url: https://codereview.chromium.org/2698813002 .
For blobs, put all four pieces into a single file with a header describing their offsets.
For dynamic libraries, move the vm isolate and isolate pieces into the dynamic library as additional read-only sections.
Automatically detect if the script argument is an app snapshot and initialize the VM appropriately, similar to automatic detection of script snapshots.
R=asiva@google.com
Review URL: https://codereview.chromium.org/2405393002 .
Also some style cleanups.
Decided to fix these leaks by using Dart_ScopeAllocate
instead of malloc and new. Leaks are noted in the CL.
I haven't finished looking over all the code in
//runtime/bin yet, but this CL was getting big.
Review URL: https://codereview.chromium.org/1781883002 .
Added two new file modes WRITE_ONLY and WRITE_ONLY_APPEND. The current
file modes WRITE and WRITE_APPEND are kept as the read/write mode with
no change. Kept the same overall handling of create/truncate/append
semantics for the new file modes.
R=ager@google.com, ahe@google.com
BUG=
Review URL: https://codereview.chromium.org//1193653002.