| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/clustered_snapshot.h" | 5 #include "vm/clustered_snapshot.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 5015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5026 | 5026 |
| 5027 const char* expected_features = Dart::FeaturesString(isolate, kind_); | 5027 const char* expected_features = Dart::FeaturesString(isolate, kind_); |
| 5028 ASSERT(expected_features != NULL); | 5028 ASSERT(expected_features != NULL); |
| 5029 const intptr_t expected_len = strlen(expected_features); | 5029 const intptr_t expected_len = strlen(expected_features); |
| 5030 | 5030 |
| 5031 const char* features = reinterpret_cast<const char*>(CurrentBufferAddress()); | 5031 const char* features = reinterpret_cast<const char*>(CurrentBufferAddress()); |
| 5032 ASSERT(features != NULL); | 5032 ASSERT(features != NULL); |
| 5033 intptr_t buffer_len = OS::StrNLen(features, PendingBytes()); | 5033 intptr_t buffer_len = OS::StrNLen(features, PendingBytes()); |
| 5034 if ((buffer_len != expected_len) || | 5034 if ((buffer_len != expected_len) || |
| 5035 strncmp(features, expected_features, expected_len)) { | 5035 strncmp(features, expected_features, expected_len)) { |
| 5036 const intptr_t kMessageBufferSize = 256; | 5036 const intptr_t kMessageBufferSize = 1024; |
| 5037 char message_buffer[kMessageBufferSize]; | 5037 char message_buffer[kMessageBufferSize]; |
| 5038 char* actual_features = | 5038 char* actual_features = |
| 5039 OS::StrNDup(features, buffer_len < 128 ? buffer_len : 128); | 5039 OS::StrNDup(features, buffer_len < 128 ? buffer_len : 128); |
| 5040 OS::SNPrint(message_buffer, kMessageBufferSize, | 5040 OS::SNPrint(message_buffer, kMessageBufferSize, |
| 5041 "Snapshot not compatible with the current VM configuration: " | 5041 "Snapshot not compatible with the current VM configuration: " |
| 5042 "the snapshot requires '%s' but the VM has '%s'", | 5042 "the snapshot requires '%s' but the VM has '%s'", |
| 5043 actual_features, expected_features); | 5043 actual_features, expected_features); |
| 5044 free(const_cast<char*>(expected_features)); | 5044 free(const_cast<char*>(expected_features)); |
| 5045 free(actual_features); | 5045 free(actual_features); |
| 5046 // This can also fail while bringing up the VM isolate, so make sure to | 5046 // This can also fail while bringing up the VM isolate, so make sure to |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5514 thread_->isolate()->SetupImagePage(data_buffer_, | 5514 thread_->isolate()->SetupImagePage(data_buffer_, |
| 5515 /* is_executable */ false); | 5515 /* is_executable */ false); |
| 5516 } | 5516 } |
| 5517 | 5517 |
| 5518 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); | 5518 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
| 5519 | 5519 |
| 5520 return ApiError::null(); | 5520 return ApiError::null(); |
| 5521 } | 5521 } |
| 5522 | 5522 |
| 5523 } // namespace dart | 5523 } // namespace dart |
| OLD | NEW |