[vm] Reduce frame size for the functions with the largest frame sizes.
Cf. -Wframe-larger-than. Change-Id: I47e3144bdf7f8fd8c6f308d5552a7ce4f3f990ec Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128008 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
3678a3bd42
commit
7679924ece
@@ -421,7 +421,7 @@ bool File::Copy(Namespace* namespc,
|
||||
// where sendfile() fails with EINVAL or ENOSYS.
|
||||
if ((result < 0) && ((errno == EINVAL) || (errno == ENOSYS))) {
|
||||
const intptr_t kBufferSize = 8 * KB;
|
||||
uint8_t buffer[kBufferSize];
|
||||
uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(kBufferSize));
|
||||
while ((result = TEMP_FAILURE_RETRY(read(old_fd, buffer, kBufferSize))) >
|
||||
0) {
|
||||
int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result));
|
||||
@@ -430,6 +430,7 @@ bool File::Copy(Namespace* namespc,
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
int e = errno;
|
||||
close(old_fd);
|
||||
|
||||
@@ -412,7 +412,7 @@ bool File::Copy(Namespace* namespc,
|
||||
// TODO(ZX-429): Use sendfile/copyfile or equivalent when there is one.
|
||||
intptr_t result;
|
||||
const intptr_t kBufferSize = 8 * KB;
|
||||
uint8_t buffer[kBufferSize];
|
||||
uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(kBufferSize));
|
||||
while ((result = NO_RETRY_EXPECTED(read(old_fd, buffer, kBufferSize))) > 0) {
|
||||
int wrote = NO_RETRY_EXPECTED(write(new_fd, buffer, result));
|
||||
if (wrote != result) {
|
||||
@@ -420,6 +420,7 @@ bool File::Copy(Namespace* namespc,
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(buffer);
|
||||
FDUtils::SaveErrorAndClose(old_fd);
|
||||
FDUtils::SaveErrorAndClose(new_fd);
|
||||
if (result < 0) {
|
||||
|
||||
@@ -419,7 +419,7 @@ bool File::Copy(Namespace* namespc,
|
||||
// where sendfile() fails with EINVAL or ENOSYS.
|
||||
if ((result < 0) && ((errno == EINVAL) || (errno == ENOSYS))) {
|
||||
const intptr_t kBufferSize = 8 * KB;
|
||||
uint8_t buffer[kBufferSize];
|
||||
uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(kBufferSize));
|
||||
while ((result = TEMP_FAILURE_RETRY(read(old_fd, buffer, kBufferSize))) >
|
||||
0) {
|
||||
int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result));
|
||||
@@ -428,6 +428,7 @@ bool File::Copy(Namespace* namespc,
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
int e = errno;
|
||||
close(old_fd);
|
||||
|
||||
+2
-1
@@ -29,7 +29,7 @@ void Decompress(const uint8_t* input,
|
||||
}
|
||||
*output = reinterpret_cast<uint8_t*>(malloc(output_capacity));
|
||||
|
||||
uint8_t chunk_out[kChunkSize];
|
||||
uint8_t* chunk_out = reinterpret_cast<uint8_t*>(malloc(kChunkSize));
|
||||
z_stream strm;
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
@@ -80,6 +80,7 @@ void Decompress(const uint8_t* input,
|
||||
inflateEnd(&strm);
|
||||
|
||||
*output_length = output_cursor;
|
||||
free(chunk_out);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
|
||||
@@ -226,15 +226,16 @@ uint32_t ImageWriter::GetDataOffsetFor(RawObject* raw_object) {
|
||||
|
||||
#if defined(DART_PRECOMPILER)
|
||||
void ImageWriter::DumpInstructionStats() {
|
||||
CombinedCodeStatistics instruction_stats;
|
||||
std::unique_ptr<CombinedCodeStatistics> instruction_stats(
|
||||
new CombinedCodeStatistics());
|
||||
for (intptr_t i = 0; i < instructions_.length(); i++) {
|
||||
auto& data = instructions_[i];
|
||||
CodeStatistics* stats = data.insns_->stats();
|
||||
if (stats != nullptr) {
|
||||
stats->AppendTo(&instruction_stats);
|
||||
stats->AppendTo(instruction_stats.get());
|
||||
}
|
||||
}
|
||||
instruction_stats.DumpStatistics();
|
||||
instruction_stats->DumpStatistics();
|
||||
}
|
||||
|
||||
void ImageWriter::DumpInstructionsSizes() {
|
||||
|
||||
@@ -992,6 +992,7 @@ class ProfileBuilder : public ValueObject {
|
||||
null_code_(Code::null()),
|
||||
null_function_(Function::ZoneHandle()),
|
||||
inclusive_tree_(false),
|
||||
inlined_functions_cache_(new ProfileCodeInlinedFunctionsCache()),
|
||||
samples_(NULL),
|
||||
info_kind_(kNone) {
|
||||
ASSERT((sample_buffer_ == Profiler::sample_buffer()) ||
|
||||
@@ -1205,9 +1206,9 @@ class ProfileBuilder : public ValueObject {
|
||||
Code& code = Code::ZoneHandle();
|
||||
if (profile_code->code().IsCode()) {
|
||||
code ^= profile_code->code().raw();
|
||||
inlined_functions_cache_.Get(pc, code, sample, frame_index,
|
||||
&inlined_functions, &inlined_token_positions,
|
||||
&token_position);
|
||||
inlined_functions_cache_->Get(pc, code, sample, frame_index,
|
||||
&inlined_functions,
|
||||
&inlined_token_positions, &token_position);
|
||||
if (FLAG_trace_profiler_verbose && (inlined_functions != NULL)) {
|
||||
for (intptr_t i = 0; i < inlined_functions->length(); i++) {
|
||||
const String& name =
|
||||
@@ -1512,7 +1513,7 @@ class ProfileBuilder : public ValueObject {
|
||||
const AbstractCode null_code_;
|
||||
const Function& null_function_;
|
||||
bool inclusive_tree_;
|
||||
ProfileCodeInlinedFunctionsCache inlined_functions_cache_;
|
||||
ProfileCodeInlinedFunctionsCache* inlined_functions_cache_;
|
||||
ProcessedSampleBuffer* samples_;
|
||||
ProfileInfoKind info_kind_;
|
||||
}; // ProfileBuilder.
|
||||
@@ -1735,7 +1736,7 @@ void Profile::PrintCodeFrameIndexJSON(JSONArray* stack,
|
||||
|
||||
void Profile::PrintSamplesJSON(JSONObject* obj, bool code_samples) {
|
||||
JSONArray samples(obj, "samples");
|
||||
ProfileCodeInlinedFunctionsCache cache;
|
||||
auto* cache = new ProfileCodeInlinedFunctionsCache();
|
||||
for (intptr_t sample_index = 0; sample_index < samples_->length();
|
||||
sample_index++) {
|
||||
JSONObject sample_obj(&samples);
|
||||
@@ -1765,7 +1766,7 @@ void Profile::PrintSamplesJSON(JSONObject* obj, bool code_samples) {
|
||||
for (intptr_t frame_index = 0; frame_index < sample->length();
|
||||
frame_index++) {
|
||||
ASSERT(sample->At(frame_index) != 0);
|
||||
ProcessSampleFrameJSON(&stack, &cache, sample, frame_index);
|
||||
ProcessSampleFrameJSON(&stack, cache, sample, frame_index);
|
||||
}
|
||||
}
|
||||
if (code_samples) {
|
||||
|
||||
@@ -53,7 +53,7 @@ class ProfileFunctionSourcePosition {
|
||||
DISALLOW_ALLOCATION();
|
||||
};
|
||||
|
||||
class ProfileCodeInlinedFunctionsCache : public ValueObject {
|
||||
class ProfileCodeInlinedFunctionsCache : public ZoneAllocated {
|
||||
public:
|
||||
ProfileCodeInlinedFunctionsCache() : cache_cursor_(0), last_hit_(0) {
|
||||
for (intptr_t i = 0; i < kCacheSize; i++) {
|
||||
|
||||
@@ -467,7 +467,10 @@ struct is_double<double> {
|
||||
class AssemblerTest {
|
||||
public:
|
||||
AssemblerTest(const char* name, compiler::Assembler* assembler)
|
||||
: name_(name), assembler_(assembler), code_(Code::ZoneHandle()) {
|
||||
: name_(name),
|
||||
assembler_(assembler),
|
||||
code_(Code::ZoneHandle()),
|
||||
disassembly_(Thread::Current()->zone()->Alloc<char>(DISASSEMBLY_SIZE)) {
|
||||
ASSERT(name != NULL);
|
||||
ASSERT(assembler != NULL);
|
||||
}
|
||||
@@ -574,7 +577,7 @@ class AssemblerTest {
|
||||
compiler::Assembler* assembler_;
|
||||
Code& code_;
|
||||
static const intptr_t DISASSEMBLY_SIZE = 10240;
|
||||
char disassembly_[DISASSEMBLY_SIZE];
|
||||
char* disassembly_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AssemblerTest);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user