Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions eng/testing/tests.browser.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(ContinuousIntegrationBuild)' == 'true' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(BrowserProjectRoot), 'emsdk'))</EMSDK_PATH>

<WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == ''">true</WasmEmitSymbolMap>
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>

<_WasmMainJSFileName Condition="'$(WasmMainJSPath)' != ''">$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))</_WasmMainJSFileName>
<_WasmStrictVersionMatch Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</_WasmStrictVersionMatch>
Expand All @@ -47,6 +48,11 @@
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == ''">false</UseSystemResourceKeys>
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">true</EventSourceSupport>
<NullabilityInfoContextSupport Condition="'$(NullabilityInfoContextSupport)' == ''">true</NullabilityInfoContextSupport>

<!-- TODO-WASM https://github.com/dotnet/runtime/issues/120248 -->
<WasmEnableWebcil Condition="'$(RuntimeFlavor)' == 'CoreCLR'">false</WasmEnableWebcil>
<EnableAggressiveTrimming Condition="'$(RuntimeFlavor)' == 'CoreCLR'">false</EnableAggressiveTrimming>
<PublishTrimmed Condition="'$(RuntimeFlavor)' == 'CoreCLR'">false</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 7 additions & 3 deletions eng/testing/workloads-browser.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<Target Name="_GetWorkloadsToInstall" DependsOnTargets="_SetPackageVersionForWorkloadsTesting" Returns="@(WorkloadIdForTesting);@(WorkloadCombinationsToInstall)">
<Error Condition="'$(RIDForWorkload)' == ''" Text="$(RIDForWorkload) is unset" />
<ItemGroup>
<ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
<WorkloadIdForTesting Include="wasm-tools;wasm-experimental"
ManifestName="Microsoft.NET.Workload.Mono.ToolChain.Current"
Variant="latest"
Expand Down Expand Up @@ -73,11 +73,15 @@
</_DefaultRuntimePackNuGetPath>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
<_RuntimePackNugetAvailable Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.$(RIDForWorkload).*$(PackageVersionForWorkloadManifests).nupkg" />
<_RuntimePackNugetAvailable Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.*.$(RIDForWorkload).*$(PackageVersionForWorkloadManifests).nupkg" />
<_RuntimePackNugetAvailable Remove="@(_RuntimePackNugetAvailable)" Condition="$([System.String]::new('%(_RuntimePackNugetAvailable.FileName)').EndsWith('.symbols'))" />
</ItemGroup>
<ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
<_RuntimePackNugetAvailable Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.$(RIDForWorkload).*$(PackageVersionForWorkloadManifests).nupkg" />
<_RuntimePackNugetAvailable Remove="@(_RuntimePackNugetAvailable)" Condition="$([System.String]::new('%(_RuntimePackNugetAvailable.FileName)').EndsWith('.symbols'))" />
</ItemGroup>

<Error Condition="@(_RuntimePackNugetAvailable -> Count()) != 2 and @(_RuntimePackNugetAvailable -> Count()) != 1"
Text="Expected to find either one or two in $(LibrariesShippingPackagesDir): @(_RuntimePackNugetAvailable->'%(FileName)%(Extension)')" />
Expand All @@ -93,7 +97,7 @@
</ItemGroup>

