mirror of
https://github.com/dart-lang/sdk
synced 2024-09-06 00:59:09 +00:00
Fix app snapshots on IA32 Windows.
The file size is not rounded up after the isolate snapshot if there are no rodata/instruction pieces. The other OS's use mmap instead of read, which is apparently okay with over-reading the file. Fixes #27786 R=asiva@google.com Review URL: https://codereview.chromium.org/2521883002 .
This commit is contained in:
parent
6c45f24fa6
commit
f62713e97c
|
@ -1240,14 +1240,23 @@ static bool ReadAppSnapshotBlobs(const char* script_name,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t vmisolate_size = header[1];
|
||||||
int64_t vmisolate_position =
|
int64_t vmisolate_position =
|
||||||
Utils::RoundUp(file->Position(), kAppSnapshotPageSize);
|
Utils::RoundUp(file->Position(), kAppSnapshotPageSize);
|
||||||
|
int64_t isolate_size = header[2];
|
||||||
int64_t isolate_position =
|
int64_t isolate_position =
|
||||||
Utils::RoundUp(vmisolate_position + header[1], kAppSnapshotPageSize);
|
Utils::RoundUp(vmisolate_position + vmisolate_size, kAppSnapshotPageSize);
|
||||||
int64_t rodata_position =
|
int64_t rodata_size = header[3];
|
||||||
Utils::RoundUp(isolate_position + header[2], kAppSnapshotPageSize);
|
int64_t rodata_position = isolate_position + isolate_size;
|
||||||
int64_t instructions_position =
|
if (rodata_size != 0) {
|
||||||
Utils::RoundUp(rodata_position + header[3], kAppSnapshotPageSize);
|
rodata_position = Utils::RoundUp(rodata_position, kAppSnapshotPageSize);
|
||||||
|
}
|
||||||
|
int64_t instructions_size = header[4];
|
||||||
|
int64_t instructions_position = rodata_position + rodata_size;
|
||||||
|
if (instructions_size != 0) {
|
||||||
|
instructions_position =
|
||||||
|
Utils::RoundUp(instructions_position, kAppSnapshotPageSize);
|
||||||
|
}
|
||||||
|
|
||||||
void* read_only_buffer =
|
void* read_only_buffer =
|
||||||
file->Map(File::kReadOnly, vmisolate_position,
|
file->Map(File::kReadOnly, vmisolate_position,
|
||||||
|
@ -1261,14 +1270,14 @@ static bool ReadAppSnapshotBlobs(const char* script_name,
|
||||||
(vmisolate_position - vmisolate_position);
|
(vmisolate_position - vmisolate_position);
|
||||||
*isolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
|
*isolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
|
||||||
(isolate_position - vmisolate_position);
|
(isolate_position - vmisolate_position);
|
||||||
if (header[3] == 0) {
|
if (rodata_size == 0) {
|
||||||
*rodata_buffer = NULL;
|
*rodata_buffer = NULL;
|
||||||
} else {
|
} else {
|
||||||
*rodata_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
|
*rodata_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
|
||||||
(rodata_position - vmisolate_position);
|
(rodata_position - vmisolate_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header[4] == 0) {
|
if (instructions_size == 0) {
|
||||||
*instructions_buffer = NULL;
|
*instructions_buffer = NULL;
|
||||||
} else {
|
} else {
|
||||||
*instructions_buffer = reinterpret_cast<const uint8_t*>(
|
*instructions_buffer = reinterpret_cast<const uint8_t*>(
|
||||||
|
|
|
@ -17,9 +17,6 @@ sample_extension: Crash # Unable to compile UnsupportedError.message.
|
||||||
[ $compiler == dart2analyzer ]
|
[ $compiler == dart2analyzer ]
|
||||||
build_dart: Skip
|
build_dart: Skip
|
||||||
|
|
||||||
[ $arch == ia32 && $system == windows ]
|
|
||||||
sample_extension/test/sample_extension_app_snapshot_test: RuntimeError # Issue 27786
|
|
||||||
|
|
||||||
[ $arch == arm ]
|
[ $arch == arm ]
|
||||||
sample_extension/test/*: Skip # Issue 14705
|
sample_extension/test/*: Skip # Issue 14705
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue