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

delete wrong and unused value ti_types::TI_COUNT #10634

Merged
merged 1 commit into from
Apr 1, 2017

Conversation

sandreenko
Copy link

In the original tf commit enum ti_types was defined without include:

enum ti_types
{
    TI_ERROR,

    TI_REF,
    TI_STRUCT,
    TI_METHOD,

    TI_ONLY_ENUM = TI_METHOD,   //Enum values above this are completely described by the enumeration

    TI_BYTE,
    TI_SHORT,
    TI_INT,
    TI_LONG,
    TI_FLOAT,
    TI_DOUBLE,
    TI_NULL,

    TI_COUNT
};

So TI_COUNT was equal to the number of enum members.
Then it was changed to

enum ti_types
{
#define DEF_TI(ti, nm) ti,
#include "titypes.h"
#undef DEF_TI
    TI_ONLY_ENUM = TI_METHOD, // Enum values above this are completely described by the enumeration
    TI_COUNT
};

for verification dumps and TI_COUNT became equal to TI_ONLY_ENUM + 1, that was incorrect.
But all uses of this value were commented out so nobody saw the error.
The original purpose of TI_COUNT was to check that the enum doesn't overflow its bite size inside the typeInfo union.

#define TI_FLAG_DATA_BITS 6 #define TI_FLAG_DATA_MASK ((1 << TI_FLAG_DATA_BITS)-1) assert(TI_COUNT <= TI_FLAG_DATA_MASK);

@sandreenko
Copy link
Author

PTAL @jashook @dotnet/jit-contrib

@pgavlin
Copy link

pgavlin commented Mar 31, 2017

LGTM. Do we have an assert that checks that a ti_types value fits into TI_FLAG_DATA_BITS bits?

@sandreenko
Copy link
Author

LGTM. Do we have an assert that checks that a ti_types value fits into TI_FLAG_DATA_BITS bits?

Yes, we check it each type when it in the typeInfo constructor:
assert(tiType <= TI_FLAG_DATA_MASK);

Copy link

@jashook jashook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sandreenko sandreenko merged commit 7877d56 into dotnet:master Apr 1, 2017
@sandreenko sandreenko deleted the i-love-c branch April 1, 2017 01:12
@karelz karelz modified the milestone: 2.0.0 Aug 28, 2017
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.

5 participants