<Message
Condition="@(_RuntimePackNugetAvailable -> Count()) == 1"
Condition="'$(RuntimeFlavor)' == 'Mono' and @(_RuntimePackNugetAvailable -> Count()) == 1"
Importance="High"
Text="
********************
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/interpreter/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4062,6 +4062,7 @@ void InterpCompiler::EmitCanAccessCallout(CORINFO_RESOLVED_TOKEN *pResolvedToken

void InterpCompiler::EmitCallsiteCallout(CorInfoIsAccessAllowedResult accessAllowed, CORINFO_HELPER_DESC* calloutDesc)
{
/*HACK
if (accessAllowed == CORINFO_ACCESS_ILLEGAL)
{
int32_t svars[CORINFO_ACCESS_ALLOWED_MAX_ARGS];
Expand Down Expand Up @@ -4132,6 +4133,7 @@ void InterpCompiler::EmitCallsiteCallout(CorInfoIsAccessAllowedResult accessAllo
}
m_pLastNewIns->data[0] = GetDataForHelperFtn(calloutDesc->helperNum);
}
*/
}

static OpcodePeepElement peepRuntimeAsyncCall[] = {
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3674,6 +3674,7 @@ struct PAL_SEHException
// The exception is a hardware exception coming from a native code out of
// the well known runtime helpers
bool IsExternal;
bool IgnoreInManagedExceptionDispatcher;

void(*ManagedToNativeExceptionCallback)(void* context);
void* ManagedToNativeExceptionCallbackContext;
Expand All @@ -3686,6 +3687,7 @@ struct PAL_SEHException
TargetIp = 0;
RecordsOnStack = onStack;
IsExternal = false;
IgnoreInManagedExceptionDispatcher = false;
ManagedToNativeExceptionCallback = NULL;
ManagedToNativeExceptionCallbackContext = NULL;
}
Expand Down
22 changes: 20 additions & 2 deletions src/coreclr/vm/excep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2493,6 +2493,12 @@ VOID DECLSPEC_NORETURN RealCOMPlusThrow(OBJECTREF throwable)
RealCOMPlusThrow(throwable, FALSE);
}

EXCEPTION_DISPOSITION MarkAsIgnoreInManagedExceptionDispatcher(PAL_SEHException& ex)
{
ex.IgnoreInManagedExceptionDispatcher = true;
return EXCEPTION_CONTINUE_SEARCH;
}

VOID DECLSPEC_NORETURN __fastcall PropagateExceptionThroughNativeFrames(Object *exceptionObj)
{
CONTRACTL
Expand All @@ -2503,8 +2509,20 @@ VOID DECLSPEC_NORETURN __fastcall PropagateExceptionThroughNativeFrames(Object *
}
CONTRACTL_END;

OBJECTREF throwable = ObjectToOBJECTREF(exceptionObj);
RealCOMPlusThrowWorker(throwable, FALSE);
#ifdef TARGET_WASM
PAL_TRY(Object *, exceptionObj, exceptionObj)
{
#endif // TARGET_WASM
OBJECTREF throwable = ObjectToOBJECTREF(exceptionObj);
RealCOMPlusThrowWorker(throwable, FALSE);
#ifdef TARGET_WASM
}
PAL_EXCEPT(MarkAsIgnoreInManagedExceptionDispatcher(ex))
{
}
PAL_ENDTRY
#endif // TARGET_WASM
UNREACHABLE();
}

// this function finds the managed callback to get a resource
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/exceptmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHar
} \
catch (PAL_SEHException& ex) \
{ \
if (nativeRethrow) \
if (nativeRethrow || ex.IgnoreInManagedExceptionDispatcher) \
{ \
throw; \
} \
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/vm/interpexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr
MAIN_LOOP:
try
{
INSTALL_MANAGED_EXCEPTION_DISPATCHER;
///pavel
INSTALL_UNWIND_AND_CONTINUE_HANDLER;
while (true)
{
Expand Down Expand Up @@ -4175,7 +4175,6 @@ do \
}
}
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
}
catch (const ResumeAfterCatchException& ex)
{
Expand Down
73 changes: 73 additions & 0 deletions src/coreclr/vm/wasm/callhelpers-interp-to-managed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,24 @@ namespace
*((double*)pRet) = (*fptr)(ARG_F64(0), ARG_I32(1));
}

static void CallFunc_I32_I32_RetF64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
double (*fptr)(int32_t, int32_t) = (double (*)(int32_t, int32_t))pcode;
*((double*)pRet) = (*fptr)(ARG_I32(0), ARG_I32(1));
}

