[vm/shared] Rename IsolateGroupShared to IsolateGroupBound.

TEST=ci

CoreLibraryReviewExempt: vm-only change
Change-Id: If9c8bbd0e90e4ec1f70742c704ad31fce5681ec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441063
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Alexander Aprelev
2025-07-29 12:03:37 -07:00
committed by Commit Queue
parent fb22849379
commit a36f38b10a
31 changed files with 144 additions and 146 deletions
@@ -329,10 +329,10 @@ class FfiTransformer extends Transformer {
final Procedure nativeCallbackFunctionProcedure;
final Procedure nativeAsyncCallbackFunctionProcedure;
final Procedure createNativeCallableIsolateLocalProcedure;
final Procedure createNativeCallableIsolateGroupSharedProcedure;
final Procedure createNativeCallableIsolateGroupBoundProcedure;
final Procedure nativeIsolateLocalCallbackFunctionProcedure;
final Procedure nativeIsolateGroupSharedCallbackFunctionProcedure;
final Procedure nativeIsolateGroupSharedClosureFunctionProcedure;
final Procedure nativeIsolateGroupBoundCallbackFunctionProcedure;
final Procedure nativeIsolateGroupBoundClosureFunctionProcedure;
final Map<NativeType, Procedure> loadMethods;
final Map<NativeType, Procedure> loadUnalignedMethods;
final Map<NativeType, Procedure> storeMethods;
@@ -356,9 +356,9 @@ class FfiTransformer extends Transformer {
final Class rawRecvPortClass;
final Class nativeCallableClass;
final Procedure nativeCallableIsolateLocalConstructor;
final Procedure nativeCallableIsolateGroupSharedConstructor;
final Procedure nativeCallableIsolateGroupBoundConstructor;
final Constructor nativeCallablePrivateIsolateLocalConstructor;
final Constructor nativeCallablePrivateIsolateGroupSharedConstructor;
final Constructor nativeCallablePrivateIsolateGroupBoundConstructor;
final Procedure nativeCallableListenerConstructor;
final Constructor nativeCallablePrivateListenerConstructor;
final Field nativeCallablePortField;
@@ -842,10 +842,10 @@ class FfiTransformer extends Transformer {
'dart:ffi',
'_createNativeCallableIsolateLocal',
),
createNativeCallableIsolateGroupSharedProcedure = index
createNativeCallableIsolateGroupBoundProcedure = index
.getTopLevelProcedure(
'dart:ffi',
'_createNativeCallableIsolateGroupShared',
'_createNativeCallableIsolateGroupBound',
),
nativeCallbackFunctionProcedure = index.getTopLevelProcedure(
'dart:ffi',
@@ -859,15 +859,15 @@ class FfiTransformer extends Transformer {
'dart:ffi',
'_nativeIsolateLocalCallbackFunction',
),
nativeIsolateGroupSharedCallbackFunctionProcedure = index
nativeIsolateGroupBoundCallbackFunctionProcedure = index
.getTopLevelProcedure(
'dart:ffi',
'_nativeIsolateGroupSharedCallbackFunction',
'_nativeIsolateGroupBoundCallbackFunction',
),
nativeIsolateGroupSharedClosureFunctionProcedure = index
nativeIsolateGroupBoundClosureFunctionProcedure = index
.getTopLevelProcedure(
'dart:ffi',
'_nativeIsolateGroupSharedClosureFunction',
'_nativeIsolateGroupBoundClosureFunction',
),
nativeTypesClasses = nativeTypeClassNames.map(
(nativeType, name) =>
@@ -973,10 +973,10 @@ class FfiTransformer extends Transformer {
'NativeCallable',
'isolateLocal',
),
nativeCallableIsolateGroupSharedConstructor = index.getProcedure(
nativeCallableIsolateGroupBoundConstructor = index.getProcedure(
'dart:ffi',
'NativeCallable',
'isolateGroupShared',
'isolateGroupBound',
),
nativeCallablePrivateIsolateLocalConstructor = index.getConstructor(
'dart:ffi',
@@ -993,9 +993,9 @@ class FfiTransformer extends Transformer {
'_NativeCallableListener',
'',
),
nativeCallablePrivateIsolateGroupSharedConstructor = index.getConstructor(
nativeCallablePrivateIsolateGroupBoundConstructor = index.getConstructor(
'dart:ffi',
'_NativeCallableIsolateGroupShared',
'_NativeCallableIsolateGroupBound',
'',
),
nativeCallablePortField = index.getField(
@@ -570,10 +570,10 @@ mixin _FfiUseSiteTransformer on FfiTransformer {
);
} else if (target == nativeCallableIsolateLocalConstructor) {
return _verifyAndReplaceNativeCallableIsolateLocal(node);
} else if (target == nativeCallableIsolateGroupSharedConstructor) {
} else if (target == nativeCallableIsolateGroupBoundConstructor) {
return _verifyAndReplaceNativeCallable(
node,
replacement: _replaceNativeCallableIsolateGroupSharedConstructor,
replacement: _replaceNativeCallableIsolateGroupBoundConstructor,
);
} else if (target == nativeCallableListenerConstructor) {
final DartType nativeType = InterfaceType(
@@ -1059,18 +1059,18 @@ mixin _FfiUseSiteTransformer on FfiTransformer {
);
}
// NativeCallable<T>.isolateGroupShared(target, exceptionalReturn) calls become:
// NativeCallable<T>.isolateGroupBound(target, exceptionalReturn) calls become:
// isStaticFunction is true:
// _NativeCallableIsolateGroupShared<T>(
// _createNativeCallableIsolateGroupShared<NativeFunction<T>>(
// _nativeIsolateGroupSharedCallbackFunction<T>(target, exceptionalReturn),
// _NativeCallableIsolateGroupBound<T>(
// _createNativeCallableIsolateGroupBound<NativeFunction<T>>(
// _nativeIsolateGroupBoundCallbackFunction<T>(target, exceptionalReturn),
// null);
// isStaticFunction is false:
// _NativeCallableIsolateGroupShared<T>(
// _createNativeCallableIsolateGroupShared<NativeFunction<T>>(
// _nativeIsolateGroupSharedClosureFunction<T>(exceptionalReturn),
// _NativeCallableIsolateGroupBound<T>(
// _createNativeCallableIsolateGroupBound<NativeFunction<T>>(
// _nativeIsolateGroupBoundClosureFunction<T>(exceptionalReturn),
// target));
Expression _replaceNativeCallableIsolateGroupSharedConstructor(
Expression _replaceNativeCallableIsolateGroupBoundConstructor(
StaticInvocation node,
Expression exceptionalReturn,
bool isStaticFunction,
@@ -1084,11 +1084,11 @@ mixin _FfiUseSiteTransformer on FfiTransformer {
late StaticInvocation pointerValue;
if (isStaticFunction) {
pointerValue = StaticInvocation(
createNativeCallableIsolateGroupSharedProcedure,
createNativeCallableIsolateGroupBoundProcedure,
Arguments(
[
StaticInvocation(
nativeIsolateGroupSharedCallbackFunctionProcedure,
nativeIsolateGroupBoundCallbackFunctionProcedure,
Arguments([
target,
exceptionalReturn,
@@ -1101,11 +1101,11 @@ mixin _FfiUseSiteTransformer on FfiTransformer {
);
} else {
pointerValue = StaticInvocation(
createNativeCallableIsolateGroupSharedProcedure,
createNativeCallableIsolateGroupBoundProcedure,
Arguments(
[
StaticInvocation(
nativeIsolateGroupSharedClosureFunctionProcedure,
nativeIsolateGroupBoundClosureFunctionProcedure,
Arguments([exceptionalReturn], types: node.arguments.types),
),
target,
@@ -1116,7 +1116,7 @@ mixin _FfiUseSiteTransformer on FfiTransformer {
}
return ConstructorInvocation(
nativeCallablePrivateIsolateGroupSharedConstructor,
nativeCallablePrivateIsolateGroupBoundConstructor,
Arguments([pointerValue], types: node.arguments.types),
);
}
+2 -2
View File
@@ -46,12 +46,12 @@ DEFINE_NATIVE_ENTRY(Ffi_createNativeCallableIsolateLocal, 1, 3) {
zone, trampoline, target, keep_isolate_alive));
}
DEFINE_NATIVE_ENTRY(Ffi_createNativeCallableIsolateGroupShared, 1, 2) {
DEFINE_NATIVE_ENTRY(Ffi_createNativeCallableIsolateGroupBound, 1, 2) {
const auto& trampoline =
Function::CheckedHandle(zone, arguments->NativeArg0());
const auto& target = Closure::CheckedHandle(zone, arguments->NativeArgAt(1));
return Pointer::New(
isolate->CreateIsolateGroupSharedFfiCallback(zone, trampoline, target));
isolate->CreateIsolateGroupBoundFfiCallback(zone, trampoline, target));
}
DEFINE_NATIVE_ENTRY(Ffi_deleteNativeCallable, 1, 1) {
+1 -1
View File
@@ -297,7 +297,7 @@ namespace dart {
V(VMService_RemoveUserTagsFromStreamableSampleList, 1) \
V(Ffi_createNativeCallableListener, 2) \
V(Ffi_createNativeCallableIsolateLocal, 3) \
V(Ffi_createNativeCallableIsolateGroupShared, 2) \
V(Ffi_createNativeCallableIsolateGroupBound, 2) \
V(Ffi_deleteNativeCallable, 1) \
V(Ffi_updateNativeCallableKeepIsolateAliveCounter, 1) \
V(Ffi_dl_open, 1) \
+3 -3
View File
@@ -35,9 +35,9 @@ void BSS::Initialize(Thread* current, uword* bss_start, bool vm) {
InitializeBSSEntry(Relocation::DLRT_ExitTemporaryIsolate,
reinterpret_cast<uword>(DLRT_ExitTemporaryIsolate),
bss_start);
InitializeBSSEntry(
Relocation::DLRT_ExitIsolateGroupSharedIsolate,
reinterpret_cast<uword>(DLRT_ExitIsolateGroupSharedIsolate), bss_start);
InitializeBSSEntry(Relocation::DLRT_ExitIsolateGroupBoundIsolate,
reinterpret_cast<uword>(DLRT_ExitIsolateGroupBoundIsolate),
bss_start);
}
} // namespace dart
+1 -1
View File
@@ -18,7 +18,7 @@ class BSS : public AllStatic {
enum class Relocation : intptr_t {
DLRT_GetFfiCallbackMetadata, // TODO(https://dartbug.com/52579): Remove.
DLRT_ExitTemporaryIsolate, // TODO(https://dartbug.com/52579): Remove.
DLRT_ExitIsolateGroupSharedIsolate, // TODO(https://dartbug.com/52579)
DLRT_ExitIsolateGroupBoundIsolate, // TODO(https://dartbug.com/52579)
EndOfVmEntries,
// We don't have any isolate group specific entries at the moment.
+3 -3
View File
@@ -28,9 +28,9 @@ const String& NativeCallbackFunctionName(Thread* thread,
return String::Handle(
zone, Symbols::FromConcat(thread, Symbols::FfiCallback(),
String::Handle(zone, dart_target.name())));
case FfiCallbackKind::kIsolateGroupSharedClosureCallback:
return Symbols::FfiIsolateGroupSharedCallback();
case FfiCallbackKind::kIsolateGroupSharedStaticCallback:
case FfiCallbackKind::kIsolateGroupBoundClosureCallback:
return Symbols::FfiIsolateGroupBoundCallback();
case FfiCallbackKind::kIsolateGroupBoundStaticCallback:
return String::Handle(
zone, Symbols::FromConcat(thread, Symbols::FfiCallback(),
String::Handle(zone, dart_target.name())));
@@ -3390,12 +3390,12 @@ Fragment StreamingFlowGraphBuilder::BuildStaticInvocation(TokenPosition* p) {
case MethodRecognizer::kFfiNativeIsolateLocalCallbackFunction:
return BuildFfiNativeCallbackFunction(
FfiCallbackKind::kIsolateLocalClosureCallback);
case MethodRecognizer::kFfiNativeIsolateGroupSharedCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateGroupBoundCallbackFunction:
return BuildFfiNativeCallbackFunction(
FfiCallbackKind::kIsolateGroupSharedStaticCallback);
case MethodRecognizer::kFfiNativeIsolateGroupSharedClosureFunction:
FfiCallbackKind::kIsolateGroupBoundStaticCallback);
case MethodRecognizer::kFfiNativeIsolateGroupBoundClosureFunction:
return BuildFfiNativeCallbackFunction(
FfiCallbackKind::kIsolateGroupSharedClosureCallback);
FfiCallbackKind::kIsolateGroupBoundClosureCallback);
case MethodRecognizer::kFfiNativeAsyncCallbackFunction:
return BuildFfiNativeCallbackFunction(FfiCallbackKind::kAsyncCallback);
case MethodRecognizer::kFfiLoadAbiSpecificInt:
@@ -6216,7 +6216,7 @@ Fragment StreamingFlowGraphBuilder::BuildFfiNativeCallbackFunction(
// FfiCallbackKind::kIsolateLocalStaticCallback:
// _nativeCallbackFunction<NativeSignatureType>(target, exceptionalReturn)
//
// FfiCallbackKind::kIsolateGroupSharedStaticCallback:
// FfiCallbackKind::kIsolateGroupBoundStaticCallback:
// _nativeCallbackFunction<NativeSignatureType>(target, exceptionalReturn)
//
// FfiCallbackKind::kAsyncCallback:
@@ -6226,15 +6226,15 @@ Fragment StreamingFlowGraphBuilder::BuildFfiNativeCallbackFunction(
// _nativeIsolateLocalCallbackFunction<NativeSignatureType>(
// exceptionalReturn)
//
// FfiCallbackKind::kIsolateGroupSharedClosureCallback:
// _nativeIsolateGroupSharedCallbackFunction<NativeSignatureType>(
// FfiCallbackKind::kIsolateGroupBoundClosureCallback:
// _nativeIsolateGroupBoundCallbackFunction<NativeSignatureType>(
// exceptionalReturn)
//
// The FE also guarantees that the arguments are constants.
const bool has_target =
kind == FfiCallbackKind::kIsolateLocalStaticCallback ||
kind == FfiCallbackKind::kIsolateGroupSharedStaticCallback;
kind == FfiCallbackKind::kIsolateGroupBoundStaticCallback;
const bool has_exceptional_return = kind != FfiCallbackKind::kAsyncCallback;
const intptr_t expected_argc =
static_cast<int>(has_target) + static_cast<int>(has_exceptional_return);
+7 -7
View File
@@ -1061,8 +1061,8 @@ bool FlowGraphBuilder::IsRecognizedMethodForFlowGraph(
case MethodRecognizer::kFfiNativeCallbackFunction:
case MethodRecognizer::kFfiNativeAsyncCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateLocalCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateGroupSharedCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateGroupSharedClosureFunction:
case MethodRecognizer::kFfiNativeIsolateGroupBoundCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateGroupBoundClosureFunction:
case MethodRecognizer::kFfiStoreInt8:
case MethodRecognizer::kFfiStoreInt16:
case MethodRecognizer::kFfiStoreInt32:
@@ -1555,8 +1555,8 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfRecognizedMethod(
case MethodRecognizer::kFfiNativeCallbackFunction:
case MethodRecognizer::kFfiNativeAsyncCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateLocalCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateGroupSharedCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateGroupSharedClosureFunction: {
case MethodRecognizer::kFfiNativeIsolateGroupBoundCallbackFunction:
case MethodRecognizer::kFfiNativeIsolateGroupBoundClosureFunction: {
const auto& error = String::ZoneHandle(
Z, Symbols::New(thread_,
"This function should be handled on call site."));
@@ -5274,9 +5274,9 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfFfiTrampoline(
const Function& function) {
switch (function.GetFfiCallbackKind()) {
case FfiCallbackKind::kIsolateLocalStaticCallback:
case FfiCallbackKind::kIsolateGroupSharedStaticCallback:
case FfiCallbackKind::kIsolateGroupBoundStaticCallback:
case FfiCallbackKind::kIsolateLocalClosureCallback:
case FfiCallbackKind::kIsolateGroupSharedClosureCallback:
case FfiCallbackKind::kIsolateGroupBoundClosureCallback:
return BuildGraphOfSyncFfiCallback(function);
case FfiCallbackKind::kAsyncCallback:
return BuildGraphOfAsyncFfiCallback(function);
@@ -5591,7 +5591,7 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfSyncFfiCallback(
function.GetFfiCallbackKind() ==
FfiCallbackKind::kIsolateLocalClosureCallback ||
function.GetFfiCallbackKind() ==
FfiCallbackKind::kIsolateGroupSharedClosureCallback;
FfiCallbackKind::kIsolateGroupBoundClosureCallback;
graph_entry_ =
new (Z) GraphEntryInstr(*parsed_function_, Compiler::kNoOSRDeoptId);
@@ -120,10 +120,10 @@ namespace dart {
FfiNativeAsyncCallbackFunction, 0xbdd1a333) \
V(FfiLibrary, ::, _nativeIsolateLocalCallbackFunction, \
FfiNativeIsolateLocalCallbackFunction, 0x21b66eba) \
V(FfiLibrary, ::, _nativeIsolateGroupSharedCallbackFunction, \
FfiNativeIsolateGroupSharedCallbackFunction, 0x8882d3ca) \
V(FfiLibrary, ::, _nativeIsolateGroupSharedClosureFunction, \
FfiNativeIsolateGroupSharedClosureFunction, 0x2c93f675) \
V(FfiLibrary, ::, _nativeIsolateGroupBoundCallbackFunction, \
FfiNativeIsolateGroupBoundCallbackFunction, 0xc20a0b32) \
V(FfiLibrary, ::, _nativeIsolateGroupBoundClosureFunction, \
FfiNativeIsolateGroupBoundClosureFunction, 0x0714be84) \
V(FfiLibrary, ::, _loadAbiSpecificInt, FfiLoadAbiSpecificInt, 0x6abf70a6) \
V(FfiLibrary, ::, _loadAbiSpecificIntAtIndex, FfiLoadAbiSpecificIntAtIndex, \
0xc188dd75) \
@@ -391,7 +391,7 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ PopRegisters(argument_registers);
Label async_callback;
Label sync_isolate_group_shared_callback;
Label sync_isolate_group_bound_callback;
Label done;
// If GetFfiCallbackMetadata returned a null thread, it means that the async
@@ -405,10 +405,9 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
Operand(static_cast<uword>(FfiCallbackMetadata::TrampolineType::kAsync)));
__ b(&async_callback, EQ);
__ cmp(R4,
Operand(static_cast<uword>(
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupShared)));
__ b(&sync_isolate_group_shared_callback, EQ);
__ cmp(R4, Operand(static_cast<uword>(
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupBound)));
__ b(&sync_isolate_group_bound_callback, EQ);
// Sync callback. The entry point contains the target function, so just call
// it. DLRT_GetThreadForNativeCallbackTrampoline exited the safepoint, so
@@ -424,11 +423,11 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ b(&done);
__ Bind(&sync_isolate_group_shared_callback);
__ Bind(&sync_isolate_group_bound_callback);
__ blx(R5);
// Exit isolate group shared isolate.
// Exit isolate group bound isolate.
{
__ EnterFrame(1 << FP, 0);
__ ReserveAlignedFrameSpace(0);
@@ -440,7 +439,7 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ PushRegisters(return_registers);
GenerateLoadFfiCallbackMetadataRuntimeFunction(
FfiCallbackMetadata::kExitIsolateGroupSharedIsolate, R4);
FfiCallbackMetadata::kExitIsolateGroupBoundIsolate, R4);
__ blx(R4);
@@ -568,7 +568,7 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
}
Label async_callback;
Label sync_isolate_group_shared_callback;
Label sync_isolate_group_bound_callback;
Label done;
// If GetFfiCallbackMetadata returned a null thread, it means that the async
@@ -582,10 +582,9 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
Operand(static_cast<uword>(FfiCallbackMetadata::TrampolineType::kAsync)));
__ b(&async_callback, EQ);
__ cmp(R9,
Operand(static_cast<uword>(
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupShared)));
__ b(&sync_isolate_group_shared_callback, EQ);
__ cmp(R9, Operand(static_cast<uword>(
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupBound)));
__ b(&sync_isolate_group_bound_callback, EQ);
// Sync callback. The entry point contains the target function, so just call
// it. DLRT_GetThreadForNativeCallbackTrampoline exited the safepoint, so
@@ -600,11 +599,11 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ b(&done);
__ Bind(&sync_isolate_group_shared_callback);
__ Bind(&sync_isolate_group_bound_callback);
__ blr(R10);
// Exit isolate group shared isolate.
// Exit isolate group bound isolate.
{
__ SetupDartSP();
__ EnterFrame(0);
@@ -619,18 +618,18 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
#if defined(DART_TARGET_OS_FUCHSIA)
// TODO(https://dartbug.com/52579): Remove.
if (FLAG_precompiled_mode) {
GenerateLoadBSSEntry(BSS::Relocation::DLRT_ExitIsolateGroupSharedIsolate,
GenerateLoadBSSEntry(BSS::Relocation::DLRT_ExitIsolateGroupBoundIsolate,
R4, R9);
} else {
Label call;
__ ldr(R4, compiler::Address::PC(2 * Instr::kInstrSize));
__ b(&call);
__ Emit64(reinterpret_cast<int64_t>(&DLRT_ExitIsolateGroupSharedIsolate));
__ Emit64(reinterpret_cast<int64_t>(&DLRT_ExitIsolateGroupBoundIsolate));
__ Bind(&call);
}
#else
GenerateLoadFfiCallbackMetadataRuntimeFunction(
FfiCallbackMetadata::kExitIsolateGroupSharedIsolate, R4);
FfiCallbackMetadata::kExitIsolateGroupBoundIsolate, R4);
#endif
__ mov(CSP, SP);
@@ -287,7 +287,7 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
COMPILE_ASSERT(ECX != THR);
Label async_callback;
Label sync_isolate_group_shared_callback;
Label sync_isolate_group_bound_callback;
Label done;
// If GetFfiCallbackMetadata returned a null thread, it means that the async
@@ -302,8 +302,8 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ cmpl(EBX,
Immediate(static_cast<uword>(
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupShared)));
__ j(EQUAL, &sync_isolate_group_shared_callback, Assembler::kNearJump);
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupBound)));
__ j(EQUAL, &sync_isolate_group_bound_callback, Assembler::kNearJump);
// Sync callback. The entry point contains the target function, so just call
// it. DLRT_GetThreadForNativeCallbackTrampoline exited the safepoint, so
@@ -331,11 +331,11 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ Bind(&ret_4);
__ ret(Immediate(4));
__ Bind(&sync_isolate_group_shared_callback);
__ Bind(&sync_isolate_group_bound_callback);
__ call(ECX);
// Exit isolate group shared isolate.
// Exit isolate group bound isolate.
{
__ pushl(CallingConventions::kReturnReg);
__ pushl(CallingConventions::kSecondReturnReg);
@@ -346,7 +346,7 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ ReserveAlignedFrameSpace(0);
__ movl(EAX, Immediate(reinterpret_cast<int64_t>(
DLRT_ExitIsolateGroupSharedIsolate)));
DLRT_ExitIsolateGroupBoundIsolate)));
__ CallCFunction(EAX);
__ LeaveFrame();
@@ -462,11 +462,11 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
COMPILE_ASSERT(
static_cast<uword>(
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupShared) == 3);
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupBound) == 3);
// isolate-group-shared callback
__ jalr(T2);
// Exit isolate group shared isolate.
// Exit isolate group bound isolate.
{
__ EnterFrame(0);
__ ReserveAlignedFrameSpace(0);
@@ -482,7 +482,7 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
#if defined(DART_TARGET_OS_FUCHSIA)
// TODO(https://dartbug.com/52579): Remove.
if (FLAG_precompiled_mode) {
GenerateLoadBSSEntry(BSS::Relocation::DRT_ExitIsolateGroupSharedIsolate,
GenerateLoadBSSEntry(BSS::Relocation::DRT_ExitIsolateGroupBoundIsolate,
T1, T2);
} else {
const intptr_t kPCRelativeLoadOffset = 12;
@@ -493,14 +493,14 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
ASSERT_EQUAL(__ CodeSize() - start, kPCRelativeLoadOffset);
#if XLEN == 32
__ Emit32(reinterpret_cast<int32_t>(&DLRT_ExitIsolateGroupSharedIsolate));
__ Emit32(reinterpret_cast<int32_t>(&DLRT_ExitIsolateGroupBoundIsolate));
#else
__ Emit64(reinterpret_cast<int64_t>(&DLRT_ExitIsolateGroupSharedIsolate));
__ Emit64(reinterpret_cast<int64_t>(&DLRT_ExitIsolateGroupBoundIsolate));
#endif
}
#else
GenerateLoadFfiCallbackMetadataRuntimeFunction(
FfiCallbackMetadata::kExitIsolateGroupSharedIsolate, T1);
FfiCallbackMetadata::kExitIsolateGroupBoundIsolate, T1);
#endif // defined(DART_TARGET_OS_FUCHSIA)
__ Bind(&call);
@@ -530,7 +530,7 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
// All argument registers are untouched.
Label async_callback;
Label sync_isolate_group_shared_callback;
Label sync_isolate_group_bound_callback;
Label done;
// If GetFfiCallbackMetadata returned a null thread, it means that the
@@ -545,8 +545,8 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ cmpq(RAX,
Immediate(static_cast<uword>(
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupShared)));
__ j(EQUAL, &sync_isolate_group_shared_callback, Assembler::kNearJump);
FfiCallbackMetadata::TrampolineType::kSyncIsolateGroupBound)));
__ j(EQUAL, &sync_isolate_group_bound_callback, Assembler::kNearJump);
// Sync callback. The entry point contains the target function, so just call
// it. DLRT_GetThreadForNativeCallbackTrampoline exited the safepoint, so
@@ -561,11 +561,11 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
__ jmp(&done, Assembler::kNearJump);
__ Bind(&sync_isolate_group_shared_callback);
__ Bind(&sync_isolate_group_bound_callback);
__ call(TMP);
// Exit isolate group shared isolate.
// Exit isolate group bound isolate.
{
const RegisterSet return_registers(
(1 << CallingConventions::kReturnReg) |
@@ -576,15 +576,15 @@ void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
#if defined(DART_TARGET_OS_FUCHSIA)
// TODO(https://dartbug.com/52579): Remove.
if (FLAG_precompiled_mode) {
GenerateLoadBSSEntry(BSS::Relocation::DLRT_ExitIsolateGroupSharedIsolate,
GenerateLoadBSSEntry(BSS::Relocation::DLRT_ExitIsolateGroupBoundIsolate,
RAX, TMP);
} else {
__ movq(RAX, Immediate(reinterpret_cast<int64_t>(
DLRT_ExitIsolateGroupSharedIsolate)));
DLRT_ExitIsolateGroupBoundIsolate)));
}
#else
GenerateLoadFfiCallbackMetadataRuntimeFunction(
FfiCallbackMetadata::kExitIsolateGroupSharedIsolate, RAX);
FfiCallbackMetadata::kExitIsolateGroupBoundIsolate, RAX);
#endif // defined(DART_TARGET_OS_FUCHSIA)
__ EnterFrame(0);
+10 -10
View File
@@ -232,8 +232,8 @@ void FfiCallbackMetadata::EnsureFreeListNotEmptyLocked() {
FillRuntimeFunction(new_page, kExitTemporaryIsolate,
reinterpret_cast<void*>(DLRT_ExitTemporaryIsolate));
FillRuntimeFunction(
new_page, kExitIsolateGroupSharedIsolate,
reinterpret_cast<void*>(DLRT_ExitIsolateGroupSharedIsolate));
new_page, kExitIsolateGroupBoundIsolate,
reinterpret_cast<void*>(DLRT_ExitIsolateGroupBoundIsolate));
// Add all the trampolines to the free list.
const intptr_t trampolines_per_page = NumCallbackTrampolinesPerPage();
@@ -367,14 +367,14 @@ FfiCallbackMetadata::Trampoline FfiCallbackMetadata::CreateLocalFfiCallback(
FfiCallbackKind::kIsolateLocalStaticCallback) ||
(isolate == nullptr && isolate_group != nullptr &&
function.GetFfiCallbackKind() ==
FfiCallbackKind::kIsolateGroupSharedStaticCallback));
FfiCallbackKind::kIsolateGroupBoundStaticCallback));
} else {
ASSERT((isolate != nullptr && isolate_group == nullptr &&
function.GetFfiCallbackKind() ==
FfiCallbackKind::kIsolateLocalClosureCallback) ||
(isolate == nullptr && isolate_group != nullptr &&
function.GetFfiCallbackKind() ==
FfiCallbackKind::kIsolateGroupSharedClosureCallback));
FfiCallbackKind::kIsolateGroupBoundClosureCallback));
handle = CreatePersistentHandle(
isolate != nullptr ? isolate->group() : isolate_group, closure);
}
@@ -389,9 +389,9 @@ FfiCallbackMetadata::Trampoline FfiCallbackMetadata::CreateSyncFfiCallbackImpl(
const Function& function,
PersistentHandle* closure,
MetadataEntry** list_head) {
TrampolineType trampoline_type =
isolate != nullptr ? TrampolineType::kSync
: TrampolineType::kSyncIsolateGroupShared;
TrampolineType trampoline_type = isolate != nullptr
? TrampolineType::kSync
: TrampolineType::kSyncIsolateGroupBound;
#if defined(TARGET_ARCH_IA32)
// On ia32, store the stack delta that we need to use when returning.
@@ -403,7 +403,7 @@ FfiCallbackMetadata::Trampoline FfiCallbackMetadata::CreateSyncFfiCallbackImpl(
ASSERT(stack_return_delta == 4);
trampoline_type = isolate != nullptr
? TrampolineType::kSyncStackDelta4
: TrampolineType::kSyncIsolateGroupSharedStackDelta4;
: TrampolineType::kSyncIsolateGroupBoundStackDelta4;
}
#endif
@@ -503,8 +503,8 @@ FfiCallbackMetadata::Metadata FfiCallbackMetadata::LookupMetadataForTrampoline(
FfiCallbackMetadata* FfiCallbackMetadata::singleton_ = nullptr;
ApiState* FfiCallbackMetadata::Metadata::api_state() const {
return (is_isolate_group_shared() ? target_isolate_group_
: target_isolate_->group())
return (is_isolate_group_bound() ? target_isolate_group_
: target_isolate_->group())
->api_state();
}
+8 -8
View File
@@ -46,14 +46,14 @@ class FfiCallbackMetadata {
kSync = 0,
kSyncStackDelta4 = 1, // Only used by TARGET_ARCH_IA32
kAsync = 2,
kSyncIsolateGroupShared = 3,
kSyncIsolateGroupSharedStackDelta4 = 4, // Only used by TARGET_ARCH_IA32
kSyncIsolateGroupBound = 3,
kSyncIsolateGroupBoundStackDelta4 = 4, // Only used by TARGET_ARCH_IA32
};
enum RuntimeFunctions {
kGetFfiCallbackMetadata,
kExitTemporaryIsolate,
kExitIsolateGroupSharedIsolate,
kExitIsolateGroupBoundIsolate,
kNumRuntimeFunctions,
};
@@ -161,16 +161,16 @@ class FfiCallbackMetadata {
ASSERT(IsLive());
ASSERT(trampoline_type_ == TrampolineType::kSync ||
trampoline_type_ == TrampolineType::kSyncStackDelta4 ||
trampoline_type_ == TrampolineType::kSyncIsolateGroupShared ||
trampoline_type_ == TrampolineType::kSyncIsolateGroupBound ||
trampoline_type_ ==
TrampolineType::kSyncIsolateGroupSharedStackDelta4);
TrampolineType::kSyncIsolateGroupBoundStackDelta4);
return reinterpret_cast<PersistentHandle*>(context_);
}
bool is_isolate_group_shared() const {
return trampoline_type_ == TrampolineType::kSyncIsolateGroupShared ||
bool is_isolate_group_bound() const {
return trampoline_type_ == TrampolineType::kSyncIsolateGroupBound ||
trampoline_type_ ==
TrampolineType::kSyncIsolateGroupSharedStackDelta4;
TrampolineType::kSyncIsolateGroupBoundStackDelta4;
}
// ApiState associated with an isolate group associated with this metadata.
ApiState* api_state() const;
+1 -1
View File
@@ -3845,7 +3845,7 @@ FfiCallbackMetadata::Trampoline Isolate::CreateIsolateLocalFfiCallback(
}
// TODO(aam): Should this be in IsolateGroup?
FfiCallbackMetadata::Trampoline Isolate::CreateIsolateGroupSharedFfiCallback(
FfiCallbackMetadata::Trampoline Isolate::CreateIsolateGroupBoundFfiCallback(
Zone* zone,
const Function& trampoline,
const Closure& target) {
+1 -1
View File
@@ -1325,7 +1325,7 @@ class Isolate : public IntrusiveDListEntry<Isolate> {
const Function& trampoline,
const Closure& target,
bool keep_isolate_alive);
FfiCallbackMetadata::Trampoline CreateIsolateGroupSharedFfiCallback(
FfiCallbackMetadata::Trampoline CreateIsolateGroupBoundFfiCallback(
Zone* zone,
const Function& trampoline,
const Closure& target);
+2 -2
View File
@@ -2990,9 +2990,9 @@ struct NameFormattingParams {
enum class FfiCallbackKind : uint8_t {
kIsolateLocalStaticCallback,
kIsolateGroupSharedStaticCallback,
kIsolateGroupBoundStaticCallback,
kIsolateLocalClosureCallback,
kIsolateGroupSharedClosureCallback,
kIsolateGroupBoundClosureCallback,
kAsyncCallback,
};
+4 -4
View File
@@ -4685,7 +4685,7 @@ extern "C" Thread* DLRT_GetFfiCallbackMetadata(
if (!metadata.IsLive()) {
FATAL("Callback invoked after it has been deleted.");
}
if (metadata.is_isolate_group_shared()) {
if (metadata.is_isolate_group_bound()) {
*out_entry_point = metadata.target_entry_point();
*out_trampoline_type = static_cast<uword>(metadata.trampoline_type());
} else {
@@ -4717,7 +4717,7 @@ extern "C" Thread* DLRT_GetFfiCallbackMetadata(
current_thread->set_execution_state(Thread::kThreadInVM);
}
if (metadata.is_isolate_group_shared()) {
if (metadata.is_isolate_group_bound()) {
Isolate* current_isolate =
current_thread != nullptr ? current_thread->isolate() : nullptr;
@@ -4747,8 +4747,8 @@ extern "C" Thread* DLRT_GetFfiCallbackMetadata(
return current_thread;
}
extern "C" void DLRT_ExitIsolateGroupSharedIsolate() {
TRACE_RUNTIME_CALL("ExitIsolateGroupSharedIsolate%s", "");
extern "C" void DLRT_ExitIsolateGroupBoundIsolate() {
TRACE_RUNTIME_CALL("ExitIsolateGroupBoundIsolate%s", "");
Thread* thread = Thread::Current();
ASSERT(thread != nullptr);
Isolate* source_isolate =
+1 -1
View File
@@ -99,7 +99,7 @@ extern "C" Thread* DLRT_GetFfiCallbackMetadata(uword trampoline,
uword* out_entry_point,
uword* out_callback_kind);
extern "C" void DLRT_ExitTemporaryIsolate();
extern "C" void DLRT_ExitIsolateGroupSharedIsolate();
extern "C" void DLRT_ExitIsolateGroupBoundIsolate();
const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason);
+1 -1
View File
@@ -123,7 +123,7 @@ class ObjectPointerVisitor;
V(FfiInt8, "Int8") \
V(FfiIntPtr, "IntPtr") \
V(FfiIsolateLocalCallback, "_FfiIsolateLocalCallback") \
V(FfiIsolateGroupSharedCallback, "_FfiIsolateGroupSharedCallback") \
V(FfiIsolateGroupBoundCallback, "_FfiIsolateGroupBoundCallback") \
V(FfiNative, "Native") \
V(FfiNativeFunction, "NativeFunction") \
V(FfiNativeType, "NativeType") \
+1 -1
View File
@@ -378,7 +378,7 @@ class Thread : public ThreadState {
kSampleBlockTask,
kIncrementalCompactorTask,
kSpawnTask,
kIsolateGroupSharedCallbackTask,
kIsolateGroupBoundCallbackTask,
};
~Thread();
+2 -2
View File
@@ -27,7 +27,7 @@ Future<String> httpGet(String uri) async {
},
);
final sendPort = rp.sendPort;
final callback = NativeCallable<HttpCallback>.isolateGroupShared((
final callback = NativeCallable<HttpCallback>.isolateGroupBound((
Pointer<Utf8> responsePointer,
) {
final typedList = responsePointer.cast<Uint8>().asTypedList(
@@ -60,7 +60,7 @@ late int counter;
ReceivePort httpServe(void Function(String) onRequest) {
counter = 0;
final rp = ReceivePort();
final callback = NativeCallable<HttpCallback>.isolateGroupShared((
final callback = NativeCallable<HttpCallback>.isolateGroupBound((
Pointer<Utf8> requestPointer,
) {
counter++;
+8 -8
View File
@@ -193,8 +193,8 @@ external Pointer<NS> _createNativeCallableIsolateLocal<
NS extends NativeFunction
>(dynamic trampoline, dynamic target, bool keepIsolateAlive);
@pragma("vm:external-name", "Ffi_createNativeCallableIsolateGroupShared")
external Pointer<NS> _createNativeCallableIsolateGroupShared<
@pragma("vm:external-name", "Ffi_createNativeCallableIsolateGroupBound")
external Pointer<NS> _createNativeCallableIsolateGroupBound<
NS extends NativeFunction
>(dynamic trampoline, dynamic target);
@@ -215,15 +215,15 @@ external dynamic _nativeIsolateLocalCallbackFunction<NS extends Function>(
);
@pragma("vm:recognized", "other")
@pragma("vm:external-name", "Ffi_nativeIsolateGroupSharedCallbackFunction")
external dynamic _nativeIsolateGroupSharedCallbackFunction<NS extends Function>(
@pragma("vm:external-name", "Ffi_nativeIsolateGroupBoundCallbackFunction")
external dynamic _nativeIsolateGroupBoundCallbackFunction<NS extends Function>(
Function target,
dynamic exceptionalReturn,
);
@pragma("vm:recognized", "other")
@pragma("vm:external-name", "Ffi_nativeIsolateGroupSharedClosureFunction")
external dynamic _nativeIsolateGroupSharedClosureFunction<NS extends Function>(
@pragma("vm:external-name", "Ffi_nativeIsolateGroupBoundClosureFunction")
external dynamic _nativeIsolateGroupBoundClosureFunction<NS extends Function>(
dynamic exceptionalReturn,
);
@@ -347,11 +347,11 @@ final class _NativeCallableListener<T extends Function>
bool get _keepIsolateAlive => _port.keepIsolateAlive;
}
final class _NativeCallableIsolateGroupShared<T extends Function>
final class _NativeCallableIsolateGroupBound<T extends Function>
extends _NativeCallableBase<T> {
bool _isKeepingIsolateAlive = true;
_NativeCallableIsolateGroupShared(super._pointer) {
_NativeCallableIsolateGroupBound(super._pointer) {
_updateNativeCallableKeepIsolateAliveCounter(1);
}
+1 -1
View File
@@ -396,7 +396,7 @@ abstract final class NativeCallable<T extends Function> {
throw UnsupportedError("NativeCallable cannot be constructed dynamically.");
}
factory NativeCallable.isolateGroupShared(
factory NativeCallable.isolateGroupBound(
@DartRepresentationOf("T") Function callback, {
Object? exceptionalReturn,
}) {
+1 -1
View File
@@ -1158,6 +1158,6 @@ class TypeTest<T> {
abstract interface class IsolateGroup {
external static Object _runSync(Object computation);
/// Runs [computation] in isolate-group shared context.
/// Runs [computation] in isolate-group bound context.
static R runSync<R>(R computation()) => _runSync(computation) as R;
}
@@ -100,7 +100,7 @@ void simpleFunction(int a, int b) {
Future<void> testNativeCallableHelloWorld(NativeLibrary lib) async {
mutexCondvar = Mutex();
conditionVariable = ConditionVariable();
final callback = NativeCallable<CallbackNativeType>.isolateGroupShared(
final callback = NativeCallable<CallbackNativeType>.isolateGroupBound(
simpleFunction,
);
@@ -137,7 +137,7 @@ void simpleFunctionThatThrows(int a, int b) {
Future<void> testNativeCallableThrows(NativeLibrary lib) async {
mutexCondvar = Mutex();
conditionVariable = ConditionVariable();
final callback = NativeCallable<CallbackNativeType>.isolateGroupShared(
final callback = NativeCallable<CallbackNativeType>.isolateGroupBound(
simpleFunctionThatThrows,
);
@@ -161,7 +161,7 @@ Future<void> testNativeCallableThrows(NativeLibrary lib) async {
Future<void> testNativeCallableHelloWorldClosure(NativeLibrary lib) async {
mutexCondvar = Mutex();
conditionVariable = ConditionVariable();
final callback = NativeCallable<CallbackNativeType>.isolateGroupShared((
final callback = NativeCallable<CallbackNativeType>.isolateGroupBound((
int a,
int b,
) {
@@ -198,7 +198,7 @@ Future<void> testNativeCallableHelloWorldClosure(NativeLibrary lib) async {
void testNativeCallableSync(NativeLibrary lib) {
final callback =
NativeCallable<CallbackReturningIntNativeType>.isolateGroupShared((
NativeCallable<CallbackReturningIntNativeType>.isolateGroupBound((
int a,
int b,
) {
@@ -214,7 +214,7 @@ void testNativeCallableSync(NativeLibrary lib) {
void testNativeCallableSyncThrows(NativeLibrary lib) {
final callback =
NativeCallable<CallbackReturningIntNativeType>.isolateGroupShared(
NativeCallable<CallbackReturningIntNativeType>.isolateGroupBound(
(int a, int b) {
throw "foo";
}
@@ -233,7 +233,7 @@ int isolateVar = 10;
void testNativeCallableAccessNonSharedVar(NativeLibrary lib) {
final callback =
NativeCallable<CallbackReturningIntNativeType>.isolateGroupShared((
NativeCallable<CallbackReturningIntNativeType>.isolateGroupBound((
int a,
int b,
) {
@@ -255,7 +255,7 @@ Future<void> testKeepIsolateAliveTrue() async {
unawaited(
Isolate.spawn(
(_) async {
final callback = NativeCallable<CallbackNativeType>.isolateGroupShared(
final callback = NativeCallable<CallbackNativeType>.isolateGroupBound(
simpleFunction,
);
callback.keepIsolateAlive = true;
@@ -282,7 +282,7 @@ Future<void> testKeepIsolateAliveFalse() async {
unawaited(
Isolate.spawn(
(_) async {
final callback = NativeCallable<CallbackNativeType>.isolateGroupShared(
final callback = NativeCallable<CallbackNativeType>.isolateGroupBound(
simpleFunction,
);
callback.keepIsolateAlive = false;