[vm] Run clang-format on code base

When uploading CLs, the presubmit checks verify that the lines in the
diff are formatted correctly according to `git cl format runtime`.

However, when `buildtools/<os>-<arch>/clang/bin/clang-format` is
updated, it does not force reformatting of files that would be
reformatted.

This leads to two issues:
* Inconsistent style within the code base and within a single file.
* Spurious reformatting in CLs when (1) clang-format is used on the
  whole file, or (2) the diff lines overlap.

`clang-format` doesn't change that frequently, so in general this is
not a large issue, but I've seen a bit too many "spurious formatting,
please revert" comments on CLs recently.

This CL formats the runtime to be in line with the current pinned
`clang-format`:

```
$ find runtime/ -iname *.h -o -iname *.cc | xargs buildtools/mac-arm64/clang/bin/clang-format -i
```

`git cl format` (which only formats changed lines, and does so with
`clang-format`) seems to not agree with itself, or clang-format, or
cpplint in a handful of places. This CL adds `// clang-format off`
for these. (See previous patchsets for the specific instances.)

TEST=A variety of bots including GCC, MacOS and Windows.

Change-Id: I470892e898971899fda14bb3b8f2c8efefd67686
Cq-Include-Trybots: luci.dart.try:vm-gcc-linux-try,vm-ffi-qemu-linux-release-riscv64-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-win-debug-x64-try,vm-win-debug-x64c-try,vm-mac-debug-x64-try,vm-mac-debug-arm64-try,vm-aot-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
Daco Harkes
2024-04-17 19:14:41 +00:00
committed by Commit Queue
parent 2d49ca0204
commit f98a2138b7
135 changed files with 664 additions and 760 deletions
+2 -4
View File
@@ -18,11 +18,9 @@
namespace dart {
namespace bin {
void Console::SaveConfig() {
}
void Console::SaveConfig() {}
void Console::RestoreConfig() {
}
void Console::RestoreConfig() {}
} // namespace bin
} // namespace dart
+1 -1
View File
@@ -11,7 +11,7 @@
#include "bin/platform.h"
#include "bin/process.h"
#if !defined(DART_IO_SECURE_SOCKET_DISABLED)
#include "bin/secure_socket_filter.h"
#include "bin/secure_socket_filter.h"
#endif
#include "bin/thread.h"
#include "bin/utils.h"
+4 -6
View File
@@ -311,11 +311,10 @@ class KernelIRNode {
KernelIRNode(uint8_t* kernel_ir, intptr_t kernel_size)
: kernel_ir_(kernel_ir), kernel_size_(kernel_size) {}
~KernelIRNode() {
free(kernel_ir_);
}
~KernelIRNode() { free(kernel_ir_); }
static void Add(KernelIRNode** p_head, KernelIRNode** p_tail,
static void Add(KernelIRNode** p_head,
KernelIRNode** p_tail,
KernelIRNode* node) {
if (*p_head == nullptr) {
*p_head = node;
@@ -325,8 +324,7 @@ class KernelIRNode {
*p_tail = node;
}
static void Merge(KernelIRNode* head, uint8_t** p_bytes,
intptr_t* p_size) {
static void Merge(KernelIRNode* head, uint8_t** p_bytes, intptr_t* p_size) {
intptr_t size = 0;
for (KernelIRNode* node = head; node != nullptr; node = node->next_) {
size = size + node->kernel_size_;
+8 -8
View File
@@ -7,15 +7,15 @@
#include "bin/directory.h"
#include <dirent.h> // NOLINT
#include <errno.h> // NOLINT
#include <fcntl.h> // NOLINT
#include <dirent.h> // NOLINT
#include <errno.h> // NOLINT
#include <fcntl.h> // NOLINT
#include <lib/fdio/namespace.h> // NOLINT
#include <stdlib.h> // NOLINT
#include <string.h> // NOLINT
#include <sys/param.h> // NOLINT
#include <sys/stat.h> // NOLINT
#include <unistd.h> // NOLINT
#include <stdlib.h> // NOLINT
#include <string.h> // NOLINT
#include <sys/param.h> // NOLINT
#include <sys/stat.h> // NOLINT
#include <unistd.h> // NOLINT
#include "bin/crypto.h"
#include "bin/dartutils.h"
+1 -1
View File
@@ -589,7 +589,7 @@ void EventHandlerImplementation::HandlePacket(zx_port_packet_t* pkt) {
// Handle pkt->type == ZX_PKT_TYPE_SIGNAL_ONE
LOG_INFO("HandlePacket: Got event packet: observed = %x\n",
pkt->signal.observed);
pkt->signal.observed);
LOG_INFO("HandlePacket: Got event packet: count = %ld\n", pkt->signal.count);
DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(pkt->key);
zx_signals_t observed = pkt->signal.observed;
+1 -2
View File
@@ -130,8 +130,7 @@ Handle::Handle(intptr_t handle)
read_thread_finished_(false),
flags_(0) {}
Handle::~Handle() {
}
Handle::~Handle() {}
bool Handle::CreateCompletionPort(HANDLE completion_port) {
ASSERT(completion_port_ == INVALID_HANDLE_VALUE);
+1 -3
View File
@@ -78,9 +78,7 @@ class OverlappedBuffer {
SOCKET client() const { return client_; }
char* GetBufferStart() { return reinterpret_cast<char*>(&buffer_data_); }
int GetBufferSize() const { return buflen_; }
struct sockaddr* from() const {
return from_;
}
struct sockaddr* from() const { return from_; }
socklen_t* from_len_addr() const { return from_len_addr_; }
socklen_t from_len() const { return from_ == nullptr ? 0 : *from_len_addr_; }
+7 -7
View File
@@ -732,9 +732,9 @@ DART_EXPORT int64_t SumStruct9Uint8(Struct9Uint8 s9) {
return s9.a0 + s9.a1 + s9.a2 + s9.a3 + s9.a4 + s9.a5 + s9.a6 + s9.a7 + s9.a8;
}
DART_EXPORT int64_t SumReturnStruct9Uint8(
Struct9Uint8 (*callback)(Struct9Uint8*),
Struct9Uint8* in) {
DART_EXPORT int64_t
SumReturnStruct9Uint8(Struct9Uint8 (*callback)(Struct9Uint8*),
Struct9Uint8* in) {
std::cout << "SumReturnStruct9Uint8 in (" << in->a0 << ", " << in->a1 << ", "
<< in->a2 << ", " << in->a3 << ", " << in->a4 << ", " << in->a5
<< ", " << in->a6 << ", " << in->a7 << ", " << in->a8 << ")\n";
@@ -906,8 +906,8 @@ DART_EXPORT intptr_t TestSimpleAddition(intptr_t (*add)(int, int)) {
//// Following tests are copied from above, with the role of Dart and C++ code
//// reversed.
DART_EXPORT intptr_t TestIntComputation(
int64_t (*fn)(int8_t, int16_t, int32_t, int64_t)) {
DART_EXPORT intptr_t
TestIntComputation(int64_t (*fn)(int8_t, int16_t, int32_t, int64_t)) {
const int64_t result = fn(125, 250, 500, 1000);
std::cout << "result " << result << "\n";
CHECK_EQ(result, 625);
@@ -916,8 +916,8 @@ DART_EXPORT intptr_t TestIntComputation(
return 0;
}
DART_EXPORT intptr_t TestUintComputation(
uint64_t (*fn)(uint8_t, uint16_t, uint32_t, uint64_t)) {
DART_EXPORT intptr_t
TestUintComputation(uint64_t (*fn)(uint8_t, uint16_t, uint32_t, uint64_t)) {
CHECK_EQ(0x7FFFFFFFFFFFFFFFLL, fn(0, 0, 0, 0x7FFFFFFFFFFFFFFFLL));
CHECK_EQ(0x8000000000000000LL, fn(0, 0, 0, 0x8000000000000000LL));
CHECK_EQ(-1, (int64_t)fn(0, 0, 0, -1));
@@ -1316,8 +1316,7 @@ DART_EXPORT void Regress216834909_SetAtExit(int64_t install) {
Regress216834909_hang_at_exit = false;
}
}
#endif // defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID) ||
// defined(DART_HOST_OS_MACOS)
#endif
DART_EXPORT bool IsNull(Dart_Handle object) {
return Dart_IsNull(object);
+17 -19
View File
@@ -7,16 +7,16 @@
#include "bin/file.h"
#include <errno.h> // NOLINT
#include <fcntl.h> // NOLINT
#include <lib/fdio/fdio.h> // NOLINT
#include <errno.h> // NOLINT
#include <fcntl.h> // NOLINT
#include <lib/fdio/fdio.h> // NOLINT
#include <lib/fdio/namespace.h> // NOLINT
#include <libgen.h> // NOLINT
#include <sys/mman.h> // NOLINT
#include <sys/stat.h> // NOLINT
#include <sys/types.h> // NOLINT
#include <unistd.h> // NOLINT
#include <utime.h> // NOLINT
#include <libgen.h> // NOLINT
#include <sys/mman.h> // NOLINT
#include <sys/stat.h> // NOLINT
#include <sys/types.h> // NOLINT
#include <unistd.h> // NOLINT
#include <utime.h> // NOLINT
#include "bin/builtin.h"
#include "bin/fdutils.h"
@@ -254,8 +254,8 @@ File* File::Open(Namespace* namespc, const char* name, FileOpenMode mode) {
}
Utils::CStringUniquePtr File::UriToPath(const char* uri) {
const char* path = (strlen(uri) >= 8 && strncmp(uri, "file:///", 8) == 0)
? uri + 7 : uri;
const char* path =
(strlen(uri) >= 8 && strncmp(uri, "file:///", 8) == 0) ? uri + 7 : uri;
UriDecoder uri_decoder(path);
if (uri_decoder.decoded() == nullptr) {
errno = EINVAL;
@@ -456,15 +456,15 @@ bool File::Copy(Namespace* namespc,
if (NO_RETRY_EXPECTED(fstatat(oldns.fd(), oldns.path(), &st, 0)) != 0) {
return false;
}
const int old_fd = NO_RETRY_EXPECTED(
openat(oldns.fd(), oldns.path(), O_RDONLY | O_CLOEXEC));
const int old_fd =
NO_RETRY_EXPECTED(openat(oldns.fd(), oldns.path(), O_RDONLY | O_CLOEXEC));
if (old_fd < 0) {
return false;
}
NamespaceScope newns(namespc, new_path);
const int new_fd = NO_RETRY_EXPECTED(
openat(newns.fd(), newns.path(),
O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, st.st_mode));
openat(newns.fd(), newns.path(), O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC,
st.st_mode));
if (new_fd < 0) {
close(old_fd);
return false;
@@ -492,9 +492,7 @@ bool File::Copy(Namespace* namespc,
return true;
}
static bool StatHelper(Namespace* namespc,
const char* name,
struct stat* st) {
static bool StatHelper(Namespace* namespc, const char* name, struct stat* st) {
NamespaceScope ns(namespc, name);
if (NO_RETRY_EXPECTED(fstatat(ns.fd(), ns.path(), st, 0)) != 0) {
return false;
@@ -683,7 +681,7 @@ const char* File::StringEscapedPathSeparator() {
}
static int fd_is_valid(int fd) {
return NO_RETRY_EXPECTED(fcntl(fd, F_GETFD)) != -1 || errno != EBADF;
return NO_RETRY_EXPECTED(fcntl(fd, F_GETFD)) != -1 || errno != EBADF;
}
File::StdioHandleType File::GetStdioHandleType(int fd) {
+2 -2
View File
@@ -266,8 +266,8 @@ File* File::Open(Namespace* namespc, const char* name, FileOpenMode mode) {
}
Utils::CStringUniquePtr File::UriToPath(const char* uri) {
const char* path = (strlen(uri) >= 8 && strncmp(uri, "file:///", 8) == 0)
? uri + 7 : uri;
const char* path =
(strlen(uri) >= 8 && strncmp(uri, "file:///", 8) == 0) ? uri + 7 : uri;
UriDecoder uri_decoder(path);
if (uri_decoder.decoded() == nullptr) {
errno = EINVAL;
+3 -3
View File
@@ -297,8 +297,8 @@ File* File::Open(Namespace* namespc, const char* name, FileOpenMode mode) {
}
Utils::CStringUniquePtr File::UriToPath(const char* uri) {
const char* path = (strlen(uri) >= 8 && strncmp(uri, "file:///", 8) == 0)
? uri + 7 : uri;
const char* path =
(strlen(uri) >= 8 && strncmp(uri, "file:///", 8) == 0) ? uri + 7 : uri;
UriDecoder uri_decoder(path);
if (uri_decoder.decoded() == nullptr) {
errno = EINVAL;
@@ -610,7 +610,7 @@ const char* File::LinkTarget(Namespace* namespc,
dest = DartUtils::ScopedCString(target_size + 1);
} else {
ASSERT(dest_size > 0);
if ((size_t)dest_size <= target_size) {
if (static_cast<size_t>(dest_size) <= target_size) {
return nullptr;
}
}
+2 -4
View File
@@ -26,15 +26,13 @@ bool FileSystemWatcher::IsSupported() {
return false;
}
void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) {
}
void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) {}
intptr_t FileSystemWatcher::Init() {
return 0;
}
void FileSystemWatcher::Close(intptr_t id) {
}
void FileSystemWatcher::Close(intptr_t id) {}
intptr_t FileSystemWatcher::WatchPath(intptr_t id,
Namespace* namespc,
+12 -12
View File
@@ -27,8 +27,8 @@ TEST_CASE(Read) {
TEST_CASE(OpenUri_RelativeFilename) {
const char* kFilename = bin::test::GetFileName("runtime/bin/file_test.cc");
char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
strlen(kFilename) * 3 + 1));
char* encoded = reinterpret_cast<char*>(
bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all characters 'c'
for (const char* p = kFilename; *p != '\0'; p++) {
@@ -58,8 +58,8 @@ TEST_CASE(OpenUri_AbsoluteFilename) {
const char* kFilename =
bin::File::GetCanonicalPath(nullptr, kRelativeFilename);
EXPECT_NOTNULL(kFilename);
char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
strlen(kFilename) * 3 + 1));
char* encoded = reinterpret_cast<char*>(
bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all characters 'c'
for (const char* p = kFilename; *p != '\0'; p++) {
@@ -99,8 +99,8 @@ TEST_CASE(OpenUri_ValidUri) {
EXPECT_NOTNULL(kAbsoluteFilename);
const char* kFilename = Concat("file:///", kAbsoluteFilename);
char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
strlen(kFilename) * 3 + 1));
char* encoded = reinterpret_cast<char*>(
bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all characters 'c'
for (const char* p = kFilename; *p != '\0'; p++) {
@@ -141,8 +141,8 @@ TEST_CASE(OpenUri_UriWithSpaces) {
EXPECT_NOTNULL(kAbsoluteFilename);
const char* kFilename = Concat("file:///", kAbsoluteFilename);
char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
strlen(kFilename) * 3 + 1));
char* encoded = reinterpret_cast<char*>(
bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all spaces
for (const char* p = kFilename; *p != '\0'; p++) {
@@ -170,8 +170,8 @@ TEST_CASE(OpenUri_UriWithSpaces) {
TEST_CASE(OpenUri_InvalidUriPercentEncoding) {
const char* kFilename = bin::test::GetFileName("runtime/bin/file_test.cc");
char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
strlen(kFilename) * 3 + 1));
char* encoded = reinterpret_cast<char*>(
bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all characters 'c'
for (const char* p = kFilename; *p != '\0'; p++) {
@@ -190,8 +190,8 @@ TEST_CASE(OpenUri_InvalidUriPercentEncoding) {
TEST_CASE(OpenUri_TruncatedUriPercentEncoding) {
const char* kFilename = bin::test::GetFileName("runtime/bin/file_test.cc");
char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
strlen(kFilename) * 3 + 1));
char* encoded = reinterpret_cast<char*>(
bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all characters 'c'
for (const char* p = kFilename; *p != '\0'; p++) {
+12 -10
View File
@@ -9,16 +9,18 @@
#include <memory>
#include <utility>
#include <Shlwapi.h> // NOLINT
#include <fcntl.h> // NOLINT
#include <io.h> // NOLINT
#include <pathcch.h> // NOLINT
#include <winioctl.h> // NOLINT
#undef StrDup // defined in Shlwapi.h as StrDupW
#include <stdio.h> // NOLINT
#include <string.h> // NOLINT
#include <sys/stat.h> // NOLINT
// clang-format off
#include <Shlwapi.h> // NOLINT
#include <fcntl.h> // NOLINT
#include <io.h> // NOLINT
#include <pathcch.h> // NOLINT
#include <winioctl.h> // NOLINT
#undef StrDup // defined in Shlwapi.h as StrDupW
#include <stdio.h> // NOLINT
#include <string.h> // NOLINT
#include <sys/stat.h> // NOLINT
#include <sys/utime.h> // NOLINT
// clang-format on
#include "bin/builtin.h"
#include "bin/crypto.h"
@@ -744,7 +746,7 @@ static void FreeUUID(wchar_t* ptr) {
RpcStringFreeW(&ptr);
}
static std::unique_ptr<wchar_t, decltype(FreeUUID) *> GenerateUUIDString() {
static std::unique_ptr<wchar_t, decltype(FreeUUID)*> GenerateUUIDString() {
UUID uuid;
RPC_STATUS status = UuidCreateSequential(&uuid);
if ((status != RPC_S_OK) && (status != RPC_S_UUID_LOCAL_ONLY)) {
+6 -4
View File
@@ -344,8 +344,9 @@ intptr_t ZLibDeflateFilter::Processed(uint8_t* buffer,
stream_.avail_out = length;
stream_.next_out = buffer;
bool error = false;
switch (
deflate(&stream_, end ? Z_FINISH : flush ? Z_SYNC_FLUSH : Z_NO_FLUSH)) {
switch (deflate(&stream_, end ? Z_FINISH
: flush ? Z_SYNC_FLUSH
: Z_NO_FLUSH)) {
case Z_STREAM_END:
case Z_BUF_ERROR:
case Z_OK: {
@@ -409,8 +410,9 @@ intptr_t ZLibInflateFilter::Processed(uint8_t* buffer,
stream_.next_out = buffer;
bool error = false;
int v;
switch (v = inflate(&stream_,
end ? Z_FINISH : flush ? Z_SYNC_FLUSH : Z_NO_FLUSH)) {
switch (v = inflate(&stream_, end ? Z_FINISH
: flush ? Z_SYNC_FLUSH
: Z_NO_FLUSH)) {
case Z_STREAM_END:
case Z_BUF_ERROR:
case Z_OK: {
+1 -2
View File
@@ -166,8 +166,7 @@ Dart_Handle Loader::DeferredLoadHandler(intptr_t loading_unit_id) {
return result;
}
void Loader::InitOnce() {
}
void Loader::InitOnce() {}
} // namespace bin
} // namespace dart
+1 -2
View File
@@ -21,8 +21,7 @@ namespace dart {
namespace bin {
NamespaceImpl::NamespaceImpl(fdio_ns_t* fdio_ns)
: fdio_ns_(fdio_ns),
cwd_(strdup("/")) {
: fdio_ns_(fdio_ns), cwd_(strdup("/")) {
rootfd_ = fdio_ns_opendir(fdio_ns);
if (rootfd_ < 0) {
FATAL("Failed to open file descriptor for namespace: errno=%d: %s", errno,
+1 -1
View File
@@ -12,7 +12,7 @@
#if !DART_HOST_OS_IOS
#include <crt_externs.h>
#endif // !DART_HOST_OS_IOS
#endif // !DART_HOST_OS_IOS
#include <dlfcn.h>
#include <errno.h>
#include <mach-o/dyld.h>
-1
View File
@@ -20,7 +20,6 @@
#include "bin/utils.h"
#include "bin/utils_win.h"
namespace dart {
namespace bin {
+10 -5
View File
@@ -624,14 +624,14 @@ class ProcessStarter {
}
fdio_spawn_action_t* actions;
const intptr_t actions_count = BuildSpawnActions(
namespc_->namespc()->fdio_ns(), &actions);
const intptr_t actions_count =
BuildSpawnActions(namespc_->namespc()->fdio_ns(), &actions);
if (actions_count < 0) {
zx_handle_close(vmo);
close(exit_pipe_fds[0]);
close(exit_pipe_fds[1]);
*os_error_message_ = DartUtils::ScopedCopyCString(
"Failed to build spawn actions array.");
*os_error_message_ =
DartUtils::ScopedCopyCString("Failed to build spawn actions array.");
return ZX_ERR_IO;
}
@@ -703,7 +703,8 @@ class ProcessStarter {
*os_error_message_ = message;
}
zx_status_t AddPipe(int target_fd, int* local_fd,
zx_status_t AddPipe(int target_fd,
int* local_fd,
fdio_spawn_action_t* action) {
zx_status_t status = fdio_pipe_half(local_fd, &action->h.handle);
if (status != ZX_OK) return status;
@@ -763,16 +764,19 @@ class ProcessStarter {
}
return -1;
}
// clang-format off
actions[3] = {
.action = FDIO_SPAWN_ACTION_SET_NAME,
.name = {
.data = program_arguments_[0],
},
};
// clang-format on
// Then fill in the namespace actions.
if (ns != nullptr) {
for (size_t i = 0; i < flat_ns->count; i++) {
// clang-format off
actions[fixed_actions_cnt + i] = {
.action = FDIO_SPAWN_ACTION_ADD_NS_ENTRY,
.ns = {
@@ -780,6 +784,7 @@ class ProcessStarter {
.handle = flat_ns->handle[i],
},
};
// clang-format on
flat_ns->handle[i] = ZX_HANDLE_INVALID;
}
fdio_ns_free_flat_ns(flat_ns);
+4 -4
View File
@@ -429,8 +429,8 @@ void FUNCTION_NAME(Socket_CreateUnixDomainBindConnect)(
RawAddr addr;
Dart_Handle address = Dart_GetNativeArgument(args, 1);
if (Dart_IsNull(address)) {
Dart_SetReturnValue(args,
DartUtils::NewDartArgumentError("expect address to be of type String"));
Dart_SetReturnValue(args, DartUtils::NewDartArgumentError(
"expect address to be of type String"));
}
Dart_Handle result = SocketAddress::GetUnixDomainSockAddr(
DartUtils::GetStringValue(address), Namespace::GetNamespace(args, 3),
@@ -1025,8 +1025,8 @@ void FUNCTION_NAME(ServerSocket_CreateUnixDomainBindListen)(
#else
Dart_Handle address = Dart_GetNativeArgument(args, 1);
if (Dart_IsNull(address)) {
Dart_SetReturnValue(args,
DartUtils::NewDartArgumentError("expect address to be of type String"));
Dart_SetReturnValue(args, DartUtils::NewDartArgumentError(
"expect address to be of type String"));
}
const char* path = DartUtils::GetStringValue(address);
int64_t backlog = DartUtils::GetInt64ValueCheckRange(
+1 -3
View File
@@ -170,9 +170,7 @@ class ListeningSocketRegistry {
unix_domain_sockets_(nullptr),
mutex_() {}
~ListeningSocketRegistry() {
CloseAllSafe();
}
~ListeningSocketRegistry() { CloseAllSafe(); }
static void Initialize();
-1
View File
@@ -66,7 +66,6 @@ SocketAddress::SocketAddress(struct sockaddr* sa, bool unnamed_unix_socket) {
memmove(reinterpret_cast<void*>(&addr_), sa, salen);
}
bool SocketBase::Initialize() {
// Nothing to do on Fuchsia.
return true;
-1
View File
@@ -129,7 +129,6 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr,
return -1;
}
if (reuseAddress) {
int optval = 1;
VOID_NO_RETRY_EXPECTED(
+2 -2
View File
@@ -10,8 +10,8 @@
#include <mach/mach.h> // NOLINT
#include <mach/mach_time.h> // NOLINT
#include <netdb.h> // NOLINT
#include <sys/time.h> // NOLINT
#include <time.h> // NOLINT
#include <sys/time.h> // NOLINT
#include <time.h> // NOLINT
#include "bin/utils.h"
#include "platform/assert.h"
+1 -1
View File
@@ -5,7 +5,7 @@
#ifndef RUNTIME_INCLUDE_BIN_DART_IO_API_H_
#define RUNTIME_INCLUDE_BIN_DART_IO_API_H_
#include "dart_tools_api.h"
#include "../dart_tools_api.h"
namespace dart {
namespace bin {
+1 -3
View File
@@ -556,7 +556,6 @@ Dart_NewFinalizableHandle(Dart_Handle object,
DART_EXPORT void Dart_DeleteFinalizableHandle(Dart_FinalizableHandle object,
Dart_Handle strong_ref_to_object);
/*
* ==========================
* Initialization and Globals
@@ -1278,8 +1277,7 @@ DART_EXPORT void Dart_KillIsolate(Dart_Isolate isolate);
*/
DART_EXPORT void Dart_NotifyIdle(int64_t deadline);
typedef void (*Dart_HeapSamplingReportCallback)(void* context,
void* data);
typedef void (*Dart_HeapSamplingReportCallback)(void* context, void* data);
typedef void* (*Dart_HeapSamplingCreateCallback)(
Dart_Isolate isolate,
+1 -4
View File
@@ -59,10 +59,7 @@ CreateKernelServiceIsolate(const IsolateCreationData& data,
// Service isolate configuration.
struct VmServiceConfiguration {
enum {
kBindHttpServerToAFreePort = 0,
kDoNotAutoStartHttpServer = -1
};
enum { kBindHttpServerToAFreePort = 0, kDoNotAutoStartHttpServer = -1 };
// Address to which HTTP server will be bound.
const char* ip;
+3 -3
View File
@@ -127,13 +127,13 @@ DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
* The pointers in this structure are not going to be cached or freed by the VM.
*/
#define DART_EMBEDDER_INFORMATION_CURRENT_VERSION (0x00000001)
#define DART_EMBEDDER_INFORMATION_CURRENT_VERSION (0x00000001)
typedef struct {
int32_t version;
const char* name; // [optional] The name of the embedder
const char* name; // [optional] The name of the embedder
int64_t current_rss; // [optional] the current RSS of the embedder
int64_t max_rss; // [optional] the maximum RSS of the embedder
int64_t max_rss; // [optional] the maximum RSS of the embedder
} Dart_EmbedderInformation;
/**
+2 -6
View File
@@ -44,13 +44,9 @@ class MallocAllocated {
// of memory. Don't do this when running under ASAN so it can continue to
// check malloc/new/new[] are paired with free/delete/delete[] respectively.
#if !defined(USING_ADDRESS_SANITIZER)
void* operator new(size_t size) {
return dart::malloc(size);
}
void* operator new(size_t size) { return dart::malloc(size); }
void* operator new[](size_t size) {
return dart::malloc(size);
}
void* operator new[](size_t size) { return dart::malloc(size); }
void operator delete(void* pointer) { ::free(pointer); }
+3 -3
View File
@@ -33,9 +33,9 @@ double atan2_ieee(double x, double y) {
int cls_y = _fpclass(y);
if (((cls_x & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0) &&
((cls_y & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0)) {
// atan2 values at infinities listed above are the same as values
// at (+/-1, +/-1). index_x is 0, when x is +infinity, 1 when x is -infinity.
// Same is with index_y.
// atan2 values at infinities listed above are the same as values at (+/-1,
// +/-1). index_x is 0, when x is +infinity, 1 when x is -infinity. Same is
// with index_y.
int index_x = (cls_x & _FPCLASS_PINF) != 0 ? 0 : 1;
int index_y = (cls_y & _FPCLASS_PINF) != 0 ? 0 : 1;
static double atans_at_infinities[2][2] = {
+2 -1
View File
@@ -24,7 +24,8 @@
#endif
#if defined(USING_SHADOW_CALL_STACK)
#define NO_SANITIZE_SHADOW_CALL_STACK __attribute__((no_sanitize("shadow-call-stack")))
#define NO_SANITIZE_SHADOW_CALL_STACK \
__attribute__((no_sanitize("shadow-call-stack")))
#else
#define NO_SANITIZE_SHADOW_CALL_STACK
#endif
+2 -2
View File
@@ -99,8 +99,8 @@ struct CodeRangeUnwindingRecord {
#pragma pack(pop)
#elif (defined(DART_TARGET_OS_WINDOWS) || defined(DART_HOST_OS_WINDOWS)) && \
defined(TARGET_ARCH_ARM64)
#elif defined(TARGET_ARCH_ARM64) && \
(defined(DART_TARGET_OS_WINDOWS) || defined(DART_HOST_OS_WINDOWS))
#pragma pack(push, 1)
+1 -1
View File
@@ -5,8 +5,8 @@
#include "vm/bitmap.h"
#include "platform/assert.h"
#include "vm/object.h"
#include "vm/log.h"
#include "vm/object.h"
namespace dart {
+4 -12
View File
@@ -444,16 +444,10 @@ class ClassTable : public MallocAllocated {
}
#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
intptr_t NumCids() const {
return classes_.num_cids();
}
intptr_t Capacity() const {
return classes_.capacity();
}
intptr_t NumCids() const { return classes_.num_cids(); }
intptr_t Capacity() const { return classes_.capacity(); }
intptr_t NumTopLevelCids() const {
return top_level_classes_.num_cids();
}
intptr_t NumTopLevelCids() const { return top_level_classes_.num_cids(); }
void Register(const Class& cls);
void AllocateIndex(intptr_t index);
@@ -546,9 +540,7 @@ class ClassTable : public MallocAllocated {
void AllocateTopLevelIndex(intptr_t index);
ClassPtr* table() {
return classes_.GetColumn<kClassIndex>();
}
ClassPtr* table() { return classes_.GetColumn<kClassIndex>(); }
// Used to drop recently added classes.
void SetNumCids(intptr_t num_cids, intptr_t num_tlc_cids) {
+6 -6
View File
@@ -63,12 +63,12 @@ void AsmIntrinsifier::Integer_shl(Assembler* assembler, Label* normal_ir_body) {
// high bits = (((1 << R0) - 1) << (32 - R0)) & R1) >> (32 - R0)
// lo bits = R1 << R0
__ LoadImmediate(R8, 1);
__ mov(R8, Operand(R8, LSL, R0)); // R8 <- 1 << R0
__ sub(R8, R8, Operand(1)); // R8 <- R8 - 1
__ rsb(R3, R0, Operand(32)); // R3 <- 32 - R0
__ mov(R8, Operand(R8, LSL, R3)); // R8 <- R8 << R3
__ and_(R8, R1, Operand(R8)); // R8 <- R8 & R1
__ mov(R8, Operand(R8, LSR, R3)); // R8 <- R8 >> R3
__ mov(R8, Operand(R8, LSL, R0)); // R8 <- 1 << R0
__ sub(R8, R8, Operand(1)); // R8 <- R8 - 1
__ rsb(R3, R0, Operand(32)); // R3 <- 32 - R0
__ mov(R8, Operand(R8, LSL, R3)); // R8 <- R8 << R3
__ and_(R8, R1, Operand(R8)); // R8 <- R8 & R1
__ mov(R8, Operand(R8, LSR, R3)); // R8 <- R8 >> R3
// Now R8 has the bits that fall off of R1 on a left shift.
__ mov(R1, Operand(R1, LSL, R0)); // R1 gets the low bits.
+1 -3
View File
@@ -8,6 +8,4 @@
#include "vm/symbols.h"
#include "vm/unit_test.h"
namespace dart {
} // namespace dart
namespace dart {} // namespace dart
+1 -1
View File
@@ -1628,7 +1628,7 @@ static void TryAllocateString(Assembler* assembler,
__ movq(RDI, length_reg);
}
Label pop_and_fail, not_zero_length;
__ pushq(RDI); // Preserve length.
__ pushq(RDI); // Preserve length.
if (cid == kOneByteStringCid) {
// Untag length.
__ SmiUntag(RDI);
@@ -893,9 +893,7 @@ class Assembler : public AssemblerBase {
ASSERT((shift >= 0) && (shift < kBitsPerInt32));
Lsl(rd, rn, Operand(shift));
}
void LslImmediate(Register rd, int32_t shift) {
LslImmediate(rd, rd, shift);
}
void LslImmediate(Register rd, int32_t shift) { LslImmediate(rd, rd, shift); }
void LslRegister(Register dst, Register shift) override {
Lsl(dst, dst, shift);
}
@@ -1528,9 +1528,7 @@ class Assembler : public AssemblerBase {
}
}
void vmov(VRegister vd, VRegister vn) { vorr(vd, vn, vn); }
void mvn_(Register rd, Register rm) {
orn(rd, ZR, Operand(rm));
}
void mvn_(Register rd, Register rm) { orn(rd, ZR, Operand(rm)); }
void mvnw(Register rd, Register rm) { ornw(rd, ZR, Operand(rm)); }
void neg(Register rd, Register rm) { sub(rd, ZR, Operand(rm)); }
void negs(Register rd, Register rm, OperandSize sz = kEightBytes) {
@@ -1755,9 +1753,7 @@ class Assembler : public AssemblerBase {
void Call(const Code& code) { BranchLink(code); }
// Clobbers LR.
void CallCFunction(Address target) {
Call(target);
}
void CallCFunction(Address target) { Call(target); }
void CallCFunction(Register target) {
#define __ this->
CLOBBERS_LR({ blr(target); });
@@ -1838,9 +1834,7 @@ class Assembler : public AssemblerBase {
Register rn,
int64_t imm,
OperandSize sz = kEightBytes);
void OrImmediate(Register rd, int64_t imm) {
OrImmediate(rd, rd, imm);
}
void OrImmediate(Register rd, int64_t imm) { OrImmediate(rd, rd, imm); }
void XorImmediate(Register rd,
Register rn,
int64_t imm,
@@ -2023,9 +2017,7 @@ class Assembler : public AssemblerBase {
LoadImmediate(TMP, immediate);
Push(TMP);
}
void PushImmediate(Immediate immediate) {
PushImmediate(immediate.value());
}
void PushImmediate(Immediate immediate) { PushImmediate(immediate.value()); }
void CompareObject(Register reg, const Object& object);
void ExtractClassIdFromTags(Register result, Register tags);
@@ -143,7 +143,10 @@ ASSEMBLER_TEST_RUN(LoadHalfWordUnaligned, test) {
EXPECT(test != nullptr);
typedef intptr_t (*LoadHalfWordUnaligned)(intptr_t) DART_UNUSED;
uint8_t buffer[4] = {
0x89, 0xAB, 0xCD, 0xEF,
0x89,
0xAB,
0xCD,
0xEF,
};
EXPECT_EQ(
@@ -166,7 +169,10 @@ ASSEMBLER_TEST_RUN(LoadHalfWordUnsignedUnaligned, test) {
EXPECT(test != nullptr);
typedef intptr_t (*LoadHalfWordUnsignedUnaligned)(intptr_t) DART_UNUSED;
uint8_t buffer[4] = {
0x89, 0xAB, 0xCD, 0xEF,
0x89,
0xAB,
0xCD,
0xEF,
};
EXPECT_EQ(0xAB89, EXECUTE_TEST_CODE_INTPTR_INTPTR(
@@ -188,7 +194,10 @@ ASSEMBLER_TEST_RUN(StoreHalfWordUnaligned, test) {
EXPECT(test != nullptr);
typedef intptr_t (*StoreHalfWordUnaligned)(intptr_t) DART_UNUSED;
uint8_t buffer[4] = {
0, 0, 0, 0,
0,
0,
0,
0,
};
EXPECT_EQ(0x1111ABCD, EXECUTE_TEST_CODE_INTPTR_INTPTR(
@@ -343,25 +352,25 @@ ASSEMBLER_TEST_RUN(SingleVShiftLoadStore, test) {
}
ASSEMBLER_TEST_GENERATE(DoubleVLoadStore, assembler) {
int64_t value = bit_cast<int64_t, double>(12.3);
__ LoadImmediate(R0, Utils::Low32Bits(value));
__ LoadImmediate(R1, Utils::High32Bits(value));
__ mov(R2, Operand(SP));
__ str(R0, Address(SP, (-target::kWordSize * 30), Address::PreIndex));
__ str(R1, Address(R2, (-target::kWordSize * 29)));
__ vldrd(D0, Address(R2, (-target::kWordSize * 30)));
__ vaddd(D0, D0, D0);
__ vstrd(D0, Address(R2, (-target::kWordSize * 30)));
__ ldr(R1, Address(R2, (-target::kWordSize * 29)));
__ ldr(R0, Address(SP, (target::kWordSize * 30), Address::PostIndex));
__ Ret();
int64_t value = bit_cast<int64_t, double>(12.3);
__ LoadImmediate(R0, Utils::Low32Bits(value));
__ LoadImmediate(R1, Utils::High32Bits(value));
__ mov(R2, Operand(SP));
__ str(R0, Address(SP, (-target::kWordSize * 30), Address::PreIndex));
__ str(R1, Address(R2, (-target::kWordSize * 29)));
__ vldrd(D0, Address(R2, (-target::kWordSize * 30)));
__ vaddd(D0, D0, D0);
__ vstrd(D0, Address(R2, (-target::kWordSize * 30)));
__ ldr(R1, Address(R2, (-target::kWordSize * 29)));
__ ldr(R0, Address(SP, (target::kWordSize * 30), Address::PostIndex));
__ Ret();
}
ASSEMBLER_TEST_RUN(DoubleVLoadStore, test) {
EXPECT(test != nullptr);
typedef double (*DoubleVLoadStore)() DART_UNUSED;
float res = EXECUTE_TEST_CODE_DOUBLE(DoubleVLoadStore, test->entry());
EXPECT_FLOAT_EQ(2 * 12.3f, res, 0.001f);
EXPECT(test != nullptr);
typedef double (*DoubleVLoadStore)() DART_UNUSED;
float res = EXECUTE_TEST_CODE_DOUBLE(DoubleVLoadStore, test->entry());
EXPECT_FLOAT_EQ(2 * 12.3f, res, 0.001f);
}
ASSEMBLER_TEST_GENERATE(SingleFPOperations, assembler) {
@@ -405,20 +414,20 @@ ASSEMBLER_TEST_RUN(DoubleFPOperations, test) {
}
ASSEMBLER_TEST_GENERATE(DoubleSqrtNeg, assembler) {
// Check that sqrt of a negative double gives NaN.
__ LoadDImmediate(D1, -1.0, R0);
__ vsqrtd(D0, D1);
__ vcmpd(D0, D0);
__ vmstat();
__ mov(R0, Operand(1), VS);
__ mov(R0, Operand(0), VC);
__ Ret();
// Check that sqrt of a negative double gives NaN.
__ LoadDImmediate(D1, -1.0, R0);
__ vsqrtd(D0, D1);
__ vcmpd(D0, D0);
__ vmstat();
__ mov(R0, Operand(1), VS);
__ mov(R0, Operand(0), VC);
__ Ret();
}
ASSEMBLER_TEST_RUN(DoubleSqrtNeg, test) {
EXPECT(test != nullptr);
typedef int (*DoubleSqrtNeg)() DART_UNUSED;
EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(DoubleSqrtNeg, test->entry()));
EXPECT(test != nullptr);
typedef int (*DoubleSqrtNeg)() DART_UNUSED;
EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(DoubleSqrtNeg, test->entry()));
}
ASSEMBLER_TEST_GENERATE(IntToDoubleConversion, assembler) {
@@ -534,67 +543,67 @@ ASSEMBLER_TEST_RUN(DoubleToFloatConversion, test) {
}
ASSEMBLER_TEST_GENERATE(FloatCompare, assembler) {
// Test 12.3f vs 12.5f.
__ LoadSImmediate(S0, 12.3f);
__ LoadSImmediate(S1, 12.5f);
// Test 12.3f vs 12.5f.
__ LoadSImmediate(S0, 12.3f);
__ LoadSImmediate(S1, 12.5f);
// Count errors in R0. R0 is zero if no errors found.
__ mov(R0, Operand(0));
__ vcmps(S0, S1);
__ vmstat();
__ add(R0, R0, Operand(1), VS); // Error if unordered (Nan).
__ add(R0, R0, Operand(2), GT); // Error if greater.
__ add(R0, R0, Operand(4), EQ); // Error if equal.
__ add(R0, R0, Operand(8), PL); // Error if not less.
// Count errors in R0. R0 is zero if no errors found.
__ mov(R0, Operand(0));
__ vcmps(S0, S1);
__ vmstat();
__ add(R0, R0, Operand(1), VS); // Error if unordered (Nan).
__ add(R0, R0, Operand(2), GT); // Error if greater.
__ add(R0, R0, Operand(4), EQ); // Error if equal.
__ add(R0, R0, Operand(8), PL); // Error if not less.
// Test NaN.
// Create NaN by dividing 0.0f/0.0f.
__ LoadSImmediate(S1, 0.0f);
__ vdivs(S1, S1, S1);
__ vcmps(S1, S1);
__ vmstat();
// Error if not unordered (not Nan).
__ add(R0, R0, Operand(16), VC);
// R0 is 0 if all tests passed.
__ Ret();
// Test NaN.
// Create NaN by dividing 0.0f/0.0f.
__ LoadSImmediate(S1, 0.0f);
__ vdivs(S1, S1, S1);
__ vcmps(S1, S1);
__ vmstat();
// Error if not unordered (not Nan).
__ add(R0, R0, Operand(16), VC);
// R0 is 0 if all tests passed.
__ Ret();
}
ASSEMBLER_TEST_RUN(FloatCompare, test) {
EXPECT(test != nullptr);
typedef int (*FloatCompare)() DART_UNUSED;
EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(FloatCompare, test->entry()));
EXPECT(test != nullptr);
typedef int (*FloatCompare)() DART_UNUSED;
EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(FloatCompare, test->entry()));
}
ASSEMBLER_TEST_GENERATE(DoubleCompare, assembler) {
// Test 12.3 vs 12.5.
__ LoadDImmediate(D0, 12.3, R1);
__ LoadDImmediate(D1, 12.5, R1);
// Test 12.3 vs 12.5.
__ LoadDImmediate(D0, 12.3, R1);
__ LoadDImmediate(D1, 12.5, R1);
// Count errors in R0. R0 is zero if no errors found.
__ mov(R0, Operand(0));
__ vcmpd(D0, D1);
__ vmstat();
__ add(R0, R0, Operand(1), VS); // Error if unordered (Nan).
__ add(R0, R0, Operand(2), GT); // Error if greater.
__ add(R0, R0, Operand(4), EQ); // Error if equal.
__ add(R0, R0, Operand(8), PL); // Error if not less.
// Count errors in R0. R0 is zero if no errors found.
__ mov(R0, Operand(0));
__ vcmpd(D0, D1);
__ vmstat();
__ add(R0, R0, Operand(1), VS); // Error if unordered (Nan).
__ add(R0, R0, Operand(2), GT); // Error if greater.
__ add(R0, R0, Operand(4), EQ); // Error if equal.
__ add(R0, R0, Operand(8), PL); // Error if not less.
// Test NaN.
// Create NaN by dividing 0.0/0.0.
__ LoadDImmediate(D1, 0.0, R1);
__ vdivd(D1, D1, D1);
__ vcmpd(D1, D1);
__ vmstat();
// Error if not unordered (not Nan).
__ add(R0, R0, Operand(16), VC);
// R0 is 0 if all tests passed.
__ Ret();
// Test NaN.
// Create NaN by dividing 0.0/0.0.
__ LoadDImmediate(D1, 0.0, R1);
__ vdivd(D1, D1, D1);
__ vcmpd(D1, D1);
__ vmstat();
// Error if not unordered (not Nan).
__ add(R0, R0, Operand(16), VC);
// R0 is 0 if all tests passed.
__ Ret();
}
ASSEMBLER_TEST_RUN(DoubleCompare, test) {
EXPECT(test != nullptr);
typedef int (*DoubleCompare)() DART_UNUSED;
EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(DoubleCompare, test->entry()));
EXPECT(test != nullptr);
typedef int (*DoubleCompare)() DART_UNUSED;
EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(DoubleCompare, test->entry()));
}
ASSEMBLER_TEST_GENERATE(Loop, assembler) {
@@ -1259,14 +1268,14 @@ ASSEMBLER_TEST_GENERATE(Ldm_stm_da, assembler) {
__ Push(R9);
__ Push(R0); // Make room, so we can decrement after.
__ stm(DA_W, SP, (1 << R0 | 1 << R1 | 1 << R2 | 1 << R3));
__ str(R2, Address(SP)); // Should be a free slot.
__ str(R2, Address(SP)); // Should be a free slot.
__ ldr(R9, Address(SP, 1 * target::kWordSize)); // R0. R9 = +1.
__ ldr(IP, Address(SP, 2 * target::kWordSize)); // R1.
__ sub(R9, R9, Operand(IP)); // -R1. R9 = -6.
__ sub(R9, R9, Operand(IP)); // -R1. R9 = -6.
__ ldr(IP, Address(SP, 3 * target::kWordSize)); // R2.
__ add(R9, R9, Operand(IP)); // +R2. R9 = +5.
__ add(R9, R9, Operand(IP)); // +R2. R9 = +5.
__ ldr(IP, Address(SP, 4 * target::kWordSize)); // R3.
__ sub(R9, R9, Operand(IP)); // -R3. R9 = -26.
__ sub(R9, R9, Operand(IP)); // -R3. R9 = -26.
__ ldm(IB_W, SP, (1 << R0 | 1 << R1 | 1 << R2 | 1 << R3));
// Same operations again. But this time from the restore registers.
__ add(R9, R9, Operand(R0));
@@ -1892,12 +1901,12 @@ ASSEMBLER_TEST_RUN(IntDiv_supported, test) {
ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) {
#if defined(USING_SIMULATOR)
bool orig = TargetCPUFeatures::integer_division_supported();
HostCPUFeatures::set_integer_division_supported(false);
__ mov(R0, Operand(27));
__ mov(R1, Operand(9));
__ IntegerDivide(R0, R0, R1, D0, D1);
HostCPUFeatures::set_integer_division_supported(orig);
bool orig = TargetCPUFeatures::integer_division_supported();
HostCPUFeatures::set_integer_division_supported(false);
__ mov(R0, Operand(27));
__ mov(R1, Operand(9));
__ IntegerDivide(R0, R0, R1, D0, D1);
HostCPUFeatures::set_integer_division_supported(orig);
__ Ret();
#else
__ mov(R0, Operand(27));
+6 -16
View File
@@ -469,7 +469,7 @@ class Assembler : public AssemblerBase {
void testb(const Address& address, const Immediate& imm);
void testb(const Address& address, ByteRegister reg);
// clang-format off
// clang-format off
// Macro for handling common ALU instructions. Arguments to F:
// name, opcode, reversed opcode, opcode for the reg field of the modrm byte.
#define ALU_OPS(F) \
@@ -585,9 +585,7 @@ class Assembler : public AssemblerBase {
// Sets the return address to [value] as if there was a call.
// On IA32 pushes [value].
void SetReturnAddress(Register value) {
PushRegister(value);
}
void SetReturnAddress(Register value) { PushRegister(value); }
void PushValueAtOffset(Register base, int32_t offset) {
pushl(Address(base, offset));
@@ -718,9 +716,7 @@ class Assembler : public AssemblerBase {
AddImmediate(reg, Immediate(value));
}
void AddImmediate(Register dest, Register src, int32_t value);
void AddRegisters(Register dest, Register src) {
addl(dest, src);
}
void AddRegisters(Register dest, Register src) { addl(dest, src); }
// [dest] = [src] << [scale] + [value].
void AddScaled(Register dest,
Register src,
@@ -752,9 +748,7 @@ class Assembler : public AssemblerBase {
void AndRegisters(Register dst,
Register src1,
Register src2 = kNoRegister) override;
void OrImmediate(Register dst, int32_t value) {
orl(dst, Immediate(value));
}
void OrImmediate(Register dst, int32_t value) { orl(dst, Immediate(value)); }
void LslImmediate(Register dst, int32_t shift) {
shll(dst, Immediate(shift));
}
@@ -899,9 +893,7 @@ class Assembler : public AssemblerBase {
void CallCFunction(Address target) { Call(target); }
void CallCFunction(Register target) {
call(target);
}
void CallCFunction(Register target) { call(target); }
void Jmp(const Code& code);
void J(Condition condition, const Code& code);
@@ -1036,9 +1028,7 @@ class Assembler : public AssemblerBase {
jmp(label, distance);
}
// Unconditional jump to a given address in register.
void Jump(Register target) {
jmp(target);
}
void Jump(Register target) { jmp(target); }
// Moves one word from the memory at [from] to the memory at [to].
// Needs a temporary register.
@@ -1017,9 +1017,7 @@ class Assembler : public MicroAssembler {
void Call(const Code& code) { JumpAndLink(code); }
void CallCFunction(Address target) { Call(target); }
void CallCFunction(Register target) {
Call(target);
}
void CallCFunction(Register target) { Call(target); }
void AddImmediate(Register dest, intx_t imm) {
AddImmediate(dest, dest, imm);
@@ -1043,9 +1041,7 @@ class Assembler : public MicroAssembler {
}
}
void AddShifted(Register dest, Register base, Register index, intx_t shift);
void SubRegisters(Register dest, Register src) {
sub(dest, dest, src);
}
void SubRegisters(Register dest, Register src) { sub(dest, dest, src); }
// Macros accepting a pp Register argument may attempt to load values from
// the object pool when possible. Unless you are sure that the untagged object
@@ -1080,16 +1076,12 @@ class Assembler : public MicroAssembler {
Register rn,
intx_t imm,
OperandSize sz = kWordBytes);
void OrImmediate(Register rd, intx_t imm) {
OrImmediate(rd, rd, imm);
}
void OrImmediate(Register rd, intx_t imm) { OrImmediate(rd, rd, imm); }
void XorImmediate(Register rd,
Register rn,
intx_t imm,
OperandSize sz = kWordBytes);
void LslImmediate(Register rd, int32_t shift) {
slli(rd, rd, shift);
}
void LslImmediate(Register rd, int32_t shift) { slli(rd, rd, shift); }
void LslRegister(Register dst, Register shift) override {
sll(dst, dst, shift);
}
@@ -1148,9 +1140,7 @@ class Assembler : public MicroAssembler {
void StoreUnboxedDouble(FpuRegister src, Register base, int32_t offset) {
StoreDToOffset(src, base, offset);
}
void MoveUnboxedDouble(FpuRegister dst, FpuRegister src) {
fmvd(dst, src);
}
void MoveUnboxedDouble(FpuRegister dst, FpuRegister src) { fmvd(dst, src); }
void LoadUnboxedSimd128(FpuRegister dst, Register base, int32_t offset) {
// No single register SIMD on RISC-V.
@@ -1280,9 +1270,7 @@ class Assembler : public MicroAssembler {
// Sets the return address to [value] as if there was a call.
// On RISC-V sets RA.
void SetReturnAddress(Register value) {
mv(RA, value);
}
void SetReturnAddress(Register value) { mv(RA, value); }
// Emit code to transition between generated mode and native mode.
//
@@ -2023,7 +2023,6 @@ LeafRuntimeScope::~LeafRuntimeScope() {
__ LeaveFrame();
}
#if defined(TARGET_USES_THREAD_SANITIZER)
void Assembler::TsanLoadAcquire(Address addr) {
LeafRuntimeScope rt(this, /*frame_size=*/0, /*preserve_registers=*/true);
+4 -12
View File
@@ -730,9 +730,7 @@ class Assembler : public AssemblerBase {
// Sets the return address to [value] as if there was a call.
// On X64 pushes [value].
void SetReturnAddress(Register value) {
PushRegister(value);
}
void SetReturnAddress(Register value) { PushRegister(value); }
void CompareRegisters(Register a, Register b);
void CompareObjectRegisters(Register a, Register b) { OBJ(cmp)(a, b); }
@@ -784,9 +782,7 @@ class Assembler : public AssemblerBase {
OperandSize width = kEightBytes) {
AddImmediate(reg, Immediate(value), width);
}
void AddRegisters(Register dest, Register src) {
addq(dest, src);
}
void AddRegisters(Register dest, Register src) { addq(dest, src); }
// [dest] = [src] << [scale] + [value].
void AddScaled(Register dest,
Register src,
@@ -800,9 +796,7 @@ class Assembler : public AssemblerBase {
const Immediate& imm,
OperandSize width = kEightBytes);
void SubImmediate(const Address& address, const Immediate& imm);
void SubRegisters(Register dest, Register src) {
subq(dest, src);
}
void SubRegisters(Register dest, Register src) { subq(dest, src); }
void Drop(intptr_t stack_elements, Register tmp = TMP);
@@ -1037,9 +1031,7 @@ class Assembler : public AssemblerBase {
jmp(label, distance);
}
// Unconditional jump to a given address in register.
void Jump(Register target) {
jmp(target);
}
void Jump(Register target) { jmp(target); }
// Unconditional jump to a given address in memory.
void Jump(const Address& address) { jmp(address); }
@@ -5586,9 +5586,9 @@ ASSEMBLER_TEST_RUN(TestSetCC4, test) {
ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) {
__ pushq(RSI);
__ pushq(RDI);
__ pushq(CallingConventions::kArg1Reg); // from.
__ pushq(CallingConventions::kArg2Reg); // to.
__ pushq(CallingConventions::kArg3Reg); // count.
__ pushq(CallingConventions::kArg1Reg); // from.
__ pushq(CallingConventions::kArg2Reg); // to.
__ pushq(CallingConventions::kArg3Reg); // count.
__ movq(RSI, Address(RSP, 2 * target::kWordSize)); // from.
__ movq(RDI, Address(RSP, 1 * target::kWordSize)); // to.
__ movq(RCX, Address(RSP, 0 * target::kWordSize)); // count.
@@ -1060,13 +1060,13 @@ void ARMDecoder::DecodeType6(Instr* instr) {
}
}
} else if (instr->IsVFPMultipleLoadStore()) {
if (instr->HasL()) { // vldm
if (instr->HasL()) { // vldm
if (instr->Bit(8) != 0) { // vldmd
Format(instr, "vldmd'cond'pu 'rn'w, 'dlist");
} else { // vldms
Format(instr, "vldms'cond'pu 'rn'w, 'slist");
}
} else { // vstm
} else { // vstm
if (instr->Bit(8) != 0) { // vstmd
Format(instr, "vstmd'cond'pu 'rn'w, 'dlist");
} else { // vstms
@@ -247,7 +247,9 @@ void ARM64Decoder::PrintMemOperand(Instr* instr) {
Print("]!");
break;
}
default: { Print("???"); }
default: {
Print("???");
}
}
}
}
@@ -1830,7 +1830,6 @@ void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) {
}
}
const ICData* FlowGraphCompiler::GetOrAddInstanceCallICData(
intptr_t deopt_id,
const String& target_name,
+13 -5
View File
@@ -570,13 +570,21 @@ FOR_EACH_ABSTRACT_INSTRUCTION(FORWARD_DECLARATION)
#undef FORWARD_DECLARATION
#define DEFINE_INSTRUCTION_TYPE_CHECK(type) \
virtual type##Instr* As##type() { return this; } \
virtual const type##Instr* As##type() const { return this; } \
virtual const char* DebugName() const { return #type; }
virtual type##Instr* As##type() { \
return this; \
} \
virtual const type##Instr* As##type() const { \
return this; \
} \
virtual const char* DebugName() const { \
return #type; \
}
// Functions required in all concrete instruction classes.
#define DECLARE_INSTRUCTION_NO_BACKEND(type) \
virtual Tag tag() const { return k##type; } \
virtual Tag tag() const { \
return k##type; \
} \
virtual void Accept(InstructionVisitor* visitor); \
DEFINE_INSTRUCTION_TYPE_CHECK(type)
@@ -5853,7 +5861,7 @@ class DropTempsInstr : public Definition {
class MakeTempInstr : public TemplateDefinition<0, NoThrow, Pure> {
public:
explicit MakeTempInstr(Zone* zone)
: null_(new (zone) ConstantInstr(Object::ZoneHandle())) {
: null_(new(zone) ConstantInstr(Object::ZoneHandle())) {
// Note: We put ConstantInstr inside MakeTemp to simplify code generation:
// having ConstantInstr allows us to use Location::Constant(null_) as an
// output location for this instruction.
@@ -3226,7 +3226,6 @@ void FlowGraphAllocator::CollectRepresentations() {
}
}
void FlowGraphAllocator::RemoveFrameIfNotNeeded() {
// Intrinsic functions are naturally frameless.
if (intrinsic_mode_) {
+2 -6
View File
@@ -319,13 +319,9 @@ class Range : public ZoneAllocated {
const RangeBoundary& min() const { return min_; }
const RangeBoundary& max() const { return max_; }
void set_min(const RangeBoundary& value) {
min_ = value;
}
void set_min(const RangeBoundary& value) { min_ = value; }
void set_max(const RangeBoundary& value) {
max_ = value;
}
void set_max(const RangeBoundary& value) { max_ = value; }
static RangeBoundary ConstantMinSmi(const Range* range) {
return ConstantMin(range, RangeBoundary::kRangeBoundarySmi);
+1 -3
View File
@@ -505,9 +505,7 @@ class Slot : public ZoneAllocated {
bool IsTypeArguments() const { return kind() == Kind::kTypeArguments; }
bool IsArgumentOfType() const { return kind() == Kind::kTypeArgumentsIndex; }
bool IsArrayElement() const { return kind() == Kind::kArrayElement; }
bool IsRecordField() const {
return kind() == Kind::kRecordField;
}
bool IsRecordField() const { return kind() == Kind::kRecordField; }
bool IsImmutableLengthSlot() const;
const char* Name() const;
+4 -4
View File
@@ -30,7 +30,9 @@
public: \
CompilerPass_##Name() : CompilerPass(k##Name, #Name) {} \
\
static bool Register() { return true; } \
static bool Register() { \
return true; \
} \
\
protected: \
virtual bool DoBody(CompilerPassState* state) const { \
@@ -534,9 +536,7 @@ COMPILER_PASS(AllocateRegistersForGraphIntrinsic, {
allocator.AllocateRegisters();
});
COMPILER_PASS(ReorderBlocks, {
BlockScheduler::ReorderBlocks(flow_graph);
});
COMPILER_PASS(ReorderBlocks, { BlockScheduler::ReorderBlocks(flow_graph); });
COMPILER_PASS(EliminateWriteBarriers, { EliminateWriteBarriers(flow_graph); });
+1 -1
View File
@@ -156,7 +156,7 @@ class CompilerTimings : public MallocAllocated {
#define PRECOMPILER_TIMER_SCOPE(precompiler, timer_id) \
CompilerTimings::Scope TIMER_SCOPE_NAME(__COUNTER__)( \
(precompiler)->thread(), CompilerTimings::k##timer_id)
(precompiler) -> thread(), CompilerTimings::k##timer_id)
} // namespace dart
+1 -1
View File
@@ -89,7 +89,7 @@ classid_t RecognizedMethodTypeArgCid(MethodRecognizer::Kind kind) {
#define AS_EXTERNAL_TYPED_DATA(type) \
case MethodRecognizer::kFfiAsExternalTypedData##type: \
return kFfi##type##Cid;
CLASS_LIST_FFI_NUMERIC_FIXED_SIZE(AS_EXTERNAL_TYPED_DATA)
CLASS_LIST_FFI_NUMERIC_FIXED_SIZE(AS_EXTERNAL_TYPED_DATA)
#undef AS_EXTERNAL_TYPED_DATA
default:
UNREACHABLE();
@@ -6,7 +6,7 @@
#include <utility>
#include "vm/compiler/backend/range_analysis.h" // For Range.
#include "vm/compiler/backend/range_analysis.h" // For Range.
#include "vm/compiler/frontend/flow_graph_builder.h" // For InlineExitCollector.
#include "vm/compiler/frontend/kernel_translation_helper.h"
#include "vm/compiler/jit/compiler.h" // For Compiler::IsBackgroundCompilation().
+15 -15
View File
@@ -320,9 +320,9 @@ InstancePtr ConstantReader::ReadConstantInternal(intptr_t constant_index) {
ASSERT(!list_class.IsNull());
ASSERT(list_class.is_finalized());
// Build type from the raw bytes (needs temporary translator).
TypeTranslator type_translator(
&reader, this, active_class_, /* finalize = */ true,
/* in_constant_context = */ true);
TypeTranslator type_translator(&reader, this, active_class_,
/* finalize = */ true,
/* in_constant_context = */ true);
auto& type_arguments =
TypeArguments::Handle(Z, TypeArguments::New(1, Heap::kOld));
AbstractType& type = type_translator.BuildType();
@@ -354,9 +354,9 @@ InstancePtr ConstantReader::ReadConstantInternal(intptr_t constant_index) {
ASSERT(map_class.is_finalized());
// Build types from the raw bytes (needs temporary translator).
TypeTranslator type_translator(
&reader, this, active_class_, /* finalize = */ true,
/* in_constant_context = */ true);
TypeTranslator type_translator(&reader, this, active_class_,
/* finalize = */ true,
/* in_constant_context = */ true);
auto& type_arguments =
TypeArguments::Handle(Z, TypeArguments::New(2, Heap::kOld));
AbstractType& type = type_translator.BuildType();
@@ -445,9 +445,9 @@ InstancePtr ConstantReader::ReadConstantInternal(intptr_t constant_index) {
ASSERT(set_class.is_finalized());
// Build types from the raw bytes (needs temporary translator).
TypeTranslator type_translator(
&reader, this, active_class_, /* finalize = */ true,
/* in_constant_context = */ true);
TypeTranslator type_translator(&reader, this, active_class_,
/* finalize = */ true,
/* in_constant_context = */ true);
auto& type_arguments =
TypeArguments::Handle(Z, TypeArguments::New(1, Heap::kOld));
AbstractType& type = type_translator.BuildType();
@@ -499,9 +499,9 @@ InstancePtr ConstantReader::ReadConstantInternal(intptr_t constant_index) {
ASSERT(klass.is_enum_class() || klass.is_const());
instance = Instance::New(klass, Heap::kOld);
// Build type from the raw bytes (needs temporary translator).
TypeTranslator type_translator(
&reader, this, active_class_, /* finalize = */ true,
/* in_constant_context = */ true);
TypeTranslator type_translator(&reader, this, active_class_,
/* finalize = */ true,
/* in_constant_context = */ true);
const intptr_t number_of_type_arguments = reader.ReadUInt();
if (klass.NumTypeArguments() > 0) {
auto& type_arguments = TypeArguments::Handle(
@@ -540,9 +540,9 @@ InstancePtr ConstantReader::ReadConstantInternal(intptr_t constant_index) {
ASSERT(!constant.IsNull());
// Build type from the raw bytes (needs temporary translator).
TypeTranslator type_translator(
&reader, this, active_class_, /* finalize = */ true,
/* in_constant_context = */ true);
TypeTranslator type_translator(&reader, this, active_class_,
/* finalize = */ true,
/* in_constant_context = */ true);
const intptr_t number_of_type_arguments = reader.ReadUInt();
ASSERT(number_of_type_arguments > 0);
auto& type_arguments = TypeArguments::Handle(
@@ -4277,7 +4277,7 @@ Fragment StreamingFlowGraphBuilder::BuildRecordFieldGet(TokenPosition* p,
Fragment StreamingFlowGraphBuilder::BuildFunctionExpression() {
const intptr_t offset = ReaderOffset() - 1; // Include the tag.
ReadPosition(); // read position.
ReadPosition(); // read position.
return BuildFunctionNode(offset);
}
@@ -82,8 +82,8 @@ void KernelFingerprintHelper::CalculateConstructorFingerprint() {
void KernelFingerprintHelper::CalculateArgumentsFingerprint() {
BuildHash(ReadUInt()); // read argument count.
CalculateListOfDartTypesFingerprint(); // read list of types.
CalculateListOfExpressionsFingerprint(); // read positional.
CalculateListOfDartTypesFingerprint(); // read list of types.
CalculateListOfExpressionsFingerprint(); // read positional.
CalculateListOfNamedExpressionsFingerprint(); // read named.
}
@@ -250,7 +250,7 @@ void KernelFingerprintHelper::CalculateDartTypeFingerprint() {
case kTypeParameterType: {
Nullability nullability = ReadNullability();
BuildHash(static_cast<uint32_t>(nullability));
ReadUInt(); // read index for parameter.
ReadUInt(); // read index for parameter.
break;
}
case kIntersectionType:
@@ -518,9 +518,9 @@ void KernelFingerprintHelper::CalculateExpressionFingerprint() {
UNREACHABLE();
break;
case kSuperMethodInvocation:
ReadPosition(); // read position.
BuildHash(ReadNameAsMethodName().Hash()); // read name.
CalculateArgumentsFingerprint(); // read arguments.
ReadPosition(); // read position.
BuildHash(ReadNameAsMethodName().Hash()); // read name.
CalculateArgumentsFingerprint(); // read arguments.
CalculateInterfaceMemberNameFingerprint(); // read target_reference.
return;
case kStaticInvocation:
+2 -2
View File
@@ -151,8 +151,8 @@ class BackgroundCompiler {
Monitor monitor_; // Controls access to the queue and running state.
BackgroundCompilationQueue* function_queue_;
bool running_; // While true, will try to read queue and compile.
bool done_; // True if the thread is done.
bool running_; // While true, will try to read queue and compile.
bool done_; // True if the thread is done.
int16_t disabled_depth_;
DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler);
+1 -3
View File
@@ -50,9 +50,7 @@ struct RelocatorTestHelper {
FLAG_lower_pc_relative_call_distance = -128;
FLAG_upper_pc_relative_call_distance = 128;
}
~RelocatorTestHelper() {
FLAG_precompiled_mode = false;
}
~RelocatorTestHelper() { FLAG_precompiled_mode = false; }
void CreateInstructions(std::initializer_list<intptr_t> sizes) {
for (auto size : sizes) {
+21 -7
View File
@@ -92,7 +92,9 @@ bool IsNotTemporaryScopedHandle(const Object& obj) {
#endif
#define DO(clazz) \
bool Is##clazz##Handle(const Object& obj) { return obj.Is##clazz(); }
bool Is##clazz##Handle(const Object& obj) { \
return obj.Is##clazz(); \
}
CLASS_LIST_FOR_HANDLES(DO)
#undef DO
@@ -634,13 +636,17 @@ const word MegamorphicCache::kSpreadFactor =
#define DEFINE_CONSTANT(Class, Name) const word Class::Name = Class##_##Name;
#define DEFINE_ARRAY_SIZEOF(clazz, name, ElementOffset) \
word clazz::name() { return 0; } \
word clazz::name() { \
return 0; \
} \
word clazz::name(intptr_t length) { \
return RoundedAllocationSize(clazz::ElementOffset(length)); \
}
#define DEFINE_PAYLOAD_SIZEOF(clazz, name, header) \
word clazz::name() { return 0; } \
word clazz::name() { \
return 0; \
} \
word clazz::name(word payload_size) { \
return RoundedAllocationSize(clazz::header() + payload_size); \
}
@@ -648,7 +654,9 @@ const word MegamorphicCache::kSpreadFactor =
#if defined(TARGET_ARCH_IA32)
#define DEFINE_FIELD(clazz, name) \
word clazz::name() { return clazz##_##name; }
word clazz::name() { \
return clazz##_##name; \
}
#define DEFINE_ARRAY(clazz, name) \
word clazz::name(intptr_t index) { \
@@ -656,7 +664,9 @@ const word MegamorphicCache::kSpreadFactor =
}
#define DEFINE_SIZEOF(clazz, name, what) \
word clazz::name() { return clazz##_##name; }
word clazz::name() { \
return clazz##_##name; \
}
#define DEFINE_RANGE(Class, Getter, Type, First, Last, Filter) \
word Class::Getter(Type index) { \
@@ -739,7 +749,9 @@ JIT_OFFSETS_LIST(DEFINE_JIT_FIELD,
// definitions using DART_PRECOMPILER.
#define DEFINE_AOT_FIELD(clazz, name) \
word clazz::name() { return AOT_##clazz##_##name; }
word clazz::name() { \
return AOT_##clazz##_##name; \
}
#define DEFINE_AOT_ARRAY(clazz, name) \
word clazz::name(intptr_t index) { \
@@ -748,7 +760,9 @@ JIT_OFFSETS_LIST(DEFINE_JIT_FIELD,
}
#define DEFINE_AOT_SIZEOF(clazz, name, what) \
word clazz::name() { return AOT_##clazz##_##name; }
word clazz::name() { \
return AOT_##clazz##_##name; \
}
#define DEFINE_AOT_RANGE(Class, Getter, Type, First, Last, Filter) \
word Class::Getter(Type index) { \
+3 -1
View File
@@ -404,7 +404,9 @@ bool WillAllocateNewOrRememberedContext(intptr_t num_context_variables);
bool WillAllocateNewOrRememberedArray(intptr_t length);
#define FINAL_CLASS() \
static word NextFieldOffset() { return -kWordSize; }
static word NextFieldOffset() { \
return -kWordSize; \
}
//
// Target specific offsets and constants.
+4 -4
View File
@@ -462,11 +462,11 @@ void StubCodeCompiler::GenerateInstantiateTypeArgumentsStub() {
#endif
__ PushRegistersInOrder({
#if defined(DART_ASSEMBLER_HAS_NULL_REG)
NULL_REG,
NULL_REG,
#endif
InstantiationABI::kUninstantiatedTypeArgumentsReg,
InstantiationABI::kInstantiatorTypeArgumentsReg,
InstantiationABI::kFunctionTypeArgumentsReg,
InstantiationABI::kUninstantiatedTypeArgumentsReg,
InstantiationABI::kInstantiatorTypeArgumentsReg,
InstantiationABI::kFunctionTypeArgumentsReg,
});
__ CallRuntime(kInstantiateTypeArgumentsRuntimeEntry, 3);
__ Drop(3); // Drop 2 type vectors, and uninstantiated type.
+31 -32
View File
@@ -695,8 +695,8 @@ void StubCodeCompiler::GenerateFixCallersTargetStub() {
__ Push(R0); // Preserve receiver.
__ Push(R9); // Old cache value (also 2nd return value).
__ CallRuntime(kFixCallersTargetMonomorphicRuntimeEntry, 2);
__ Pop(R9); // Get target cache object.
__ Pop(R0); // Restore receiver.
__ Pop(R9); // Get target cache object.
__ Pop(R0); // Restore receiver.
__ Pop(CODE_REG); // Get target Code object.
// Remove the stub frame.
__ LeaveStubFrame();
@@ -846,25 +846,25 @@ static void GenerateDeoptimizationSequence(Assembler* assembler,
}
}
ASSERT(kFpuRegisterSize == 4 * target::kWordSize);
if (kNumberOfDRegisters > 16) {
__ vstmd(DB_W, SP, D16, kNumberOfDRegisters - 16);
__ vstmd(DB_W, SP, D0, 16);
} else {
__ vstmd(DB_W, SP, D0, kNumberOfDRegisters);
}
ASSERT(kFpuRegisterSize == 4 * target::kWordSize);
if (kNumberOfDRegisters > 16) {
__ vstmd(DB_W, SP, D16, kNumberOfDRegisters - 16);
__ vstmd(DB_W, SP, D0, 16);
} else {
__ vstmd(DB_W, SP, D0, kNumberOfDRegisters);
}
{
__ mov(R0, Operand(SP)); // Pass address of saved registers block.
LeafRuntimeScope rt(assembler,
/*frame_size=*/0,
/*preserve_registers=*/false);
bool is_lazy =
(kind == kLazyDeoptFromReturn) || (kind == kLazyDeoptFromThrow);
__ mov(R1, Operand(is_lazy ? 1 : 0));
rt.Call(kDeoptimizeCopyFrameRuntimeEntry, 2);
// Result (R0) is stack-size (FP - SP) in bytes.
}
{
__ mov(R0, Operand(SP)); // Pass address of saved registers block.
LeafRuntimeScope rt(assembler,
/*frame_size=*/0,
/*preserve_registers=*/false);
bool is_lazy =
(kind == kLazyDeoptFromReturn) || (kind == kLazyDeoptFromThrow);
__ mov(R1, Operand(is_lazy ? 1 : 0));
rt.Call(kDeoptimizeCopyFrameRuntimeEntry, 2);
// Result (R0) is stack-size (FP - SP) in bytes.
}
if (kind == kLazyDeoptFromReturn) {
// Restore result into R1 temporarily.
@@ -1004,8 +1004,8 @@ static void GenerateNoSuchMethodDispatcherBody(Assembler* assembler) {
__ ldr(R8, Address(IP, target::frame_layout.param_end_from_fp *
target::kWordSize));
__ LoadImmediate(IP, 0);
__ Push(IP); // Result slot.
__ Push(R8); // Receiver.
__ Push(IP); // Result slot.
__ Push(R8); // Receiver.
__ Push(IC_DATA_REG); // ICData/MegamorphicCache.
__ Push(ARGS_DESC_REG); // Arguments descriptor.
@@ -1087,8 +1087,8 @@ void StubCodeCompiler::GenerateAllocateArrayStub() {
__ ldr(AllocateArrayABI::kResultReg,
Address(THR, target::Thread::top_offset()));
__ adds(R3, AllocateArrayABI::kResultReg,
Operand(R9)); // Potential next object start.
__ b(&slow_case, CS); // Branch if unsigned overflow.
Operand(R9)); // Potential next object start.
__ b(&slow_case, CS); // Branch if unsigned overflow.
// Check if the allocation fits into the remaining space.
// AllocateArrayABI::kResultReg: potential new object start.
@@ -1592,8 +1592,7 @@ void StubCodeCompiler::GenerateWriteBarrierWrappersStub() {
COMPILE_ASSERT(kWriteBarrierObjectReg == R1);
COMPILE_ASSERT(kWriteBarrierValueReg == R0);
COMPILE_ASSERT(kWriteBarrierSlotReg == R9);
static void GenerateWriteBarrierStubHelper(Assembler* assembler,
bool cards) {
static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) {
Label skip_marking;
__ Push(R2);
__ ldr(TMP, FieldAddress(R0, target::Object::tags_offset()));
@@ -1723,15 +1722,15 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler,
// Dirty the card. Not atomic: we assume mutable arrays are not shared
// between threads
__ PushList((1 << R0) | (1 << R1));
__ AndImmediate(TMP, R1, target::kPageMask); // Page.
__ sub(R9, R9, Operand(TMP)); // Offset in page.
__ AndImmediate(TMP, R1, target::kPageMask); // Page.
__ sub(R9, R9, Operand(TMP)); // Offset in page.
__ Lsr(R9, R9, Operand(target::Page::kBytesPerCardLog2)); // Card index.
__ AndImmediate(R1, R9, target::kBitsPerWord - 1); // Lsl is not mod 32.
__ LoadImmediate(R0, 1); // Bit offset.
__ Lsl(R0, R0, R1); // Bit mask.
__ ldr(TMP,
Address(TMP, target::Page::card_table_offset())); // Card table.
__ Lsr(R9, R9, Operand(target::kBitsPerWordLog2)); // Word index.
Address(TMP, target::Page::card_table_offset())); // Card table.
__ Lsr(R9, R9, Operand(target::kBitsPerWordLog2)); // Word index.
__ add(TMP, TMP, Operand(R9, LSL, target::kWordSizeLog2)); // Word address.
__ ldr(R1, Address(TMP, 0));
__ orr(R1, R1, Operand(R0));
@@ -2840,7 +2839,7 @@ void StubCodeCompiler::GenerateJumpToFrameStub() {
COMPILE_ASSERT(kStackTraceObjectReg == R1);
COMPILE_ASSERT(IsAbiPreservedRegister(R4));
COMPILE_ASSERT(IsAbiPreservedRegister(THR));
__ mov(IP, Operand(R1)); // Copy Stack pointer into IP.
__ mov(IP, Operand(R1)); // Copy Stack pointer into IP.
// TransitionGeneratedToNative might clobber LR if it takes the slow path.
__ mov(R4, Operand(R0)); // Program counter.
__ mov(THR, Operand(R3)); // Thread.
@@ -2941,7 +2940,7 @@ void StubCodeCompiler::GenerateOptimizeFunctionStub() {
__ Push(IP); // Setup space on stack for return value.
__ Push(R8);
__ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ Pop(R0); // Discard argument.
__ Pop(R0); // Discard argument.
__ Pop(FUNCTION_REG); // Get Function object
__ Pop(ARGS_DESC_REG); // Restore argument descriptor.
__ LeaveStubFrame();
@@ -1254,8 +1254,8 @@ static void GenerateNoSuchMethodDispatcherBody(Assembler* assembler) {
__ add(TMP, FP, Operand(R2, LSL, target::kWordSizeLog2 - 1)); // R2 is Smi.
__ LoadFromOffset(R6, TMP,
target::frame_layout.param_end_from_fp * target::kWordSize);
__ Push(ZR); // Result slot.
__ Push(R6); // Receiver.
__ Push(ZR); // Result slot.
__ Push(R6); // Receiver.
__ Push(IC_DATA_REG); // ICData/MegamorphicCache.
__ Push(ARGS_DESC_REG); // Arguments descriptor.
@@ -1897,8 +1897,7 @@ void StubCodeCompiler::GenerateWriteBarrierWrappersStub() {
COMPILE_ASSERT(kWriteBarrierObjectReg == R1);
COMPILE_ASSERT(kWriteBarrierValueReg == R0);
COMPILE_ASSERT(kWriteBarrierSlotReg == R25);
static void GenerateWriteBarrierStubHelper(Assembler* assembler,
bool cards) {
static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) {
RegisterSet spill_set((1 << R2) | (1 << R3) | (1 << R4), 0);
Label skip_marking;
@@ -2402,7 +2401,7 @@ static void EmitFastSmiOp(Assembler* assembler,
switch (kind) {
case Token::kADD: {
__ adds(R0, R1, Operand(R0), kObjectBytes); // Add.
__ b(not_smi_or_overflow, VS); // Branch if overflow.
__ b(not_smi_or_overflow, VS); // Branch if overflow.
break;
}
case Token::kLT: {
@@ -2636,7 +2635,7 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
// Preserve IC data object and arguments descriptor array and
// setup space on stack for result (target code object).
__ Push(ARGS_DESC_REG); // Preserve arguments descriptor array.
__ Push(R5); // Preserve IC Data.
__ Push(R5); // Preserve IC Data.
if (save_entry_point) {
__ SmiTag(R8);
__ Push(R8);
@@ -2660,7 +2659,7 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
__ Pop(R8);
__ SmiUntag(R8);
}
__ Pop(R5); // Restore IC Data.
__ Pop(R5); // Restore IC Data.
__ Pop(ARGS_DESC_REG); // Restore arguments descriptor array.
__ RestoreCodePointer();
__ LeaveStubFrame();
@@ -3238,7 +3237,7 @@ void StubCodeCompiler::GenerateOptimizeFunctionStub() {
__ Push(ZR);
__ Push(R6);
__ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ Pop(R0); // Discard argument.
__ Pop(R0); // Discard argument.
__ Pop(FUNCTION_REG); // Get Function object
__ Pop(ARGS_DESC_REG); // Restore argument descriptor.
__ LoadCompressedFieldFromOffset(CODE_REG, FUNCTION_REG,
+12 -12
View File
@@ -105,7 +105,7 @@ void StubCodeCompiler::GenerateCallToRuntimeStub() {
}
// Pass NativeArguments structure by value and call runtime.
__ movl(Address(ESP, thread_offset), THR); // Set thread in NativeArgs.
__ movl(Address(ESP, thread_offset), THR); // Set thread in NativeArgs.
__ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments.
// Compute argv.
__ leal(EAX,
@@ -544,9 +544,9 @@ void StubCodeCompiler::GenerateCallBootstrapNativeStub() {
void StubCodeCompiler::GenerateCallStaticFunctionStub() {
__ EnterStubFrame();
__ pushl(ARGS_DESC_REG); // Preserve arguments descriptor array.
__ pushl(Immediate(0)); // Setup space on stack for return value.
__ pushl(Immediate(0)); // Setup space on stack for return value.
__ CallRuntime(kPatchStaticCallRuntimeEntry, 0);
__ popl(EAX); // Get Code object result.
__ popl(EAX); // Get Code object result.
__ popl(ARGS_DESC_REG); // Restore arguments descriptor array.
// Remove the stub frame as we are about to jump to the dart function.
__ LeaveFrame();
@@ -564,9 +564,9 @@ void StubCodeCompiler::GenerateFixCallersTargetStub() {
// This was a static call.
__ EnterStubFrame();
__ pushl(ARGS_DESC_REG); // Preserve arguments descriptor array.
__ pushl(Immediate(0)); // Setup space on stack for return value.
__ pushl(Immediate(0)); // Setup space on stack for return value.
__ CallRuntime(kFixCallersTargetRuntimeEntry, 0);
__ popl(EAX); // Get Code object.
__ popl(EAX); // Get Code object.
__ popl(ARGS_DESC_REG); // Restore arguments descriptor array.
__ movl(EAX, FieldAddress(EAX, target::Code::entry_point_offset()));
__ LeaveFrame();
@@ -1545,8 +1545,8 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) {
// Get card table.
__ Bind(&remember_card);
__ movl(EAX, EDX); // Object.
__ andl(EAX, Immediate(target::kPageMask)); // Page.
__ movl(EAX, EDX); // Object.
__ andl(EAX, Immediate(target::kPageMask)); // Page.
__ cmpl(Address(EAX, target::Page::card_table_offset()), Immediate(0));
__ j(EQUAL, &remember_card_slow, Assembler::kNearJump);
@@ -2065,8 +2065,8 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStubForEntryKind(
// calling into the runtime.
__ EnterStubFrame();
__ pushl(ARGS_DESC_REG); // Preserve arguments descriptor array.
__ pushl(ECX); // Preserve IC data object.
__ pushl(Immediate(0)); // Result slot.
__ pushl(ECX); // Preserve IC data object.
__ pushl(Immediate(0)); // Result slot.
// Push call arguments.
for (intptr_t i = 0; i < num_args; i++) {
__ movl(EBX, Address(EAX, -target::kWordSize * i));
@@ -2078,8 +2078,8 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStubForEntryKind(
for (intptr_t i = 0; i < num_args + 1; i++) {
__ popl(EAX);
}
__ popl(FUNCTION_REG); // Pop returned function object into EAX.
__ popl(ECX); // Restore IC data array.
__ popl(FUNCTION_REG); // Pop returned function object into EAX.
__ popl(ECX); // Restore IC data array.
__ popl(ARGS_DESC_REG); // Restore arguments descriptor array.
__ LeaveFrame();
Label call_target_function;
@@ -2843,7 +2843,7 @@ void StubCodeCompiler::GenerateOptimizeFunctionStub() {
__ pushl(Immediate(0)); // Setup space on stack for return value.
__ pushl(EBX);
__ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ popl(EAX); // Discard argument.
__ popl(EAX); // Discard argument.
__ popl(FUNCTION_REG); // Get Function object
__ popl(ARGS_DESC_REG); // Restore argument descriptor.
__ LeaveFrame();
@@ -1709,8 +1709,7 @@ void StubCodeCompiler::GenerateWriteBarrierWrappersStub() {
COMPILE_ASSERT(kWriteBarrierObjectReg == A0);
COMPILE_ASSERT(kWriteBarrierValueReg == A1);
COMPILE_ASSERT(kWriteBarrierSlotReg == A6);
static void GenerateWriteBarrierStubHelper(Assembler* assembler,
bool cards) {
static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) {
RegisterSet spill_set((1 << T2) | (1 << T3) | (1 << T4), 0);
Label skip_marking;
+14 -15
View File
@@ -825,7 +825,7 @@ void StubCodeCompiler::GenerateCallStaticFunctionStub() {
// Setup space on stack for return value.
__ pushq(Immediate(0));
__ CallRuntime(kPatchStaticCallRuntimeEntry, 0);
__ popq(CODE_REG); // Get Code object result.
__ popq(CODE_REG); // Get Code object result.
__ popq(ARGS_DESC_REG); // Restore arguments descriptor array.
// Remove the stub frame as we are about to jump to the dart function.
__ LeaveStubFrame();
@@ -852,7 +852,7 @@ void StubCodeCompiler::GenerateFixCallersTargetStub() {
// Setup space on stack for return value.
__ pushq(Immediate(0));
__ CallRuntime(kFixCallersTargetRuntimeEntry, 0);
__ popq(CODE_REG); // Get Code object.
__ popq(CODE_REG); // Get Code object.
__ popq(ARGS_DESC_REG); // Restore arguments descriptor array.
__ movq(RAX, FieldAddress(CODE_REG, target::Code::entry_point_offset()));
__ LeaveStubFrame();
@@ -1173,9 +1173,9 @@ void StubCodeCompiler::GenerateDeoptimizeStub() {
// RDI - arguments descriptor size
static void GenerateNoSuchMethodDispatcherBody(Assembler* assembler,
Register receiver_reg) {
__ pushq(Immediate(0)); // Setup space on stack for result.
__ pushq(receiver_reg); // Receiver.
__ pushq(IC_DATA_REG); // ICData/MegamorphicCache.
__ pushq(Immediate(0)); // Setup space on stack for result.
__ pushq(receiver_reg); // Receiver.
__ pushq(IC_DATA_REG); // ICData/MegamorphicCache.
__ pushq(ARGS_DESC_REG); // Arguments descriptor array.
// Adjust arguments count.
@@ -1947,14 +1947,13 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) {
__ ret();
}
if (cards) {
Label remember_card_slow;
// Get card table.
__ Bind(&remember_card);
__ movq(TMP, RDX); // Object.
__ andq(TMP, Immediate(target::kPageMask)); // Page.
__ movq(TMP, RDX); // Object.
__ andq(TMP, Immediate(target::kPageMask)); // Page.
__ cmpq(Address(TMP, target::Page::card_table_offset()), Immediate(0));
__ j(EQUAL, &remember_card_slow, Assembler::kNearJump);
@@ -2555,8 +2554,8 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
__ pushq(R8); // Preserve entry point.
}
__ pushq(ARGS_DESC_REG); // Preserve arguments descriptor array.
__ pushq(RBX); // Preserve IC data object.
__ pushq(Immediate(0)); // Result slot.
__ pushq(RBX); // Preserve IC data object.
__ pushq(Immediate(0)); // Result slot.
// Push call arguments.
for (intptr_t i = 0; i < num_args; i++) {
__ movq(RCX, Address(RAX, -target::kWordSize * i));
@@ -2568,8 +2567,8 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
for (intptr_t i = 0; i < num_args + 1; i++) {
__ popq(RAX);
}
__ popq(FUNCTION_REG); // Pop returned function object into RAX.
__ popq(RBX); // Restore IC data array.
__ popq(FUNCTION_REG); // Pop returned function object into RAX.
__ popq(RBX); // Restore IC data array.
__ popq(ARGS_DESC_REG); // Restore arguments descriptor array.
if (save_entry_point) {
__ popq(R8); // Restore entry point.
@@ -3160,10 +3159,10 @@ void StubCodeCompiler::GenerateOptimizeFunctionStub() {
__ movq(CODE_REG, Address(THR, target::Thread::optimize_stub_offset()));
__ EnterStubFrame();
__ pushq(ARGS_DESC_REG); // Preserve args descriptor.
__ pushq(Immediate(0)); // Result slot.
__ pushq(RDI); // Arg0: function to optimize
__ pushq(Immediate(0)); // Result slot.
__ pushq(RDI); // Arg0: function to optimize
__ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ popq(RAX); // Discard argument.
__ popq(RAX); // Discard argument.
__ popq(FUNCTION_REG); // Get Function object.
__ popq(ARGS_DESC_REG); // Restore argument descriptor.
__ LeaveStubFrame();
@@ -2,9 +2,9 @@
// 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.
#include "vm/compiler/write_barrier_elimination.h"
#include "vm/compiler/backend/flow_graph.h"
#include "vm/compiler/compiler_pass.h"
#include "vm/compiler/write_barrier_elimination.h"
namespace dart {
+9 -3
View File
@@ -1522,7 +1522,9 @@ class CInstr {
class name { \
public: \
constexpr explicit name(storage_t encoding) : encoding_(encoding) {} \
constexpr storage_t encoding() const { return encoding_; } \
constexpr storage_t encoding() const { \
return encoding_; \
} \
constexpr bool operator==(const name& other) const { \
return encoding_ == other.encoding_; \
} \
@@ -1543,14 +1545,18 @@ class CInstr {
constexpr /* implicit */ name##Set(name element) \
: encoding_(1u << element.encoding()) {} \
constexpr explicit name##Set(storage_t encoding) : encoding_(encoding) {} \
constexpr static name##Set Empty() { return name##Set(0); } \
constexpr static name##Set Empty() { \
return name##Set(0); \
} \
constexpr bool Includes(const name r) const { \
return (encoding_ & (1 << r.encoding())) != 0; \
} \
constexpr bool IncludesAll(const name##Set other) const { \
return (encoding_ & other.encoding_) == other.encoding_; \
} \
constexpr bool IsEmpty() const { return encoding_ == 0; } \
constexpr bool IsEmpty() const { \
return encoding_ == 0; \
} \
constexpr bool operator==(const name##Set& other) const { \
return encoding_ == other.encoding_; \
} \
+3 -3
View File
@@ -6067,9 +6067,9 @@ Dart_CompileToKernel(const char* script_uri,
nullptr, verbosity);
if (incremental_compile) {
Dart_KernelCompilationResult ack_result =
result.status == Dart_KernelCompilationStatus_Ok ?
KernelIsolate::AcceptCompilation():
KernelIsolate::RejectCompilation();
result.status == Dart_KernelCompilationStatus_Ok
? KernelIsolate::AcceptCompilation()
: KernelIsolate::RejectCompilation();
if (ack_result.status != Dart_KernelCompilationStatus_Ok) {
FATAL(
"An error occurred in the CFE while acking the most recent"
+1 -3
View File
@@ -12,6 +12,4 @@
#include "vm/thread.h"
#include "vm/timeline.h"
namespace dart {
} // namespace dart
namespace dart {} // namespace dart
+1 -3
View File
@@ -313,9 +313,7 @@ class ActivationFrame : public ZoneAllocated {
// when the frame below (callee) completes.
const Closure& closure() const { return closure_; }
const Function& function() const {
return function_;
}
const Function& function() const { return function_; }
const Code& code() const {
ASSERT(!code_.IsNull());
return code_;
+2 -9
View File
@@ -194,8 +194,7 @@ void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) {
}
intptr_t DeoptContext::DestStackAdjustment() const {
return dest_frame_size_ - kDartFrameFixedSize - num_args_
- 1 // For fp.
return dest_frame_size_ - kDartFrameFixedSize - num_args_ - 1 // For fp.
- kParamEndSlotFromFp;
}
@@ -1029,7 +1028,7 @@ DeoptInfoBuilder::DeoptInfoBuilder(Zone* zone,
instructions_(),
num_args_(num_args),
assembler_(assembler),
trie_root_(new (zone) TrieNode()),
trie_root_(new(zone) TrieNode()),
current_info_number_(0),
frame_start_(-1),
materializations_() {}
@@ -1347,7 +1346,6 @@ void DeoptTable::GetEntry(const Array& table,
*reason ^= table.At(i + 2);
}
intptr_t DeoptInfo::FrameSize(const TypedData& packed) {
NoSafepointScope no_safepoint;
typedef ReadStream::Raw<sizeof(intptr_t), intptr_t> Reader;
@@ -1356,7 +1354,6 @@ intptr_t DeoptInfo::FrameSize(const TypedData& packed) {
return Reader::Read(&read_stream);
}
intptr_t DeoptInfo::NumMaterializations(
const GrowableArray<DeoptInstr*>& unpacked) {
intptr_t num = 0;
@@ -1366,7 +1363,6 @@ intptr_t DeoptInfo::NumMaterializations(
return num;
}
void DeoptInfo::UnpackInto(const Array& table,
const TypedData& packed,
GrowableArray<DeoptInstr*>* unpacked,
@@ -1398,7 +1394,6 @@ void DeoptInfo::UnpackInto(const Array& table,
}
}
void DeoptInfo::Unpack(const Array& table,
const TypedData& packed,
GrowableArray<DeoptInstr*>* unpacked) {
@@ -1411,7 +1406,6 @@ void DeoptInfo::Unpack(const Array& table,
unpacked->Reverse();
}
const char* DeoptInfo::ToCString(const Array& deopt_table,
const TypedData& packed) {
#define FORMAT "[%s]"
@@ -1438,7 +1432,6 @@ const char* DeoptInfo::ToCString(const Array& deopt_table,
#undef FORMAT
}
// Returns a bool so it can be asserted.
bool DeoptInfo::VerifyDecompression(const GrowableArray<DeoptInstr*>& original,
const Array& deopt_table,
+10 -6
View File
@@ -69,7 +69,9 @@ static constexpr intptr_t kLinearInitValue = -1;
ASSERT(name##_ != kLinearInitValue); \
return name##_; \
} \
bool name##_is_set() const { return name##_ != kLinearInitValue; } \
bool name##_is_set() const { \
return name##_ != kLinearInitValue; \
} \
void set_##name(intptr_t value) { \
ASSERT(value != kLinearInitValue); \
ASSERT_EQUAL(name##_, kLinearInitValue); \
@@ -87,7 +89,9 @@ static constexpr intptr_t kLinearInitValue = -1;
V(BitsContainer) \
V(TextSection) V(DataSection) V(BssSection) V(PseudoSection) V(SectionTable)
#define DEFINE_TYPE_CHECK_FOR(Type) \
bool Is##Type() const { return true; }
bool Is##Type() const { \
return true; \
}
#define DECLARE_SECTION_TYPE_CLASS(Type) class Type;
FOR_EACH_SECTION_TYPE(DECLARE_SECTION_TYPE_CLASS)
@@ -1154,7 +1158,7 @@ Elf::Elf(Zone* zone, BaseWriteStream* stream, Type type, Dwarf* dwarf)
unwrapped_stream_(stream),
type_(type),
dwarf_(dwarf),
section_table_(new (zone) SectionTable(zone)) {
section_table_(new(zone) SectionTable(zone)) {
// Separate debugging information should always have a Dwarf object.
ASSERT(type_ == Type::Snapshot || dwarf_ != nullptr);
// Assumed by various offset logic in this file.
@@ -1414,7 +1418,7 @@ void Elf::FinalizeEhFrame() {
#if defined(DART_TARGET_OS_WINDOWS) && \
(defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64))
// Append Windows unwinding instructions to the end of .text section.
{
{ // NOLINT
auto* const unwinding_instructions_frame = new (zone_) TextSection(type_);
ZoneWriteStream stream(
zone(),
@@ -1488,8 +1492,8 @@ void Elf::FinalizeEhFrame() {
dwarf_stream.u4(stream.Position() - cie_start);
// Start address as a PC relative reference.
dwarf_stream.RelativeSymbolOffset<int32_t>(portion.label);
dwarf_stream.u4(portion.size); // Size.
dwarf_stream.u1(0); // Augmentation Data length.
dwarf_stream.u4(portion.size); // Size.
dwarf_stream.u1(0); // Augmentation Data length.
// Caller FP at FP+kSavedCallerPcSlotFromFp*kWordSize,
// where FP is CFA - kCallerSpSlotFromFp*kWordSize.
+7 -6
View File
@@ -355,7 +355,7 @@ class ExceptionHandlerFinder : public StackResource {
Thread* thread_;
Code* code_;
bool handler_pc_set_;
intptr_t pc_; // Current pc in the handler frame.
intptr_t pc_; // Current pc in the handler frame.
const CatchEntryMoves* catch_entry_moves_ = nullptr;
CatchEntryMovesCache* catch_entry_moves_cache_ = nullptr;
@@ -627,11 +627,12 @@ static void JumpToExceptionHandler(Thread* thread,
}
NO_SANITIZE_SAFE_STACK // This function manipulates the safestack pointer.
void Exceptions::JumpToFrame(Thread* thread,
uword program_counter,
uword stack_pointer,
uword frame_pointer,
bool clear_deopt_at_target) {
void
Exceptions::JumpToFrame(Thread* thread,
uword program_counter,
uword stack_pointer,
uword frame_pointer,
bool clear_deopt_at_target) {
ASSERT(thread->execution_state() == Thread::kThreadInVM);
const uword fp_for_clearing =
(clear_deopt_at_target ? frame_pointer + 1 : frame_pointer);
+1 -3
View File
@@ -180,9 +180,7 @@ class FfiCallbackMetadata {
// Tells FfiCallbackTrampolineStub how to call into the entry point. Mostly
// it's just a flag for whether this is a sync or async callback, but on
// IA32 it also encodes whether there's a stack delta of 4 to deal with.
TrampolineType trampoline_type() const {
return trampoline_type_;
}
TrampolineType trampoline_type() const { return trampoline_type_; }
};
// Returns the Metadata object for the given trampoline.
+3 -1
View File
@@ -2,8 +2,10 @@
// 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.
#include "vm/growable_array.h"
#include <utility>
#include "platform/assert.h"
#include "vm/growable_array.h"
#include "vm/symbols.h"
#include "vm/unit_test.h"
+4 -4
View File
@@ -530,7 +530,7 @@ class IntKeyRawPointerValueTrait {
};
template <typename V>
class IntMap : public DirectChainedHashMap<IntKeyRawPointerValueTrait<V> > {
class IntMap : public DirectChainedHashMap<IntKeyRawPointerValueTrait<V>> {
public:
IntMap() : DirectChainedHashMap<IntKeyRawPointerValueTrait<V>>() {}
explicit IntMap(Zone* zone)
@@ -542,12 +542,12 @@ class IntMap : public DirectChainedHashMap<IntKeyRawPointerValueTrait<V> > {
inline void Insert(const Key& key, const Value& value) {
Pair pair(key, value);
DirectChainedHashMap<IntKeyRawPointerValueTrait<V> >::Insert(pair);
DirectChainedHashMap<IntKeyRawPointerValueTrait<V>>::Insert(pair);
}
inline V Lookup(const Key& key) const {
Pair* pair =
DirectChainedHashMap<IntKeyRawPointerValueTrait<V> >::Lookup(key);
DirectChainedHashMap<IntKeyRawPointerValueTrait<V>>::Lookup(key);
if (pair == nullptr) {
return V();
} else {
@@ -556,7 +556,7 @@ class IntMap : public DirectChainedHashMap<IntKeyRawPointerValueTrait<V> > {
}
inline Pair* LookupPair(const Key& key) const {
return DirectChainedHashMap<IntKeyRawPointerValueTrait<V> >::Lookup(key);
return DirectChainedHashMap<IntKeyRawPointerValueTrait<V>>::Lookup(key);
}
private:
+2 -2
View File
@@ -160,9 +160,9 @@ TEST_CASE(DirectChainedHashMapIterator) {
IntptrPair p3(3, 3);
IntptrPair p4(4, 4);
IntptrPair p5(5, 5);
DirectChainedHashMap<NumbersKeyValueTrait<IntptrPair> > map;
DirectChainedHashMap<NumbersKeyValueTrait<IntptrPair>> map;
EXPECT(map.IsEmpty());
DirectChainedHashMap<NumbersKeyValueTrait<IntptrPair> >::Iterator it =
DirectChainedHashMap<NumbersKeyValueTrait<IntptrPair>>::Iterator it =
map.GetIterator();
EXPECT(it.Next() == nullptr);
it.Reset();
+1 -2
View File
@@ -77,8 +77,7 @@ FreeList::FreeList() : mutex_() {
Reset();
}
FreeList::~FreeList() {
}
FreeList::~FreeList() {}
uword FreeList::TryAllocate(intptr_t size, bool is_protected) {
MutexLocker ml(&mutex_);
+4 -1
View File
@@ -30,12 +30,15 @@ bool GCLinkedLists::IsEmpty() {
#undef FOREACH
}
// clang-format off
void GCLinkedLists::FlushInto(GCLinkedLists* to) {
#define FOREACH(type, var) var.FlushInto(&to->var);
GC_LINKED_LIST(FOREACH)
GC_LINKED_LIST(FOREACH)
#undef FOREACH
}
// clang-format on
Heap::Space SpaceForExternal(FinalizerEntryPtr raw_entry) {
// As with WeakTables, Smis are "old".
return raw_entry->untag()->value()->IsImmediateOrOldObject() ? Heap::kOld
+2 -1
View File
@@ -781,7 +781,8 @@ bool Heap::VerifyGC(const char* msg, MarkExpectation mark_expectation) {
void Heap::PrintSizes() const {
OS::PrintErr(
"New space (%" Pd "k of %" Pd "k) "
"New space (%" Pd "k of %" Pd
"k) "
"Old space (%" Pd "k of %" Pd "k)\n",
(UsedInWords(kNew) / KBInWords), (CapacityInWords(kNew) / KBInWords),
(UsedInWords(kOld) / KBInWords), (CapacityInWords(kOld) / KBInWords));
+5 -15
View File
@@ -176,20 +176,14 @@ class Page {
void VisitRememberedCards(ObjectPointerVisitor* visitor);
void ResetProgressBar();
Thread* owner() const {
return owner_;
}
Thread* owner() const { return owner_; }
// Remember the limit to which objects have been copied.
void RecordSurvivors() {
survivor_end_ = object_end();
}
void RecordSurvivors() { survivor_end_ = object_end(); }
// Move survivor end to the end of the to_ space, making all surviving
// objects candidates for promotion next time.
void EarlyTenure() {
survivor_end_ = end_;
}
void EarlyTenure() { survivor_end_ = end_; }
uword promo_candidate_words() const {
return (survivor_end_ - object_start()) / kWordSize;
@@ -250,12 +244,8 @@ class Page {
top_ -= size;
}
bool IsSurvivor(uword raw_addr) const {
return raw_addr < survivor_end_;
}
bool IsResolved() const {
return top_ == resolved_top_;
}
bool IsSurvivor(uword raw_addr) const { return raw_addr < survivor_end_; }
bool IsResolved() const { return top_ == resolved_top_; }
private:
void RememberCard(uword slot) {
+2 -6
View File
@@ -345,12 +345,8 @@ class ScavengerVisitorBase : public ObjectPointerVisitor {
}
}
Page* head() const {
return head_;
}
Page* tail() const {
return tail_;
}
Page* head() const { return head_; }
Page* tail() const { return tail_; }
static bool ForwardOrSetNullIfCollected(ObjectPtr parent,
CompressedObjectPtr* ptr_address);
+1 -3
View File
@@ -234,9 +234,7 @@ class Scavenger {
return max_pool_size > 0 ? max_pool_size : 1;
}
Page* head() const {
return to_->head();
}
Page* head() const { return to_->head(); }
void Prune(MarkingStackBlock** from, MarkingStack* to);
void Forward(MarkingStack* stack);
+2
View File
@@ -955,6 +955,7 @@ intptr_t ImageWriter::AlignWithBreakInstructions(intptr_t alignment,
remaining -= compiler::target::kWordSize) {
bytes_written += WriteTargetWord(kBreakInstructionFiller);
}
// clang-format off
#if defined(TARGET_ARCH_ARM)
// All instructions are 4 bytes long on ARM architectures, so on 32-bit ARM
// there won't be any padding.
@@ -973,6 +974,7 @@ intptr_t ImageWriter::AlignWithBreakInstructions(intptr_t alignment,
#else
#error Unexpected architecture.
#endif
// clang-format on
ASSERT_EQUAL(bytes_written, Utils::RoundUp(offset, alignment) - offset);
return bytes_written;
}
+1 -3
View File
@@ -548,9 +548,7 @@ class ImageWriter : public ValueObject {
#endif
uint8_t flags;
bool is_object() const {
return IsObjectField::decode(flags);
}
bool is_object() const { return IsObjectField::decode(flags); }
bool is_original_object() const {
return IsOriginalObjectField::decode(flags);
}
+2 -2
View File
@@ -79,10 +79,10 @@ intptr_t TypeTestingStubCallPattern::GetSubtypeTestCachePoolIndex() {
0xe8, -1, -1, -1, -1, // callq [PC + <offset>]
};
static int16_t pattern_disp8[] = {
0x4d, 0x8b, 0x4f, -1, // movq R9, [PP + offset]
0x4d, 0x8b, 0x4f, -1, // movq R9, [PP + offset]
};
static int16_t pattern_disp32[] = {
0x4d, 0x8b, 0x8f, -1, -1, -1, -1, // movq R9, [PP + offset]
0x4d, 0x8b, 0x8f, -1, -1, -1, -1, // movq R9, [PP + offset]
};
uword pc = pc_;
+2 -6
View File
@@ -488,18 +488,14 @@ class IsolateGroup : public IntrusiveDListEntry<IsolateGroup> {
// Class table for the program loaded into this isolate group.
//
// This table is modified by kernel loading.
ClassTable* class_table() const {
return class_table_;
}
ClassTable* class_table() const { return class_table_; }
// Class table used for heap walks by GC visitors. Usually it
// is the same table as one in |class_table_|, except when in the
// middle of the reload.
//
// See comment for |ClassTable| class for more details.
ClassTable* heap_walk_class_table() const {
return heap_walk_class_table_;
}
ClassTable* heap_walk_class_table() const { return heap_walk_class_table_; }
void CloneClassTableForReload();
void RestoreOriginalClassTable();
+5 -6
View File
@@ -828,7 +828,7 @@ bool IsolateGroupReloadContext::Reload(bool force_reload,
if (FLAG_gc_during_reload) {
// We force the GC to compact, which is more likely to discover untracked
// pointers (and other issues, like incorrect class table).
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/ true);
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/true);
}
// Clone the class table.
@@ -840,7 +840,7 @@ bool IsolateGroupReloadContext::Reload(bool force_reload,
if (FLAG_gc_during_reload) {
// We force the GC to compact, which is more likely to discover untracked
// pointers (and other issues, like incorrect class table).
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/ true);
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/true);
}
// We synchronously load the hot-reload kernel diff (which includes changed
@@ -869,7 +869,7 @@ bool IsolateGroupReloadContext::Reload(bool force_reload,
if (FLAG_gc_during_reload) {
// We force the GC to compact, which is more likely to discover untracked
// pointers (and other issues, like incorrect class table).
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/ true);
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/true);
}
// If we use the CFE and performed a compilation, we need to notify that
@@ -902,7 +902,7 @@ bool IsolateGroupReloadContext::Reload(bool force_reload,
if (FLAG_gc_during_reload) {
// We force the GC to compact, which is more likely to discover
// untracked pointers (and other issues, like incorrect class table).
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/ true);
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/true);
}
const intptr_t count = locator.count();
if (count > 0) {
@@ -940,7 +940,7 @@ bool IsolateGroupReloadContext::Reload(bool force_reload,
if (FLAG_gc_during_reload) {
// We force the GC to compact, which is more likely to discover
// untracked pointers (and other issues, like incorrect class table).
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/ true);
heap->CollectAllGarbage(GCReason::kDebugging, /*compact=*/true);
}
}
if (FLAG_identity_reload) {
@@ -1576,7 +1576,6 @@ void ProgramReloadContext::CheckpointLibraries() {
object_store()->set_root_library(Library::Handle());
}
void ProgramReloadContext::RollbackLibraries() {
TIR_Print("---- ROLLING BACK LIBRARY CHANGES\n");
Thread* thread = Thread::Current();
-1
View File
@@ -15,7 +15,6 @@
#include "vm/parser.h" // For Parser::kParameter* constants.
#include "vm/stack_frame.h"
namespace dart {
namespace kernel {
+2 -1
View File
@@ -73,7 +73,8 @@ class Program {
intptr_t buffer_length,
const char** error = nullptr);
static std::unique_ptr<Program> ReadFromTypedData(
const ExternalTypedData& typed_data, const char** error = nullptr);
const ExternalTypedData& typed_data,
const char** error = nullptr);
bool is_single_program() { return single_program_; }
NameIndex main_method() { return main_method_reference_; }
+4 -2
View File
@@ -180,7 +180,8 @@ std::unique_ptr<Program> Program::ReadFrom(Reader* reader, const char** error) {
}
std::unique_ptr<Program> Program::ReadFromFile(
const char* script_uri, const char** error /* = nullptr */) {
const char* script_uri,
const char** error /* = nullptr */) {
Thread* thread = Thread::Current();
auto isolate_group = thread->isolate_group();
if (script_uri == nullptr) {
@@ -222,7 +223,8 @@ std::unique_ptr<Program> Program::ReadFromBuffer(const uint8_t* buffer,
}
std::unique_ptr<Program> Program::ReadFromTypedData(
const ExternalTypedData& typed_data, const char** error) {
const ExternalTypedData& typed_data,
const char** error) {
kernel::Reader reader(typed_data);
return kernel::Program::ReadFrom(&reader, error);
}
+1 -3
View File
@@ -501,9 +501,7 @@ class Reader : public ValueObject {
friend class AlternativeReadingScope;
Reader(const uint8_t* buffer, intptr_t size)
: thread_(nullptr),
raw_buffer_(buffer),
size_(size) {}
: thread_(nullptr), raw_buffer_(buffer), size_(size) {}
void Init() {
ASSERT(typed_data_->IsExternalOrExternalView());
+2 -6
View File
@@ -112,12 +112,8 @@ class KernelIsolate : public AllStatic {
static Dart_IsolateGroupCreateCallback create_group_callback_;
static Monitor* monitor_;
enum State {
kNotStarted,
kStopped,
kStarting,
kStarted,
kStopping,
enum State{
kNotStarted, kStopped, kStarting, kStarted, kStopping,
};
static State state_;
static Isolate* isolate_;
+1 -1
View File
@@ -256,7 +256,7 @@ class MessageHandler {
bool paused_for_messages_;
PortSet<PortSetEntry>
ports_; // Only accessed by [PortMap], protected by [PortMap]s lock.
intptr_t paused_; // The number of pause messages received.
intptr_t paused_; // The number of pause messages received.
#if !defined(PRODUCT)
bool should_pause_on_start_;
bool should_pause_on_exit_;

Some files were not shown because too many files have changed in this diff Show More