Skip to content

Commit e953348

Browse files
committed
[MERGE #5184 @rajatd] Give TyVar instead of TyMachPtr to argouts created in the inliner. OS 17500887.
Merge pull request #5184 from rajatd:avt-bugs
2 parents 6167b3a + dd81b0c commit e953348

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

lib/Backend/Inline.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ void Inline::CloneCallSequence(IR::Instr* callInstr, IR::Instr* clonedCallInstr)
10901090
IR::Instr* previousClonedArg = clonedCallInstr;
10911091
callInstr->IterateArgInstrs([&](IR::Instr* argInstr){
10921092
IR::Instr* cloneArg = IR::Instr::New(argInstr->m_opcode,
1093-
IR::SymOpnd::New(callInstr->m_func->m_symTable->GetArgSlotSym(argInstr->GetDst()->GetStackSym()->GetArgSlotNum()), 0, TyMachPtr, callInstr->m_func),
1093+
IR::SymOpnd::New(callInstr->m_func->m_symTable->GetArgSlotSym(argInstr->GetDst()->GetStackSym()->GetArgSlotNum()), 0, argInstr->GetDst()->GetType(), callInstr->m_func),
10941094
argInstr->GetSrc1(), callInstr->m_func);
10951095
cloneArg->SetByteCodeOffset(callInstr);
10961096
cloneArg->GetDst()->GetStackSym()->m_isArgCaptured = true;
@@ -2580,10 +2580,10 @@ IR::Instr * Inline::InlineApplyWithArgumentsObject(IR::Instr * callInstr, IR::In
25802580
callInstr->InsertBefore(startCall);
25812581

25822582
StackSym *symDst = callInstr->m_func->m_symTable->GetArgSlotSym((uint16)(2));
2583-
IR::SymOpnd* linkOpnd1 = IR::SymOpnd::New(symDst, 0, TyMachPtr, callInstr->m_func);
2583+
IR::SymOpnd* linkOpnd1 = IR::SymOpnd::New(symDst, 0, TyVar, callInstr->m_func);
25842584

25852585
symDst = callInstr->m_func->m_symTable->GetArgSlotSym((uint16)(1));
2586-
IR::Opnd *linkOpnd2 = IR::SymOpnd::New(symDst, 0, TyMachPtr, callInstr->m_func);
2586+
IR::Opnd *linkOpnd2 = IR::SymOpnd::New(symDst, 0, TyVar, callInstr->m_func);
25872587

25882588
// This keeps the stack args alive for bailout to recover
25892589
IR::Instr* argout = IR::Instr::New(Js::OpCode::ArgOut_A_FromStackArgs, linkOpnd1, ldHeapArguments->GetDst(), startCall->GetDst(), callInstr->m_func);
@@ -2644,12 +2644,12 @@ IR::Instr * Inline::InlineApplyBuiltInTargetWithArray(IR::Instr * callInstr, con
26442644
StackSym * sym;
26452645

26462646
sym = callInstr->m_func->m_symTable->GetArgSlotSym((uint16)(1));
2647-
linkOpnd = IR::SymOpnd::New(sym, 0, TyMachPtr, callInstr->m_func);
2647+
linkOpnd = IR::SymOpnd::New(sym, 0, TyVar, callInstr->m_func);
26482648
IR::Instr * argOut = IR::Instr::New(Js::OpCode::ArgOut_A, linkOpnd, explicitThisArgOut->GetSrc1(), startCall->GetDst(), callInstr->m_func);
26492649
callInstr->InsertBefore(argOut);
26502650

26512651
sym = callInstr->m_func->m_symTable->GetArgSlotSym((uint16)(2));
2652-
linkOpnd = IR::SymOpnd::New(sym, 0, TyMachPtr, callInstr->m_func);
2652+
linkOpnd = IR::SymOpnd::New(sym, 0, TyVar, callInstr->m_func);
26532653
argOut = IR::Instr::New(Js::OpCode::ArgOut_A, linkOpnd, arrayArgOut->GetSrc1(), argOut->GetDst(), callInstr->m_func);
26542654
callInstr->InsertBefore(argOut);
26552655

@@ -2702,7 +2702,7 @@ IR::Instr * Inline::InlineApplyWithoutArrayArgument(IR::Instr *callInstr, const
27022702
callInstr->InsertBefore(startCall);
27032703

27042704
StackSym* symDst = callInstr->m_func->m_symTable->GetArgSlotSym((uint16)(1));
2705-
IR::SymOpnd* linkOpnd = IR::SymOpnd::New(symDst, 0, TyMachPtr, callInstr->m_func);
2705+
IR::SymOpnd* linkOpnd = IR::SymOpnd::New(symDst, 0, TyVar, callInstr->m_func);
27062706
IR::Instr* thisArgOut = IR::Instr::New(Js::OpCode::ArgOut_A, linkOpnd, explicitThisArgOut->GetSrc1(), startCall->GetDst(), callInstr->m_func);
27072707
callInstr->InsertBefore(thisArgOut);
27082708

@@ -3107,7 +3107,7 @@ Inline::InlineCall(IR::Instr *callInstr, const FunctionJITTimeInfo *funcInfo, co
31073107
orgArgout->InsertBefore(assignInstr);
31083108

31093109
StackSym *symDst = callInstr->m_func->m_symTable->GetArgSlotSym((uint16)(i));
3110-
IR::SymOpnd* newLinkOpnd = IR::SymOpnd::New(symDst, 0, TyMachPtr, func);
3110+
IR::SymOpnd* newLinkOpnd = IR::SymOpnd::New(symDst, 0, TyVar, func);
31113111

31123112
clonedArgout = IR::Instr::New(Js::OpCode::ArgOut_A, newLinkOpnd, tempDst, func);
31133113
insertBeforeInstr->SetSrc2(newLinkOpnd);

test/Optimizer/rlexe.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,12 @@
14711471
<compile-flags>-off:aggressiveinttypespec</compile-flags>
14721472
</default>
14731473
</test>
1474+
<test>
1475+
<default>
1476+
<files>test148.js</files>
1477+
<compile-flags>-mic:1 -off:simplejit</compile-flags>
1478+
</default>
1479+
</test>
14741480
<test>
14751481
<default>
14761482
<files>IsIn_ArrayNoMissingValues.js</files>

test/Optimizer/test148.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
function test0() {
7+
var obj0 = {};
8+
var func1 = function () {
9+
return 'caller';
10+
};
11+
var func3 = function () {
12+
};
13+
obj0.method1 = func1;
14+
var ary = Array();
15+
var __loopvar1 = 9;
16+
for (;;) {
17+
if (__loopvar1 > 9) {
18+
break;
19+
}
20+
__loopvar1++;
21+
var uniqobj12 = { 13: ((func3.call(obj0.method1(), 'caller')), func1()) };
22+
}
23+
'' + ary.slice();
24+
}
25+
test0();
26+
test0();
27+
print("passed");

0 commit comments

Comments
 (0)