static void CallFunc_I32_RetF64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
double (*fptr)(int32_t) = (double (*)(int32_t))pcode;
*((double*)pRet) = (*fptr)(ARG_I32(0));
}

static void CallFunc_RetF32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
float (*fptr)() = (float (*)())pcode;
*((float*)pRet) = (*fptr)();
}

static void CallFunc_F32_RetF32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
float (*fptr)(float) = (float (*)(float))pcode;
Expand Down Expand Up @@ -205,6 +217,12 @@ namespace
*((int32_t*)pRet) = (*fptr)(ARG_I32(0), ARG_I64(1));
}

static void CallFunc_I64_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int32_t (*fptr)(int64_t) = (int32_t (*)(int64_t))pcode;
*((int32_t*)pRet) = (*fptr)(ARG_I64(0));
}

static void CallFunc_I32_I64_I32_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int32_t (*fptr)(int32_t, int64_t, int32_t) = (int32_t (*)(int32_t, int64_t, int32_t))pcode;
Expand Down Expand Up @@ -343,12 +361,24 @@ namespace
*((int64_t*)pRet) = (*fptr)(ARG_I32(0));
}

static void CallFunc_I64_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int64_t (*fptr)(int64_t) = (int64_t (*)(int64_t))pcode;
*((int64_t*)pRet) = (*fptr)(ARG_I64(0));
}

static void CallFunc_I32_I32_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int64_t (*fptr)(int32_t, int32_t) = (int64_t (*)(int32_t, int32_t))pcode;
*((int64_t*)pRet) = (*fptr)(ARG_I32(0), ARG_I32(1));
}

static void CallFunc_I64_I32_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int64_t (*fptr)(int64_t, int32_t) = (int64_t (*)(int64_t, int32_t))pcode;
*((int64_t*)pRet) = (*fptr)(ARG_I64(0), ARG_I32(1));
}

static void CallFunc_I32_I32_I32_I64_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int64_t (*fptr)(int32_t, int32_t, int32_t, int64_t) = (int64_t (*)(int32_t, int32_t, int32_t, int64_t))pcode;
Expand Down Expand Up @@ -379,6 +409,13 @@ namespace
*((int64_t*)pRet) = (*fptr)(ARG_I64(0), ARG_I64(1));
}

static void CallFunc_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int32_t (*fptr)() = (int32_t (*)())pcode;
PORTABILITY_ASSERT("Indirect struct return is not yet implemented.");
*((int32_t*)pRet) = (*fptr)();
}

static void CallFunc_I32_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int32_t (*fptr)(int32_t) = (int32_t (*)(int32_t))pcode;
Expand All @@ -393,6 +430,20 @@ namespace
*((int32_t*)pRet) = (*fptr)(ARG_I32(0), ARG_I32(1));
}

static void CallFunc_IND_I32_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int32_t (*fptr)(int32_t, int32_t) = (int32_t (*)(int32_t, int32_t))pcode;
PORTABILITY_ASSERT("Indirect struct return is not yet implemented.");
*((int32_t*)pRet) = (*fptr)(ARG_IND(0), ARG_I32(1));
}

static void CallFunc_IND_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
int32_t (*fptr)(int32_t) = (int32_t (*)(int32_t))pcode;
PORTABILITY_ASSERT("Indirect struct return is not yet implemented.");
*((int32_t*)pRet) = (*fptr)(ARG_IND(0));
}

static void CallFunc_Void_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
void (*fptr)() = (void (*)())pcode;
Expand All @@ -405,12 +456,24 @@ namespace
(*fptr)(ARG_F64(0), ARG_I32(1), ARG_I32(2));
}

static void CallFunc_F64_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
void (*fptr)(double) = (void (*)(double))pcode;
(*fptr)(ARG_F64(0));
}

