Skip to content

Commit 6ce4a23

Browse files
committed
Merge branch 'WasmTestOnChrome' into firefox_ci
# Conflicts: # src/libraries/sendtohelix-browser.targets # src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj
2 parents 0f71790 + e5babd7 commit 6ce4a23

File tree

99 files changed

+584
-1523
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+584
-1523
lines changed

.github/workflows/bump-chrome-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: >-
2828
make -C src/mono/wasm build-tasks &&
2929
PATH=$PWD/.dotnet:$PATH dotnet build eng/testing/bump-chrome-version.proj -p:Configuration=Release &&
30-
git add eng/testing/ChromeVersions.props &&
30+
git add eng/testing/BrowserVersions.props &&
3131
cat eng/testing/bump-chrome-pr.env >> "$GITHUB_ENV"
3232
3333
- name: Check for changes

eng/pipelines/common/evaluate-default-paths.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
_const_paths:
88
_wasm_specific_only: [
99
eng/testing/bump-chrome-version.proj
10-
eng/testing/ChromeVersions.props
10+
eng/testing/BrowserVersions.props
1111
eng/testing/WasmRunner*
1212
eng/testing/WasiRunner*
1313
eng/testing/scenarios/BuildWasiAppsJobsList.txt
@@ -58,7 +58,7 @@ parameters:
5858
]
5959
_wasm_chrome: [
6060
eng/testing/bump-chrome-version.proj
61-
eng/testing/ChromeVersions.props
61+
eng/testing/BrowserVersions.props
6262
]
6363
_perf_pipeline_specific_only: [
6464
eng/pipelines/runtime-wasm-perf.yml

eng/pipelines/common/templates/wasm-library-aot-tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,5 @@ jobs:
3535
- WasmTestOnV8
3636
- ${{ if eq(platform, 'browser_wasm_win') }}:
3737
- WasmTestOnChrome
38-
- ${{ if eq(platform, 'wasi_wasm_win') }}:
39-
- WasmTestOnWasmtime
40-
- ${{ if eq(platform, 'wasi_wasm') }}:
38+
- ${{ if or(eq(platform, 'wasi_wasm_win'), eq(platform, 'wasi_wasm')) }}:
4139
- WasmTestOnWasmtime

eng/pipelines/runtime-wasm-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pr:
1616
- eng/pipelines/coreclr/templates/run-perf*
1717
- eng/pipelines/coreclr/templates/run-scenarios-job.yml
1818
- eng/testing/performance/*
19-
- eng/testing/ChromeVersions.props
19+
- eng/testing/BrowserVersions.props
2020

2121
variables:
2222
- template: /eng/pipelines/common/variables.yml
File renamed without changes.

eng/testing/bump-chrome-version.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="..\..\Directory.Build.props" />
44
<UsingTask AssemblyFile="$(WasmBuildTasksAssemblyPath)" TaskName="Microsoft.WebAssembly.Build.Tasks.UpdateChromeVersions" />
55
<PropertyGroup>
6-
<ChromeVersionsPath>$(RepositoryEngineeringDir)testing\ChromeVersions.props</ChromeVersionsPath>
6+
<ChromeVersionsPath>$(RepositoryEngineeringDir)testing\BrowserVersions.props</ChromeVersionsPath>
77
<EnvVarsForPRPath>$(RepositoryEngineeringDir)testing\bump-chrome-pr.env</EnvVarsForPRPath>
88
</PropertyGroup>
99

eng/testing/performance/performance-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ if [[ -n "$wasm_bundle_directory" ]]; then
451451

452452
# get required version
453453
if [[ -z "$v8_version" ]]; then
454-
v8_version=`grep linux_V8Version $source_directory/eng/testing/ChromeVersions.props | sed -e 's,.*>\([^\<]*\)<.*,\1,g' | cut -d. -f 1-3`
454+
v8_version=`grep linux_V8Version $source_directory/eng/testing/BrowserVersions.props | sed -e 's,.*>\([^\<]*\)<.*,\1,g' | cut -d. -f 1-3`
455455
echo "V8 version: $v8_version"
456456
fi
457457
if [[ -z "$javascript_engine_path" ]]; then

eng/testing/wasm-provisioning.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<WasmProvisionAfterTarget Condition="'$(WasmProvisionAfterTarget)' == ''">Build</WasmProvisionAfterTarget>
2020
</PropertyGroup>
2121

22-
<Import Project="$(MSBuildThisFileDirectory)ChromeVersions.props" />
22+
<Import Project="$(MSBuildThisFileDirectory)BrowserVersions.props" />
2323

2424
<PropertyGroup Condition="'$(BrowserHost)' != 'windows'">
2525
<FirefoxUrl>https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.bz2</FirefoxUrl>
@@ -100,7 +100,7 @@
100100
<Error Condition="!$([MSBuild]::IsOSPlatform('linux')) and !$([MSBuild]::IsOSPlatform('windows'))"
101101
Text="Chrome provisioning only supported on Linux, and windows." />
102102
<Error Condition="'$(ChromeVersion)' == ''"
103-
Text="No %24(ChromeVersion) set. This can be set in eng/testing/ChromeVersions.props" />
103+
Text="No %24(ChromeVersion) set. This can be set in eng/testing/BrowserVersions.props" />
104104

105105
<RemoveDir Directories="$(ChromeDir)" />
106106

@@ -128,7 +128,7 @@
128128
<Error Condition="!$([MSBuild]::IsOSPlatform('linux')) and !$([MSBuild]::IsOSPlatform('windows'))"
129129
Text="ChromeDriver provisioning only supported on Linux, and windows." />
130130
<Error Condition="'$(ChromeVersion)' == ''"
131-
Text="No %24(ChromeVersion) set. This can be set in eng/testing/ChromeVersions.props" />
131+
Text="No %24(ChromeVersion) set. This can be set in eng/testing/BrowserVersions.props" />
132132

133133
<RemoveDir Directories="$(ChromeDriverDir)" />
134134

src/coreclr/jit/abi.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,7 @@ bool ABIPassingInformation::IsSplitAcrossRegistersAndStack() const
281281
//
282282
ABIPassingInformation ABIPassingInformation::FromSegment(Compiler* comp, const ABIPassingSegment& segment)
283283
{
284-
ABIPassingInformation info;
285-
info.NumSegments = 1;
286-
info.Segments = new (comp, CMK_ABI) ABIPassingSegment(segment);
287-
return info;
284+
return {1, new (comp, CMK_ABI) ABIPassingSegment(segment)};
288285
}
289286

290287
#ifdef DEBUG

src/coreclr/jit/abi.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@ struct ABIPassingInformation
4848
// multiple register segments and a struct segment.
4949
// - On Windows x64, all parameters always fit into one stack slot or
5050
// register, and thus always have NumSegments == 1
51+
// - On RISC-V, structs can be split out over 2 segments, each can be an integer/float register or a stack slot
5152
unsigned NumSegments = 0;
5253
ABIPassingSegment* Segments = nullptr;
5354

55+
ABIPassingInformation(unsigned numSegments = 0, ABIPassingSegment* segments = nullptr)
56+
: NumSegments(numSegments)
57+
, Segments(segments)
58+
{
59+
}
60+
5461
bool HasAnyRegisterSegment() const;
5562
bool HasAnyStackSegment() const;
5663
bool HasExactlyOneRegisterSegment() const;
@@ -77,7 +84,7 @@ class RegisterQueue
7784
{
7885
}
7986

80-
unsigned Count()
87+
unsigned Count() const
8188
{
8289
return m_numRegs - m_index;
8390
}
@@ -179,6 +186,22 @@ class Arm32Classifier
179186
WellKnownArg wellKnownParam);
180187
};
181188

189+
class RiscV64Classifier
190+
{
191+
const ClassifierInfo& m_info;
192+
RegisterQueue m_intRegs;
193+
RegisterQueue m_floatRegs;
194+
unsigned m_stackArgSize = 0;
195+
196+
public:
197+
RiscV64Classifier(const ClassifierInfo& info);
198+
199+
ABIPassingInformation Classify(Compiler* comp,
200+
var_types type,
201+
ClassLayout* structLayout,
202+
WellKnownArg wellKnownParam);
203+
};
204+
182205
#if defined(TARGET_X86)
183206
typedef X86Classifier PlatformClassifier;
184207
#elif defined(WINDOWS_AMD64_ABI)
@@ -189,6 +212,8 @@ typedef SysVX64Classifier PlatformClassifier;
189212
typedef Arm64Classifier PlatformClassifier;
190213
#elif defined(TARGET_ARM)
191214
typedef Arm32Classifier PlatformClassifier;
215+
#elif defined(TARGET_RISCV64)
216+
typedef RiscV64Classifier PlatformClassifier;
192217
#endif
193218

194219
#ifdef SWIFT_SUPPORT

src/coreclr/jit/assertionprop.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,9 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
769769
}
770770
else if (curAssertion->op1.kind == O1K_ARR_BND)
771771
{
772-
printf("[idx:");
772+
printf("[idx: " FMT_VN, curAssertion->op1.bnd.vnIdx);
773773
vnStore->vnDump(this, curAssertion->op1.bnd.vnIdx);
774-
printf(";len:");
774+
printf("; len: " FMT_VN, curAssertion->op1.bnd.vnLen);
775775
vnStore->vnDump(this, curAssertion->op1.bnd.vnLen);
776776
printf("]");
777777
}

src/coreclr/jit/lclvars.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,8 @@ void Compiler::lvaClassifyParameterABI()
18041804
}
18051805
else
18061806
#endif
1807-
#if defined(TARGET_X86) || defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_ARM)
1807+
#if defined(TARGET_X86) || defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_ARM) || \
1808+
defined(TARGET_RISCV64)
18081809
{
18091810
PlatformClassifier classifier(cInfo);
18101811
lvaClassifyParameterABI(classifier);

src/coreclr/jit/rangecheck.cpp

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void RangeCheck::OptimizeRangeCheck(BasicBlock* block, Statement* stmt, GenTree*
353353
return;
354354
}
355355

356-
if (DoesOverflow(block, treeIndex))
356+
if (DoesOverflow(block, treeIndex, range))
357357
{
358358
JITDUMP("Method determined to overflow.\n");
359359
return;
@@ -773,6 +773,22 @@ void RangeCheck::MergeEdgeAssertions(ValueNum normalLclVN, ASSERT_VALARG_TP asse
773773

774774
isConstantAssertion = true;
775775
}
776+
// Current assertion asserts a bounds check does not throw
777+
else if (curAssertion->IsBoundsCheckNoThrow())
778+
{
779+
ValueNum indexVN = curAssertion->op1.bnd.vnIdx;
780+
ValueNum lenVN = curAssertion->op1.bnd.vnLen;
781+
if (normalLclVN == indexVN)
782+
{
783+
isUnsigned = true;
784+
cmpOper = GT_LT;
785+
limit = Limit(Limit::keBinOpArray, lenVN, 0);
786+
}
787+
else
788+
{
789+
continue;
790+
}
791+
}
776792
// Current assertion is not supported, ignore it
777793
else
778794
{
@@ -782,7 +798,8 @@ void RangeCheck::MergeEdgeAssertions(ValueNum normalLclVN, ASSERT_VALARG_TP asse
782798
assert(limit.IsBinOpArray() || limit.IsConstant());
783799

784800
// Make sure the assertion is of the form != 0 or == 0 if it isn't a constant assertion.
785-
if (!isConstantAssertion && (curAssertion->op2.vn != m_pCompiler->vnStore->VNZeroForType(TYP_INT)))
801+
if (!isConstantAssertion && (curAssertion->assertionKind != Compiler::OAK_NO_THROW) &&
802+
(curAssertion->op2.vn != m_pCompiler->vnStore->VNZeroForType(TYP_INT)))
786803
{
787804
continue;
788805
}
@@ -1235,17 +1252,17 @@ bool RangeCheck::MultiplyOverflows(Limit& limit1, Limit& limit2)
12351252
}
12361253

12371254
// Does the bin operation overflow.
1238-
bool RangeCheck::DoesBinOpOverflow(BasicBlock* block, GenTreeOp* binop)
1255+
bool RangeCheck::DoesBinOpOverflow(BasicBlock* block, GenTreeOp* binop, const Range& range)
12391256
{
12401257
GenTree* op1 = binop->gtGetOp1();
12411258
GenTree* op2 = binop->gtGetOp2();
12421259

1243-
if (!m_pSearchPath->Lookup(op1) && DoesOverflow(block, op1))
1260+
if (!m_pSearchPath->Lookup(op1) && DoesOverflow(block, op1, range))
12441261
{
12451262
return true;
12461263
}
12471264

1248-
if (!m_pSearchPath->Lookup(op2) && DoesOverflow(block, op2))
1265+
if (!m_pSearchPath->Lookup(op2) && DoesOverflow(block, op2, range))
12491266
{
12501267
return true;
12511268
}
@@ -1279,7 +1296,7 @@ bool RangeCheck::DoesBinOpOverflow(BasicBlock* block, GenTreeOp* binop)
12791296
}
12801297

12811298
// Check if the var definition the rhs involves arithmetic that overflows.
1282-
bool RangeCheck::DoesVarDefOverflow(GenTreeLclVarCommon* lcl)
1299+
bool RangeCheck::DoesVarDefOverflow(BasicBlock* block, GenTreeLclVarCommon* lcl, const Range& range)
12831300
{
12841301
LclSsaVarDsc* ssaDef = GetSsaDefStore(lcl);
12851302
if (ssaDef == nullptr)
@@ -1291,10 +1308,25 @@ bool RangeCheck::DoesVarDefOverflow(GenTreeLclVarCommon* lcl)
12911308
}
12921309
return true;
12931310
}
1294-
return DoesOverflow(ssaDef->GetBlock(), ssaDef->GetDefNode()->Data());
1311+
1312+
// We can use intermediate assertions about the local to prove that any
1313+
// overflow on this path does not matter for the range computed.
1314+
Range assertionRange = Range(Limit(Limit::keUnknown));
1315+
MergeAssertion(block, lcl, &assertionRange DEBUGARG(0));
1316+
1317+
// But only if the range from the assertion is more strict than the global
1318+
// range computed; otherwise we might still have used the def's value to
1319+
// tighten the range of the global range.
1320+
Range merged = RangeOps::Merge(range, assertionRange, false);
1321+
if (merged.LowerLimit().Equals(range.LowerLimit()) && merged.UpperLimit().Equals(range.UpperLimit()))
1322+
{
1323+
return false;
1324+
}
1325+
1326+
return DoesOverflow(ssaDef->GetBlock(), ssaDef->GetDefNode()->Data(), range);
12951327
}
12961328

1297-
bool RangeCheck::DoesPhiOverflow(BasicBlock* block, GenTree* expr)
1329+
bool RangeCheck::DoesPhiOverflow(BasicBlock* block, GenTree* expr, const Range& range)
12981330
{
12991331
for (GenTreePhi::Use& use : expr->AsPhi()->Uses())
13001332
{
@@ -1303,25 +1335,38 @@ bool RangeCheck::DoesPhiOverflow(BasicBlock* block, GenTree* expr)
13031335
{
13041336
continue;
13051337
}
1306-
if (DoesOverflow(block, arg))
1338+
if (DoesOverflow(block, arg, range))
13071339
{
13081340
return true;
13091341
}
13101342
}
13111343
return false;
13121344
}
13131345

1314-
bool RangeCheck::DoesOverflow(BasicBlock* block, GenTree* expr)
1346+
//------------------------------------------------------------------------
1347+
// DoesOverflow: Check if the computation of "expr" may have overflowed.
1348+
//
1349+
// Arguments:
1350+
// block - the block that contains `expr`
1351+
// expr - expression to check overflow of
1352+
// range - range that we believe "expr" to be in without accounting for
1353+
// overflow; used to ignore potential overflow on paths where
1354+
// we can prove the value is in this range regardless.
1355+
//
1356+
// Return value:
1357+
// True if the computation may have involved an impactful overflow.
1358+
//
1359+
bool RangeCheck::DoesOverflow(BasicBlock* block, GenTree* expr, const Range& range)
13151360
{
13161361
bool overflows = false;
13171362
if (!GetOverflowMap()->Lookup(expr, &overflows))
13181363
{
1319-
overflows = ComputeDoesOverflow(block, expr);
1364+
overflows = ComputeDoesOverflow(block, expr, range);
13201365
}
13211366
return overflows;
13221367
}
13231368

1324-
bool RangeCheck::ComputeDoesOverflow(BasicBlock* block, GenTree* expr)
1369+
bool RangeCheck::ComputeDoesOverflow(BasicBlock* block, GenTree* expr, const Range& range)
13251370
{
13261371
JITDUMP("Does overflow [%06d]?\n", Compiler::dspTreeID(expr));
13271372
m_pSearchPath->Set(expr, block, SearchPath::Overwrite);
@@ -1343,17 +1388,17 @@ bool RangeCheck::ComputeDoesOverflow(BasicBlock* block, GenTree* expr)
13431388
}
13441389
else if (expr->OperIs(GT_COMMA))
13451390
{
1346-
overflows = ComputeDoesOverflow(block, expr->gtEffectiveVal());
1391+
overflows = ComputeDoesOverflow(block, expr->gtEffectiveVal(), range);
13471392
}
13481393
// Check if the var def has rhs involving arithmetic that overflows.
13491394
else if (expr->IsLocal())
13501395
{
1351-
overflows = DoesVarDefOverflow(expr->AsLclVarCommon());
1396+
overflows = DoesVarDefOverflow(block, expr->AsLclVarCommon(), range);
13521397
}
13531398
// Check if add overflows.
13541399
else if (expr->OperIs(GT_ADD, GT_MUL))
13551400
{
1356-
overflows = DoesBinOpOverflow(block, expr->AsOp());
1401+
overflows = DoesBinOpOverflow(block, expr->AsOp(), range);
13571402
}
13581403
// These operators don't overflow.
13591404
// Actually, GT_LSH can overflow so it depends on the analysis done in ComputeRangeForBinOp
@@ -1364,11 +1409,11 @@ bool RangeCheck::ComputeDoesOverflow(BasicBlock* block, GenTree* expr)
13641409
// Walk through phi arguments to check if phi arguments involve arithmetic that overflows.
13651410
else if (expr->OperIs(GT_PHI))
13661411
{
1367-
overflows = DoesPhiOverflow(block, expr);
1412+
overflows = DoesPhiOverflow(block, expr, range);
13681413
}
13691414
else if (expr->OperIs(GT_CAST))
13701415
{
1371-
overflows = ComputeDoesOverflow(block, expr->gtGetOp1());
1416+
overflows = ComputeDoesOverflow(block, expr->gtGetOp1(), range);
13721417
}
13731418
GetOverflowMap()->Set(expr, overflows, OverflowMap::Overwrite);
13741419
m_pSearchPath->Remove(expr);

0 commit comments

Comments
 (0)