[vm] Remove hooks for the embedder to provide a task runner in lieu of the VM's thread pool.

This reverts commit dc3cf83bb6.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/44228
Change-Id: Ia8da6424fd4ebc67e0a2a50e37b1930b4aea5628
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231042
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2022-04-18 20:34:57 +00:00 committed by Commit Bot
parent 3d2562a961
commit da89828077
5 changed files with 1 additions and 94 deletions

View file

@ -849,7 +849,7 @@ typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)(void);
* The current version of the Dart_InitializeFlags. Should be incremented every
* time Dart_InitializeFlags changes in a binary incompatible way.
*/
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000006)
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000007)
/** Forward declaration */
struct Dart_CodeObserver;
@ -875,50 +875,6 @@ typedef struct Dart_CodeObserver {
Dart_OnNewCodeCallback on_new_code;
} Dart_CodeObserver;
typedef struct _Dart_Task* Dart_Task;
typedef enum {
Dart_TaskPriority_Default,
} Dart_TaskPriority;
typedef struct {
/**
* Placeholder.
*/
Dart_TaskPriority priority;
/**
* Time after which the task should run according to the clock of
* Dart_TimelineGetMicros.
*/
int64_t time_point;
} Dart_TaskData;
/**
* Callback provided by the embedder that is used by the VM to eventually run
* various tasks. If no callback is provided, these tasks will run on a
* VM-internal thread pool. This callback allows the embedder to make its own
* choices around the scheduling of these tasks: when they run, how many threads
* are servicing these tasks, the priorities of said threads, etc.
* The callback can be invoked as early as during the Dart_Initialize call.
*
* \param post_task_data
* The data provided to Dart_InitializeParams.post_task_data.
* \param task
* A task that should eventually be passed to Dart_RunTask.
* \param task_data
* Hints about when the task should run.
*/
typedef void (*Dart_PostTaskCallback)(void* post_task_data,
Dart_Task task,
Dart_TaskData task_data);
/**
* Runs a task given to the Dart_PostTaskCallback. Must not be called
* synchronously in response to any callback from the VM. In particular, must
* not be called synchronously by the implemention of a Dart native function
* or Dart_Post_TaskCallback.
*
* Requires there to be no current isolate or isolate group.
*/
DART_EXPORT void Dart_RunTask(Dart_Task task);
/**
* Optional callback provided by the embedder that is used by the VM to
* implement registration of kernel blobs for the subsequent Isolate.spawnUri
@ -1027,13 +983,6 @@ typedef struct {
*/
Dart_CodeObserver* code_observer;
/**
* A task scheduling callback function. See Dart_PostTaskCallback.
*/
Dart_PostTaskCallback post_task;
void* post_task_data;
/**
* Kernel blob registration callback function. See Dart_RegisterKernelBlobCallback.
*/

View file

@ -69,8 +69,6 @@ Dart_FileWriteCallback Dart::file_write_callback_ = NULL;
Dart_FileCloseCallback Dart::file_close_callback_ = NULL;
Dart_EntropySource Dart::entropy_source_callback_ = NULL;
Dart_GCEventCallback Dart::gc_event_callback_ = nullptr;
Dart_PostTaskCallback Dart::post_task_callback_ = nullptr;
void* Dart::post_task_data_ = nullptr;
// Structure for managing read-only global handles allocation used for
// creating global read-only handles that are pre created and initialized
@ -283,8 +281,6 @@ char* Dart::DartInit(const Dart_InitializeParams* params) {
SetFileCallbacks(params->file_open, params->file_read, params->file_write,
params->file_close);
set_entropy_source_callback(params->entropy_source);
set_post_task_callback(params->post_task);
set_post_task_data(params->post_task_data);
OS::Init();
NOT_IN_PRODUCT(CodeObservers::Init());
if (params->code_observer != nullptr) {
@ -802,8 +798,6 @@ char* Dart::Cleanup() {
Service::SetEmbedderStreamCallbacks(NULL, NULL);
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
VirtualMemory::Cleanup();
post_task_callback_ = nullptr;
post_task_data_ = nullptr;
return NULL;
}

View file

@ -114,14 +114,6 @@ class Dart : public AllStatic {
static void set_thread_exit_callback(Dart_ThreadExitCallback cback) {
thread_exit_callback_ = cback;
}
static Dart_PostTaskCallback post_task_callback() {
return post_task_callback_;
}
static void set_post_task_callback(Dart_PostTaskCallback cback) {
post_task_callback_ = cback;
}
static void* post_task_data() { return post_task_data_; }
static void set_post_task_data(void* data) { post_task_data_ = data; }
static void SetFileCallbacks(Dart_FileOpenCallback file_open,
Dart_FileReadCallback file_read,
Dart_FileWriteCallback file_write,
@ -179,8 +171,6 @@ class Dart : public AllStatic {
static Dart_FileCloseCallback file_close_callback_;
static Dart_EntropySource entropy_source_callback_;
static Dart_GCEventCallback gc_event_callback_;
static Dart_PostTaskCallback post_task_callback_;
static void* post_task_data_;
};
} // namespace dart

View file

@ -2047,16 +2047,6 @@ DART_EXPORT bool Dart_RunLoopAsync(bool errors_are_fatal,
return true;
}
DART_EXPORT void Dart_RunTask(Dart_Task task) {
Thread* T = Thread::Current();
Isolate* I = T == nullptr ? nullptr : T->isolate();
CHECK_NO_ISOLATE(I);
API_TIMELINE_BEGIN_END(T);
ThreadPool::Task* task_impl = reinterpret_cast<ThreadPool::Task*>(task);
task_impl->Run();
delete task_impl;
}
DART_EXPORT Dart_Handle Dart_HandleMessage() {
Thread* T = Thread::Current();
Isolate* I = T->isolate();

View file

@ -82,22 +82,6 @@ void ThreadPool::Shutdown() {
}
bool ThreadPool::RunImpl(std::unique_ptr<Task> task) {
Dart_PostTaskCallback post_task = Dart::post_task_callback();
if (post_task != nullptr) {
{
MonitorLocker ml(&pool_monitor_);
if (shutting_down_) {
return false;
}
}
Dart_TaskData data;
data.priority = Dart_TaskPriority_Default;
data.time_point = 0;
post_task(Dart::post_task_data(),
reinterpret_cast<Dart_Task>(task.release()), data);
return true;
}
Worker* new_worker = nullptr;
{
MonitorLocker ml(&pool_monitor_);