mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
3ed8736bdd
The [ReloadOperationScope] has [StackResource]s as fields and is itself a [StackResource] which is problemantic if unwinding happens manually. So we'll make it a macro that expands to the 3 fields instead. TEST=ci Change-Id: I3fb7bec7ca87193c83ec34908f9a43c5db005900 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302201 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_VM_THREAD_STACK_RESOURCE_H_
|
|
#define RUNTIME_VM_THREAD_STACK_RESOURCE_H_
|
|
|
|
#include <type_traits>
|
|
#include <utility>
|
|
|
|
#include "vm/allocation.h"
|
|
#include "vm/globals.h"
|
|
|
|
namespace dart {
|
|
|
|
class Isolate;
|
|
class IsolateGroup;
|
|
class ThreadState;
|
|
class Thread;
|
|
|
|
class ThreadStackResource : public StackResource {
|
|
public:
|
|
explicit ThreadStackResource(Thread* T)
|
|
: StackResource(reinterpret_cast<ThreadState*>(T)) {}
|
|
|
|
~ThreadStackResource();
|
|
|
|
Thread* thread() const {
|
|
return reinterpret_cast<Thread*>(StackResource::thread());
|
|
}
|
|
Isolate* isolate() const;
|
|
IsolateGroup* isolate_group() const;
|
|
};
|
|
|
|
template <typename T, typename... Args>
|
|
class AsThreadStackResource : public ThreadStackResource {
|
|
public:
|
|
static_assert(!std::is_base_of<StackResource, T>::value);
|
|
AsThreadStackResource(Thread* thread, Args&&... args)
|
|
: ThreadStackResource(thread),
|
|
member_(thread, std::forward<Args>(args)...) {}
|
|
~AsThreadStackResource() {}
|
|
|
|
private:
|
|
T member_;
|
|
};
|
|
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_VM_THREAD_STACK_RESOURCE_H_
|