static void CallFunc_F32_I32_I32_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
void (*fptr)(float, int32_t, int32_t) = (void (*)(float, int32_t, int32_t))pcode;
(*fptr)(ARG_F32(0), ARG_I32(1), ARG_I32(2));
}

static void CallFunc_F32_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
void (*fptr)(float) = (void (*)(float))pcode;
(*fptr)(ARG_F32(0));
}

static void CallFunc_I32_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet)
{
void (*fptr)(int32_t) = (void (*)(int32_t))pcode;
Expand Down Expand Up @@ -569,6 +632,8 @@ const StringToWasmSigThunk g_wasmThunks[] = {
{ "dddd", (void*)&CallFunc_F64_F64_F64_RetF64 },
{ "ddi", (void*)&CallFunc_F64_I32_RetF64 },
{ "di", (void*)&CallFunc_I32_RetF64 },
{ "dii", (void*)&CallFunc_I32_I32_RetF64 },
{ "f", (void*)&CallFunc_RetF32 },
{ "ff", (void*)&CallFunc_F32_RetF32 },
{ "fff", (void*)&CallFunc_F32_F32_RetF32 },
{ "ffff", (void*)&CallFunc_F32_F32_F32_RetF32 },
Expand All @@ -594,6 +659,7 @@ const StringToWasmSigThunk g_wasmThunks[] = {
{ "iiinii", (void*)&CallFunc_I32_I32_IND_I32_I32_RetI32 },
{ "iiiniin", (void*)&CallFunc_I32_I32_IND_I32_I32_IND_RetI32 },
{ "iil", (void*)&CallFunc_I32_I64_RetI32 },
{ "il", (void*)&CallFunc_I64_RetI32 },
{ "iili", (void*)&CallFunc_I32_I64_I32_RetI32 },
{ "iiliiil", (void*)&CallFunc_I32_I64_I32_I32_I32_I64_RetI32 },
{ "iill", (void*)&CallFunc_I32_I64_I64_RetI32 },
Expand All @@ -617,17 +683,24 @@ const StringToWasmSigThunk g_wasmThunks[] = {
{ "innin", (void*)&CallFunc_IND_IND_I32_IND_RetI32 },
{ "l", (void*)&CallFunc_Void_RetI64 },
{ "li", (void*)&CallFunc_I32_RetI64 },
{ "ll", (void*)&CallFunc_I64_RetI64 },
{ "lii", (void*)&CallFunc_I32_I32_RetI64 },
{ "lli", (void*)&CallFunc_I64_I32_RetI64 },
{ "liiil", (void*)&CallFunc_I32_I32_I32_I64_RetI64 },
{ "lil", (void*)&CallFunc_I32_I64_RetI64 },
{ "lili", (void*)&CallFunc_I32_I64_I32_RetI64 },
{ "lill", (void*)&CallFunc_I32_I64_I64_RetI64 },
{ "lll", (void*)&CallFunc_I64_I64_RetI64 },
{ "n", (void*)&CallFunc_RetIND },
{ "ni", (void*)&CallFunc_I32_RetIND },
{ "nn", (void*)&CallFunc_IND_RetIND },
{ "nni", (void*)&CallFunc_IND_I32_RetIND },
{ "nii", (void*)&CallFunc_I32_I32_RetIND },
{ "v", (void*)&CallFunc_Void_RetVoid },
{ "vd", (void*)&CallFunc_F64_RetVoid },
{ "vdii", (void*)&CallFunc_F64_I32_I32_RetVoid },
{ "vfii", (void*)&CallFunc_F32_I32_I32_RetVoid },
{ "vf", (void*)&CallFunc_F32_RetVoid },
{ "vi", (void*)&CallFunc_I32_RetVoid },
{ "vii", (void*)&CallFunc_I32_I32_RetVoid },
{ "viii", (void*)&CallFunc_I32_I32_I32_RetVoid },
Expand Down
Loading