mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
[vm] Fix gcc build.
Change-Id: I6634dc10fdc8d7523562c0fcc20e3561eb580acf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146023 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Aprelev <aam@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
767e78cb4d
commit
14dfa1b9ee
|
@ -538,6 +538,9 @@ if (is_win) {
|
||||||
|
|
||||||
if (is_clang) {
|
if (is_clang) {
|
||||||
default_warning_flags += [ "-Wno-tautological-constant-compare" ]
|
default_warning_flags += [ "-Wno-tautological-constant-compare" ]
|
||||||
|
} else {
|
||||||
|
default_warning_flags +=
|
||||||
|
[ "-Wno-ignored-qualifiers" ] # Warnings in BoringSSL headers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
|
|
|
@ -453,7 +453,7 @@ bool AsyncDirectoryListing::AddFileSystemEntityToResponse(Response type,
|
||||||
size_t len = strlen(arg);
|
size_t len = strlen(arg);
|
||||||
Dart_CObject* io_buffer = CObject::NewIOBuffer(len);
|
Dart_CObject* io_buffer = CObject::NewIOBuffer(len);
|
||||||
uint8_t* data = io_buffer->value.as_external_typed_data.data;
|
uint8_t* data = io_buffer->value.as_external_typed_data.data;
|
||||||
strncpy(reinterpret_cast<char*>(data), arg, len);
|
memmove(reinterpret_cast<char*>(data), arg, len);
|
||||||
|
|
||||||
CObjectExternalUint8Array* external_array =
|
CObjectExternalUint8Array* external_array =
|
||||||
new CObjectExternalUint8Array(io_buffer);
|
new CObjectExternalUint8Array(io_buffer);
|
||||||
|
|
|
@ -613,9 +613,8 @@ static inline void USE(T) {}
|
||||||
// type to another thus avoiding the warning.
|
// type to another thus avoiding the warning.
|
||||||
template <class D, class S>
|
template <class D, class S>
|
||||||
inline D bit_cast(const S& source) {
|
inline D bit_cast(const S& source) {
|
||||||
// Compile time assertion: sizeof(D) == sizeof(S). A compile error
|
static_assert(sizeof(D) == sizeof(S),
|
||||||
// here means your D and S have different sizes.
|
"Source and destination must have the same size");
|
||||||
DART_UNUSED typedef char VerifySizesAreEqual[sizeof(D) == sizeof(S) ? 1 : -1];
|
|
||||||
|
|
||||||
D destination;
|
D destination;
|
||||||
// This use of memcpy is safe: source and destination cannot overlap.
|
// This use of memcpy is safe: source and destination cannot overlap.
|
||||||
|
|
|
@ -178,7 +178,7 @@ namespace dart {
|
||||||
V(Object) \
|
V(Object) \
|
||||||
CLASS_LIST_NO_OBJECT(V)
|
CLASS_LIST_NO_OBJECT(V)
|
||||||
|
|
||||||
enum ClassId {
|
enum ClassId : intptr_t {
|
||||||
// Illegal class id.
|
// Illegal class id.
|
||||||
kIllegalCid = 0,
|
kIllegalCid = 0,
|
||||||
|
|
||||||
|
|
|
@ -121,11 +121,10 @@ void SerializationCluster::WriteAndMeasureAlloc(Serializer* serializer) {
|
||||||
intptr_t stop_data = serializer->GetDataSize();
|
intptr_t stop_data = serializer->GetDataSize();
|
||||||
intptr_t stop_objects = serializer->next_ref_index();
|
intptr_t stop_objects = serializer->next_ref_index();
|
||||||
if (FLAG_print_cluster_information) {
|
if (FLAG_print_cluster_information) {
|
||||||
const int hex_size = kWordSize * 2;
|
OS::PrintErr("Snapshot 0x%" Pp " (%" Pd "), ", start_size,
|
||||||
OS::PrintErr("Snapshot 0x%0*.*" Px " (%" Pd "), ", hex_size, hex_size,
|
stop_size - start_size);
|
||||||
start_size, stop_size - start_size);
|
OS::PrintErr("Data 0x%" Pp " (%" Pd "): ", start_data,
|
||||||
OS::PrintErr("Data 0x%0*.*" Px " (%" Pd "): ", hex_size, hex_size,
|
stop_data - start_data);
|
||||||
start_data, stop_data - start_data);
|
|
||||||
OS::PrintErr("Alloc %s (%" Pd ")\n", name(), stop_objects - start_objects);
|
OS::PrintErr("Alloc %s (%" Pd ")\n", name(), stop_objects - start_objects);
|
||||||
}
|
}
|
||||||
size_ += (stop_size - start_size) + (stop_data - start_data);
|
size_ += (stop_size - start_size) + (stop_data - start_data);
|
||||||
|
@ -137,9 +136,8 @@ void SerializationCluster::WriteAndMeasureFill(Serializer* serializer) {
|
||||||
WriteFill(serializer);
|
WriteFill(serializer);
|
||||||
intptr_t stop = serializer->bytes_written();
|
intptr_t stop = serializer->bytes_written();
|
||||||
if (FLAG_print_cluster_information) {
|
if (FLAG_print_cluster_information) {
|
||||||
const int hex_size = kWordSize * 2;
|
OS::PrintErr("Snapshot 0x%" Pp " (%" Pd "): Fill %s\n", start, stop - start,
|
||||||
OS::PrintErr("Snapshot 0x%0*.*" Px " (%" Pd "): Fill %s\n", hex_size,
|
name());
|
||||||
hex_size, start, stop - start, name());
|
|
||||||
}
|
}
|
||||||
size_ += (stop - start);
|
size_ += (stop - start);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2551,7 +2551,8 @@ ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSEMBLER_TEST_RUN(LoadObjectNull, test) {
|
ASSEMBLER_TEST_RUN(LoadObjectNull, test) {
|
||||||
EXPECT_EQ(Object::null(), test->InvokeWithCodeAndThread<ObjectPtr>());
|
EXPECT_EQ(static_cast<uword>(Object::null()),
|
||||||
|
test->InvokeWithCodeAndThread<uword>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// PushObject null.
|
// PushObject null.
|
||||||
|
@ -2566,7 +2567,8 @@ ASSEMBLER_TEST_GENERATE(PushObjectNull, assembler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSEMBLER_TEST_RUN(PushObjectNull, test) {
|
ASSEMBLER_TEST_RUN(PushObjectNull, test) {
|
||||||
EXPECT_EQ(Object::null(), test->InvokeWithCodeAndThread<ObjectPtr>());
|
EXPECT_EQ(static_cast<uword>(Object::null()),
|
||||||
|
test->InvokeWithCodeAndThread<uword>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// CompareObject null.
|
// CompareObject null.
|
||||||
|
@ -2584,7 +2586,8 @@ ASSEMBLER_TEST_GENERATE(CompareObjectNull, assembler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSEMBLER_TEST_RUN(CompareObjectNull, test) {
|
ASSEMBLER_TEST_RUN(CompareObjectNull, test) {
|
||||||
EXPECT_EQ(Bool::True().raw(), test->InvokeWithCodeAndThread<ObjectPtr>());
|
EXPECT_EQ(static_cast<uword>(Bool::True().raw()),
|
||||||
|
test->InvokeWithCodeAndThread<uword>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
|
ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
|
||||||
|
@ -2597,7 +2600,8 @@ ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSEMBLER_TEST_RUN(LoadObjectTrue, test) {
|
ASSEMBLER_TEST_RUN(LoadObjectTrue, test) {
|
||||||
EXPECT_EQ(Bool::True().raw(), test->InvokeWithCodeAndThread<ObjectPtr>());
|
EXPECT_EQ(static_cast<uword>(Bool::True().raw()),
|
||||||
|
test->InvokeWithCodeAndThread<uword>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
|
ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
|
||||||
|
@ -2610,7 +2614,8 @@ ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSEMBLER_TEST_RUN(LoadObjectFalse, test) {
|
ASSEMBLER_TEST_RUN(LoadObjectFalse, test) {
|
||||||
EXPECT_EQ(Bool::False().raw(), test->InvokeWithCodeAndThread<ObjectPtr>());
|
EXPECT_EQ(static_cast<uword>(Bool::False().raw()),
|
||||||
|
test->InvokeWithCodeAndThread<uword>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) {
|
ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) {
|
||||||
|
|
|
@ -3726,15 +3726,7 @@ class TemplateDartCall : public Definition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringPtr Selector() {
|
inline StringPtr Selector();
|
||||||
if (auto static_call = this->AsStaticCall()) {
|
|
||||||
return static_call->function().name();
|
|
||||||
} else if (auto instance_call = this->AsInstanceCall()) {
|
|
||||||
return instance_call->function_name().raw();
|
|
||||||
} else {
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool MayThrow() const { return true; }
|
virtual bool MayThrow() const { return true; }
|
||||||
virtual bool CanCallDart() const { return true; }
|
virtual bool CanCallDart() const { return true; }
|
||||||
|
@ -9196,6 +9188,17 @@ class FlowGraphVisitor : public ValueObject {
|
||||||
} \
|
} \
|
||||||
void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
|
void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
|
||||||
|
|
||||||
|
template <intptr_t kExtraInputs>
|
||||||
|
StringPtr TemplateDartCall<kExtraInputs>::Selector() {
|
||||||
|
if (auto static_call = this->AsStaticCall()) {
|
||||||
|
return static_call->function().name();
|
||||||
|
} else if (auto instance_call = this->AsInstanceCall()) {
|
||||||
|
return instance_call->function_name().raw();
|
||||||
|
} else {
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dart
|
} // namespace dart
|
||||||
|
|
||||||
#endif // RUNTIME_VM_COMPILER_BACKEND_IL_H_
|
#endif // RUNTIME_VM_COMPILER_BACKEND_IL_H_
|
||||||
|
|
|
@ -131,6 +131,7 @@ class ArgumentAllocator : public ValueObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
Register AllocateCpuRegister() {
|
Register AllocateCpuRegister() {
|
||||||
|
RELEASE_ASSERT(cpu_regs_used >= 0); // Avoids -Werror=array-bounds in GCC.
|
||||||
ASSERT(cpu_regs_used < CallingConventions::kNumArgRegs);
|
ASSERT(cpu_regs_used < CallingConventions::kNumArgRegs);
|
||||||
|
|
||||||
const auto result = CallingConventions::ArgumentRegisters[cpu_regs_used];
|
const auto result = CallingConventions::ArgumentRegisters[cpu_regs_used];
|
||||||
|
|
|
@ -305,6 +305,7 @@ DRegister NativeFpuRegistersLocation::fpu_as_d_reg() const {
|
||||||
case kSingleFpuReg:
|
case kSingleFpuReg:
|
||||||
return DRegisterOf(fpu_s_reg());
|
return DRegisterOf(fpu_s_reg());
|
||||||
}
|
}
|
||||||
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
SRegister NativeFpuRegistersLocation::fpu_as_s_reg() const {
|
SRegister NativeFpuRegistersLocation::fpu_as_s_reg() const {
|
||||||
|
@ -316,6 +317,7 @@ SRegister NativeFpuRegistersLocation::fpu_as_s_reg() const {
|
||||||
case kSingleFpuReg:
|
case kSingleFpuReg:
|
||||||
return fpu_s_reg();
|
return fpu_s_reg();
|
||||||
}
|
}
|
||||||
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NativeFpuRegistersLocation::IsLowestBits() const {
|
bool NativeFpuRegistersLocation::IsLowestBits() const {
|
||||||
|
|
|
@ -103,8 +103,9 @@ intptr_t NativeFundamentalType::AlignmentInBytesStack() const {
|
||||||
case kAlignedToValueSize:
|
case kAlignedToValueSize:
|
||||||
// iOS on arm64 only aligns to size.
|
// iOS on arm64 only aligns to size.
|
||||||
return SizeInBytes();
|
return SizeInBytes();
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t NativeFundamentalType::AlignmentInBytesField() const {
|
intptr_t NativeFundamentalType::AlignmentInBytesField() const {
|
||||||
|
@ -120,8 +121,9 @@ intptr_t NativeFundamentalType::AlignmentInBytesField() const {
|
||||||
}
|
}
|
||||||
return SizeInBytes();
|
return SizeInBytes();
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||||
|
|
|
@ -375,7 +375,7 @@ static uword GetInstanceSizeImpl(const dart::Class& handle) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FATAL3("Unsupported class for size translation: %s (id=%" Pd
|
FATAL3("Unsupported class for size translation: %s (id=%" Pd
|
||||||
", kNumPredefinedCids=%d)\n",
|
", kNumPredefinedCids=%" Pd ")\n",
|
||||||
handle.ToCString(), handle.id(), kNumPredefinedCids);
|
handle.ToCString(), handle.id(), kNumPredefinedCids);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3373,6 +3373,7 @@ TEST_CASE(DartAPI_WeakPersistentHandleExternalAllocationSize) {
|
||||||
weak2 = Dart_NewWeakPersistentHandle(obj, NULL, kWeak2ExternalSize,
|
weak2 = Dart_NewWeakPersistentHandle(obj, NULL, kWeak2ExternalSize,
|
||||||
NopCallback);
|
NopCallback);
|
||||||
EXPECT_VALID(AsHandle(strong_ref));
|
EXPECT_VALID(AsHandle(strong_ref));
|
||||||
|
EXPECT_VALID(AsHandle(weak2));
|
||||||
Dart_ExitScope();
|
Dart_ExitScope();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,12 +82,18 @@ void FieldTable::AllocateIndex(intptr_t index) {
|
||||||
void FieldTable::Grow(intptr_t new_capacity) {
|
void FieldTable::Grow(intptr_t new_capacity) {
|
||||||
ASSERT(new_capacity > capacity_);
|
ASSERT(new_capacity > capacity_);
|
||||||
|
|
||||||
|
auto old_table = table_;
|
||||||
auto new_table = static_cast<InstancePtr*>(
|
auto new_table = static_cast<InstancePtr*>(
|
||||||
malloc(new_capacity * sizeof(InstancePtr))); // NOLINT
|
malloc(new_capacity * sizeof(InstancePtr))); // NOLINT
|
||||||
memmove(new_table, table_, top_ * sizeof(InstancePtr));
|
intptr_t i;
|
||||||
memset(new_table + top_, 0, (new_capacity - top_) * sizeof(InstancePtr));
|
for (i = 0; i < top_; i++) {
|
||||||
|
new_table[i] = old_table[i];
|
||||||
|
}
|
||||||
|
for (; i < new_capacity; i++) {
|
||||||
|
new_table[i] = InstancePtr();
|
||||||
|
}
|
||||||
capacity_ = new_capacity;
|
capacity_ = new_capacity;
|
||||||
old_tables_->Add(table_);
|
old_tables_->Add(old_table);
|
||||||
// Ensure that new_table_ is populated before it is published
|
// Ensure that new_table_ is populated before it is published
|
||||||
// via store to table_.
|
// via store to table_.
|
||||||
std::atomic_thread_fence(std::memory_order_release);
|
std::atomic_thread_fence(std::memory_order_release);
|
||||||
|
|
|
@ -26,13 +26,6 @@ VM_UNIT_TEST_CASE(SNPrint) {
|
||||||
EXPECT_EQ(3, length);
|
EXPECT_EQ(3, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test is expected to crash when it runs.
|
|
||||||
VM_UNIT_TEST_CASE_WITH_EXPECTATION(SNPrint_BadArgs, "Crash") {
|
|
||||||
int width = kMaxInt32;
|
|
||||||
int num = 7;
|
|
||||||
Utils::SNPrint(NULL, 0, "%*d%*d", width, num, width, num);
|
|
||||||
}
|
|
||||||
|
|
||||||
VM_UNIT_TEST_CASE(OsFuncs) {
|
VM_UNIT_TEST_CASE(OsFuncs) {
|
||||||
EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment()));
|
EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment()));
|
||||||
int procs = OS::NumberOfAvailableProcessors();
|
int procs = OS::NumberOfAvailableProcessors();
|
||||||
|
|
|
@ -1132,12 +1132,13 @@ void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OS::PrintErr("version=%s\n", Version::String());
|
||||||
OSThread* os_thread = OSThread::Current();
|
OSThread* os_thread = OSThread::Current();
|
||||||
ASSERT(os_thread != NULL);
|
ASSERT(os_thread != NULL);
|
||||||
Isolate* isolate = Isolate::Current();
|
Isolate* isolate = Isolate::Current();
|
||||||
const char* name = isolate == NULL ? NULL : isolate->name();
|
const char* name = isolate == NULL ? "(nil)" : isolate->name();
|
||||||
OS::PrintErr("version=%s\npid=%" Pd ", thread=%" Pd ", isolate=%s(%p)\n",
|
OS::PrintErr("pid=%" Pd ", thread=%" Pd ", isolate=%s(%p)\n",
|
||||||
Version::String(), OS::ProcessId(),
|
static_cast<intptr_t>(OS::ProcessId()),
|
||||||
OSThread::ThreadIdToIntPtr(os_thread->trace_id()), name,
|
OSThread::ThreadIdToIntPtr(os_thread->trace_id()), name,
|
||||||
isolate);
|
isolate);
|
||||||
const IsolateGroupSource* source =
|
const IsolateGroupSource* source =
|
||||||
|
|
|
@ -345,10 +345,9 @@ void ProfileCode::SetName(const char* name) {
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
name_ = NULL;
|
name_ = NULL;
|
||||||
}
|
}
|
||||||
intptr_t len = strlen(name);
|
intptr_t len = strlen(name) + 1;
|
||||||
name_ = Thread::Current()->zone()->Alloc<char>(len + 1);
|
name_ = Thread::Current()->zone()->Alloc<char>(len);
|
||||||
strncpy(name_, name, len);
|
strncpy(name_, name, len);
|
||||||
name_[len] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileCode::GenerateAndSetSymbolName(const char* prefix) {
|
void ProfileCode::GenerateAndSetSymbolName(const char* prefix) {
|
||||||
|
|
|
@ -259,7 +259,7 @@ const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SmiPtr BaseReader::ReadAsSmi() {
|
SmiPtr BaseReader::ReadAsSmi() {
|
||||||
SmiPtr value = Read<SmiPtr>();
|
SmiPtr value = static_cast<SmiPtr>(Read<intptr_t>());
|
||||||
ASSERT((static_cast<uword>(value) & kSmiTagMask) == kSmiTag);
|
ASSERT((static_cast<uword>(value) & kSmiTagMask) == kSmiTag);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,10 +369,7 @@ static const char* MergePaths(const char* base_path, const char* ref_path) {
|
||||||
buffer[truncated_base_len] = '/';
|
buffer[truncated_base_len] = '/';
|
||||||
|
|
||||||
// Copy the ref_path.
|
// Copy the ref_path.
|
||||||
strncpy((buffer + truncated_base_len + 1), ref_path, ref_path_len);
|
strncpy((buffer + truncated_base_len + 1), ref_path, ref_path_len + 1);
|
||||||
|
|
||||||
// Add the trailing '\0'.
|
|
||||||
buffer[len] = '\0';
|
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ void V8SnapshotProfileWriter::SetObjectTypeAndName(ObjectId object_id,
|
||||||
info->name = EnsureString(name);
|
info->name = EnsureString(name);
|
||||||
} else {
|
} else {
|
||||||
info->name =
|
info->name =
|
||||||
EnsureString(OS::SCreate(zone_, "Unnamed [%s] %s", type, name));
|
EnsureString(OS::SCreate(zone_, "Unnamed [%s] %s", type, "(nil)"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue