mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:20:36 +00:00
[vm] Cleanup some workaround due to native extensions (which got removed)
Now that support for native extensions (aka dart-ext:*) has been removed, the kernel loader is guaranteed not to call out to embedder anymore (it did so before for loading shared libraries). This allos us to clean up some code as well as extend the scope of our NoActiveIsolateScope. TEST=ci Change-Id: I5c8c9ee47298fdd316583ba3aed74772c1c7783f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212296 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
74b118d37f
commit
9615af4635
|
@ -112,8 +112,11 @@ void allEventsHaveIsolateNumber(List events) {
|
|||
expect(arguments, isA<Map>());
|
||||
expect(arguments['isolateGroupId'], isA<String>());
|
||||
if (!const ['GC', 'Compiler', 'CompilerVerbose'].contains(event['cat']) &&
|
||||
!const ['FinishTopLevelClassLoading', 'FinishClassLoading']
|
||||
.contains(event['name'])) {
|
||||
!const [
|
||||
'FinishTopLevelClassLoading',
|
||||
'FinishClassLoading',
|
||||
'ProcessPendingClasses'
|
||||
].contains(event['name'])) {
|
||||
expect(arguments['isolateId'], isA<String>());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,8 +112,11 @@ void allEventsHaveIsolateNumber(List events) {
|
|||
expect(arguments, isA<Map>());
|
||||
expect(arguments['isolateGroupId'], isA<String>());
|
||||
if (!const ['GC', 'Compiler', 'CompilerVerbose'].contains(event['cat']) &&
|
||||
!const ['FinishTopLevelClassLoading', 'FinishClassLoading']
|
||||
.contains(event['name'])) {
|
||||
!const [
|
||||
'FinishTopLevelClassLoading',
|
||||
'FinishClassLoading',
|
||||
'ProcessPendingClasses'
|
||||
].contains(event['name'])) {
|
||||
expect(arguments['isolateId'], isA<String>());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1774,31 +1774,10 @@ class NoActiveIsolateScope : public StackResource {
|
|||
}
|
||||
|
||||
private:
|
||||
friend class DisabledNoActiveIsolateScope;
|
||||
Thread* thread_;
|
||||
Isolate* saved_isolate_;
|
||||
};
|
||||
|
||||
// Can be used inside a [NoActiveIsolateScope] to set the current isolate.
|
||||
class DisabledNoActiveIsolateScope : public StackResource {
|
||||
public:
|
||||
explicit DisabledNoActiveIsolateScope(NoActiveIsolateScope* scope)
|
||||
: StackResource(Thread::Current()),
|
||||
thread_(static_cast<Thread*>(thread())),
|
||||
scope_(scope) {
|
||||
ASSERT(thread_->isolate() == nullptr);
|
||||
thread_->isolate_ = scope_->saved_isolate_;
|
||||
}
|
||||
~DisabledNoActiveIsolateScope() {
|
||||
ASSERT(thread_->isolate_ == scope_->saved_isolate_);
|
||||
thread_->isolate_ = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
Thread* thread_;
|
||||
NoActiveIsolateScope* scope_;
|
||||
};
|
||||
|
||||
} // namespace dart
|
||||
|
||||
#endif // RUNTIME_VM_ISOLATE_H_
|
||||
|
|
|
@ -189,7 +189,7 @@ KernelLoader::KernelLoader(Program* program,
|
|||
: program_(program),
|
||||
thread_(Thread::Current()),
|
||||
zone_(thread_->zone()),
|
||||
isolate_(thread_->isolate()),
|
||||
no_active_isolate_scope_(),
|
||||
patch_classes_(Array::ZoneHandle(zone_)),
|
||||
active_class_(),
|
||||
library_kernel_offset_(-1), // Set to the correct value in LoadLibrary
|
||||
|
@ -462,7 +462,7 @@ KernelLoader::KernelLoader(const Script& script,
|
|||
: program_(NULL),
|
||||
thread_(Thread::Current()),
|
||||
zone_(thread_->zone()),
|
||||
isolate_(thread_->isolate()),
|
||||
no_active_isolate_scope_(),
|
||||
patch_classes_(Array::ZoneHandle(zone_)),
|
||||
library_kernel_offset_(data_program_offset),
|
||||
kernel_binary_version_(kernel_binary_version),
|
||||
|
@ -646,8 +646,6 @@ ObjectPtr KernelLoader::LoadProgram(bool process_pending_classes) {
|
|||
}
|
||||
|
||||
void KernelLoader::LoadLibrary(const Library& library) {
|
||||
NoActiveIsolateScope no_active_isolate_scope;
|
||||
|
||||
// This will be invoked by VM bootstrapping code.
|
||||
SafepointWriteRwLocker ml(thread_, thread_->isolate_group()->program_lock());
|
||||
|
||||
|
@ -874,8 +872,6 @@ LibraryPtr KernelLoader::LoadLibrary(intptr_t index) {
|
|||
"not allowed");
|
||||
}
|
||||
|
||||
NoActiveIsolateScope no_active_isolate_scope;
|
||||
|
||||
// Read library index.
|
||||
library_kernel_offset_ = library_offset(index);
|
||||
correction_offset_ = library_kernel_offset_;
|
||||
|
@ -1690,8 +1686,6 @@ void KernelLoader::FinishClassLoading(const Class& klass,
|
|||
}
|
||||
|
||||
void KernelLoader::FinishLoading(const Class& klass) {
|
||||
NoActiveIsolateScope no_active_isolate_scope;
|
||||
|
||||
ASSERT(klass.IsTopLevel() || (klass.kernel_offset() > 0));
|
||||
|
||||
Zone* zone = Thread::Current()->zone();
|
||||
|
|
|
@ -375,7 +375,7 @@ class KernelLoader : public ValueObject {
|
|||
|
||||
Thread* thread_;
|
||||
Zone* zone_;
|
||||
Isolate* isolate_;
|
||||
NoActiveIsolateScope no_active_isolate_scope_;
|
||||
Array& patch_classes_;
|
||||
ActiveClass active_class_;
|
||||
// This is the offset of the current library within
|
||||
|
|
|
@ -13639,11 +13639,13 @@ static ObjectPtr EvaluateCompiledExpressionHelper(
|
|||
zone, String::New("Kernel isolate returned ill-formed kernel.")));
|
||||
}
|
||||
|
||||
kernel::KernelLoader loader(kernel_pgm.get(),
|
||||
/*uri_to_source_table=*/nullptr);
|
||||
auto& result = Object::Handle(
|
||||
zone, loader.LoadExpressionEvaluationFunction(library_url, klass));
|
||||
kernel_pgm.reset();
|
||||
auto& result = Object::Handle(zone);
|
||||
{
|
||||
kernel::KernelLoader loader(kernel_pgm.get(),
|
||||
/*uri_to_source_table=*/nullptr);
|
||||
result = loader.LoadExpressionEvaluationFunction(library_url, klass);
|
||||
kernel_pgm.reset();
|
||||
}
|
||||
|
||||
if (result.IsError()) return result.ptr();
|
||||
|
||||
|
|
Loading…
Reference in a new issue