Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Less conservative gt obj #6021

Merged
merged 1 commit into from
Jul 7, 2016
Merged

Conversation

CarolEidt
Copy link

Don't mark GT_OBJ with GTF_EXCEPT or GTF_GLOB_REF if it is a local struct.
Also, fix changes needed in arm register allocation and code generation to handle the case where a struct argument is promoted, which appears to be code that was never exercised.
These changes are in preparation for further changes for First Class Structs. I am working to replace block ops with assignments, and was attempting to get to zero diffs, but it is quite difficult to do so given some inconsistencies in the treatment of GT_OBJs of locals.

@CarolEidt
Copy link
Author

Please do not merge this PR yet. It requires additional validation.
@myungjoo, @chunseoklee, @jyoungyun, @leemgs, @prajwal-aithal, @parjong - these changes exercise arm codegen paths in codegenlegacy.cpp that were never executed before, because the struct arguments were always treated as global references and therefore those locals were never promoted. Now they are getting promoted, and the code to move the arguments from the registers to the argument locations had some bugs. If you can do some validation of this, it would be great.

@parjong
Copy link

parjong commented Jun 28, 2016

@CarolEidt Is there any testcase related with this issue? It takes about 7 hours to run the whole unittests even in Release build (and over 1 day in Debug build). It would be very helpful if we could know which unittests are relevant to this issue.

@CarolEidt
Copy link
Author

@parjong - I have been looking at diffs in the frameworks; I will have a look at the tests to see if I can find some that show the difference.

@parjong
Copy link

parjong commented Jun 28, 2016

@CarolEidt Thanks 👍 Anyway, we will evaluate this patch for the whole unittest (it takes some time to get the result)

@CarolEidt
Copy link
Author

@parjong - I am not able to duplicate the diffs I've seen in any of the unit tests that I've looked at so far. The diffs in the desktop build of the libraries had diffs for uses of DateTime and Decimal, as well as a number of struct types in the non-core libraries.

@CarolEidt
Copy link
Author

It looks like I have missed a case in x86 ryujit, so I will have to track that one down.

@jyoungyun
Copy link

I'm trying to run unit tests on arm device. I will post the results soon.

@jyoungyun
Copy link

jyoungyun commented Jun 28, 2016

Um, I got the below exception error.
The test case is RegionInfoCurrentRegion.exe.
And I couldn't get any log because this exception only occurs Release mode.

Beginning test case RegionInfoCurrentRegion at 01/01/2015 11:08:34
Random seed: 20010415; set environment variable CORECLR_SEED to this value to repro

[Positive]
Beginning scenario: PosTest1:Return the CurrentRegion property in RegionInfo class

Unhandled Exception: 
   Cannot print exception string because Exception.ToString() failed.
Aborted

@CarolEidt CarolEidt force-pushed the LessConservativeGtObj branch from 367d4f2 to cc81d67 Compare June 29, 2016 19:07
@CarolEidt
Copy link
Author

@dotnet/jit-contrib PTAL - I am attempting an arm cross build, so that I can look into the RegionInfoCurrentRegion.exe failure. In the meantime, I would like to start the review process.

Don't mark GT_OBJ with GTF_EXCEPT or GTF_GLOB_REF if it is a local struct.
Also, fix changes needed in arm register allocation and code generation
to handle the case where a struct argument is promoted, which appears to
be code that was never exercised.
Also, handle the x86/RyuJIT case where we keep re-copying struct args.
Note that in some cases we still treat an address-taken lclVar as a GTF_GLOB_REF;
this is really overloading the meaning, but teasing that apart is more complex.
@CarolEidt CarolEidt force-pushed the LessConservativeGtObj branch from cc81d67 to 0ce4dda Compare July 2, 2016 16:24
@BruceForstall
Copy link

@CarolEidt LGTM. However, I don't understand why the changes to codegenlegacy.cpp for reconstructing struct args from promoted structs is required, or related. That code is unfortunately complex...

@CarolEidt
Copy link
Author

@BruceForstall - That code pre-existed, but was apparently never executed because when structs were passed as arguments, they were not being promoted. An alternative would be to prevent structs from being promoted on arm, but I'm not sure that's even desirable, as the code seems to be working correctly, modulo one possible test failure that I'm attempting to investigate - and IMO it serves as a proof point for doing this - which I hope we will be doing before too long for other targets as well.

@CarolEidt
Copy link
Author

I have not yet been able to run the failing test on the emulator, but I ran the armaltjit on desktop for this test case, and the code produced is identical.

@CarolEidt
Copy link
Author

@dotnet/jit-contrib ping - I would love to get another review on this.

@briansull
Copy link

Looks Good

@CarolEidt CarolEidt merged commit aab8856 into dotnet:master Jul 7, 2016
@CarolEidt CarolEidt deleted the LessConservativeGtObj branch July 7, 2016 23:29
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants