Skip to content

Commit 783d0ef

Browse files
rmacnak-googleCommit Queue
authored and
Commit Queue
committed
Revert "[vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate}"
This reverts commit a251281. Reason for revert: FFI tests fail to link on Windows, fail to load on product-mode Android Original change's description: > [vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate} > > For applications that want to have arbitrary number of isolates call > into native code that may be blocking, we expose the API functions that > allows those native threads to exit an isolate before running > long/blocking code. > > Without the ability to exit/re-enter isolate, one may experience > deadlocks as we have a fixed limit on the number of concurrently > executing isolates atm. > > In the longer term we may find a way to do this automatically > with low overhead, see [0]. But since those API functions are quite > stable and we already expose e.g. `Dart_{Enter,Exit}Scope`, I don't > see a reason not to expose `Dart_{Enter,Exit}Isolate`. > > [0] Issue #51261 > > Issue #51254 > > TEST=ffi{,_2}/dl_api_exit_enter_isolate_test > > Change-Id: I91c772ca962fddb87919663fea07939a498fa205 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292722 > Commit-Queue: Martin Kustermann <[email protected]> > Reviewed-by: Daco Harkes <[email protected]> > Reviewed-by: Ryan Macnak <[email protected]> Change-Id: I05ad5b9ce24754a68693160e470f8eb71a812c75 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294860 Auto-Submit: Ryan Macnak <[email protected]> Commit-Queue: Rubber Stamper <[email protected]> Bot-Commit: Rubber Stamper <[email protected]>
1 parent 7bac8ed commit 783d0ef

File tree

5 files changed

+11
-97
lines changed

5 files changed

+11
-97
lines changed

runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#include <iostream>
3131
#include <limits>
3232

33-
#include "bin/lockers.h"
34-
3533
// TODO(dartbug.com/40579): This requires static linking to either link
3634
// dart.exe or dart_precompiled_runtime.exe on Windows.
3735
// The sample currently fails on Windows in AOT mode.
@@ -422,6 +420,16 @@ DART_EXPORT intptr_t InitDartApiDL(void* data) {
422420
//
423421
// sample_async_callback.dart
424422

423+
void Fatal(char const* file, int line, char const* error) {
424+
printf("FATAL %s:%i\n", file, line);
425+
printf("%s\n", error);
426+
Dart_DumpNativeStackTrace(nullptr);
427+
Dart_PrepareToAbort();
428+
abort();
429+
}
430+
431+
#define FATAL(error) Fatal(__FILE__, __LINE__, error)
432+
425433
DART_EXPORT void SleepOnAnyOS(intptr_t seconds) {
426434
#if defined(DART_HOST_OS_WINDOWS)
427435
Sleep(1000 * seconds);
@@ -1274,28 +1282,6 @@ DART_EXPORT void SetFfiNativeResolverForTest(Dart_Handle url) {
12741282
ENSURE(!Dart_IsError(result));
12751283
}
12761284

1277-
DART_EXPORT void WaitUntilNThreadsEnterBarrier(intptr_t num_threads) {
1278-
Dart_Isolate isolate = Dart_CurrentIsolate_DL();
1279-
Dart_ExitIsolate_DL();
1280-
{
1281-
ENSURE(Dart_CurrentIsolate_DL() == nullptr);
1282-
1283-
// Guaranteed to be initialized exactly once (no race between multiple
1284-
// threads).
1285-
static dart::bin::Monitor monitor;
1286-
static intptr_t thread_count = 0;
1287-
1288-
dart::bin::MonitorLocker ml(&monitor);
1289-
++thread_count;
1290-
while (thread_count < num_threads) {
1291-
ml.Wait();
1292-
}
1293-
if (thread_count != num_threads) UNREACHABLE();
1294-
ml.NotifyAll();
1295-
}
1296-
Dart_EnterIsolate_DL(isolate);
1297-
}
1298-
12991285
////////////////////////////////////////////////////////////////////////////////
13001286
// Helper for the regression test for b/216834909
13011287
////////////////////////////////////////////////////////////////////////////////

runtime/include/dart_api_dl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ typedef void (*Dart_NativeMessageHandler_DL)(Dart_Port_DL dest_port_id,
9090
F(Dart_UpdateFinalizableExternalSize, void, \
9191
(Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object, \
9292
intptr_t external_allocation_size)) \
93-
/* Isolates */ \
94-
F(Dart_CurrentIsolate, Dart_Isolate, (void)) \
95-
F(Dart_ExitIsolate, void, (void)) \
96-
F(Dart_EnterIsolate, void, (Dart_Isolate)) \
9793
/* Dart_Port */ \
9894
F(Dart_Post, bool, (Dart_Port_DL port_id, Dart_Handle object)) \
9995
F(Dart_NewSendPort, Dart_Handle, (Dart_Port_DL port_id)) \

runtime/include/dart_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
// On backwards compatible changes the minor version is increased.
1212
// The versioning covers the symbols exposed in dart_api_dl.h
1313
#define DART_API_DL_MAJOR_VERSION 2
14-
#define DART_API_DL_MINOR_VERSION 3
14+
#define DART_API_DL_MINOR_VERSION 2
1515

1616
#endif /* RUNTIME_INCLUDE_DART_VERSION_H_ */ /* NOLINT */

tests/ffi/dl_api_exit_enter_isolate_test.dart

Lines changed: 0 additions & 33 deletions
This file was deleted.

tests/ffi_2/dl_api_exit_enter_isolate_test.dart

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)