runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[RyuJIT/ARM32] pImportSection == pModule->GetImportSectionForRVA(rva) in DynamicHelperFixup

Open hqueue opened this issue 9 years ago • 8 comments

With COMPlus_AltJit=* COMPlus_AltJitAssertOnNYI=0 options, following assertion is observed.

FAILED   - [7077][   8s]readytorun/tests/genericsload/callgenericctor/callgenericctor.sh
               BEGIN EXECUTION
               Microsoft (R) CoreCLR Native Image Generator - Version 4.5.22220.0
               Copyright (c) Microsoft Corporation.  All rights reserved.

               Native image genericslib.ni.dll generated successfully.
               Microsoft (R) CoreCLR Native Image Generator - Version 4.5.22220.0
               Copyright (c) Microsoft Corporation.  All rights reserved.

               Native image callgenericctor.ni.exe generated successfully.
               /home/dotnet_jenkins/workspace/hqueue/Run_coreclr_tests_Checked_ryujit_nyi_all/runtime/tests/Tests/coreoverlay/corerun callgenericctor.exe

               Assert failure(PID 13694 [0x0000357e], Thread: 13694 [0x357e]): pImportSection == pModule->GetImportSectionForRVA(rva)
                   File: /opt/code/github/hqueue/coreclr/src/vm/prestub.cpp Line: 2519
                   Image: /home/dotnet_jenkins/workspace/hqueue/Run_coreclr_tests_Checked_ryujit_nyi_all/runtime/tests/Tests/coreoverlay/corerun

               ./callgenericctor.sh: line 244: 13694 Aborted                 (core dumped) $_DebuggerFullPath "$CORE_ROOT/corerun" $ExePath $CLRTestExecutionArguments
               Expected: 100
               Actual: 134
               END EXECUTION - FAILED

Failed tests

readytorun/tests/genericsload/callgenericctor/callgenericctor.sh
readytorun/tests/genericsload/usegenericfield/usegenericfield.sh

/cc: @dotnet/arm32-contrib

hqueue avatar Jul 06 '17 09:07 hqueue

@hqueue @BruceForstall Please assign this to me.

sjsinju avatar Jul 06 '17 10:07 sjsinju

With COMPlus_AltJitNgen=* on running tests, it works well.

sjsinju avatar Jul 11 '17 06:07 sjsinju

I have checked that readytorun.tests.genericsload.callgenericctor.callgenericctor test passes on e3e870ed7d5d6bf92a740712385ede9346c31262 and fails on the next commit, which is 73287a13f4028835182126b93f3935b6e99cb0aa (pull request dotnet/coreclr#12104). Also readytorun.tests.genericsload.callgenericctor.callgenericctor test passes on current master with reverted changes of 73287a13f4028835182126b93f3935b6e99cb0aa

gbalykov avatar Jul 11 '17 16:07 gbalykov

I found that this issue does not happen when commenting out op1->gtCall.setEntryPoint(pFieldInfo->fieldLookup); statement from the following fragment (which is a part of Compiler::impImportStaticFieldAccess):

#ifdef FEATURE_READYTORUN_COMPILER
            if (opts.IsReadyToRun())
            {
                unsigned callFlags = 0;

                if (info.compCompHnd->getClassAttribs(pResolvedToken->hClass) & CORINFO_FLG_BEFOREFIELDINIT)
                {
                    callFlags |= GTF_CALL_HOISTABLE;
                }

                op1 = gtNewHelperCallNode(CORINFO_HELP_READYTORUN_STATIC_BASE, TYP_BYREF, callFlags);

                op1->gtCall.setEntryPoint(pFieldInfo->fieldLookup);
            }
            else
#endif

parjong avatar Jul 19 '17 09:07 parjong

When DynamicHelperFixup hits this assertion failure, ```rvais0x0003E059 (`pCell is 0x71518059 but the module base is 714da000).

We first need to figure out whether pCell is valid, or not.

parjong avatar Jul 19 '17 09:07 parjong

This is causing the following four tests to fail on Windows/ARM32/LEGACY_BACKEND across all modes:

  • readytorun\tests\genericsload\callgenericctor\callgenericctor.cmd
  • readytorun\tests\mainv1\mainv1.cmd
  • readytorun\tests\mainv1\mainv2.cmd
  • readytorun\tests\genericsload\usegenericfield\usegenericfield.cmd

pgavlin avatar Jul 19 '17 17:07 pgavlin

@hqueue @parjong @sjsinju Does this bug only happen for LEGACY_BACKEND, or does it (still) happen for RyuJIT as well?

BruceForstall avatar Jul 26 '17 00:07 BruceForstall

Does this bug only happen for LEGACY_BACKEND, or does it (still) happen for RyuJIT as well?

@BruceForstall I've just ran readytorun\tests\genericsload\callgenericctor\callgenericctor.cmd with recent coreclr(13e39297001).

  • With LEGACY_BACKEND: FAILED with same assertion.
  • With COMPlus_AltJit=* : FAILED with same assertion.
  • With COMPlus_AltJitNgen=* : PASSED
  • With COMPlus_AltJit=* COMPlus_AltJitNgen=* : PASSED

Therefore it seems that it only happens when R2R uses LEGACY_BACKEND.

And sorry for the late reply, because I was out-of-office last week.

hqueue avatar Jul 31 '17 07:07 hqueue