Skip to content

Commit 237ce31

Browse files
committed
More JIT formatting
1 parent 3191bd4 commit 237ce31

File tree

125 files changed

+2529
-2974
lines changed

Some content is hidden

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

125 files changed

+2529
-2974
lines changed

src/coreclr/jit/_typeinfo.h

+79-77
Original file line numberDiff line numberDiff line change
@@ -142,70 +142,70 @@ inline ti_types JITtype2tiType(CorInfoType type)
142142
return g_ti_types_map[type];
143143
};
144144

145-
/*****************************************************************************
146-
* Declares the typeInfo class, which represents the type of an entity on the
147-
* stack, in a local variable or an argument.
148-
*
149-
* Flags: LLLLLLLLLLLLLLLLffffffffffTTTTTT
150-
*
151-
* L = local var # or instance field #
152-
* x = unused
153-
* f = flags
154-
* T = type
155-
*
156-
* The lower bits are used to store the type component, and may be one of:
157-
*
158-
* TI_* (primitive) - see tyelist.h for enumeration (BYTE, SHORT, INT..)
159-
* TI_REF - OBJREF / ARRAY use m_cls for the type
160-
* (including arrays and null objref)
161-
* TI_STRUCT - VALUE type, use m_cls for the actual type
162-
*
163-
* NOTE carefully that BYREF info is not stored here. You will never see a
164-
* TI_BYREF in this component. For example, the type component
165-
* of a "byref TI_INT" is TI_FLAG_BYREF | TI_INT.
166-
*
167-
* NOTE carefully that Generic Type Variable info is
168-
* only stored here in part. Values of type "T" (e.g "!0" in ILASM syntax),
169-
* i.e. some generic variable type, appear only when verifying generic
170-
* code. They come in two flavours: unboxed and boxed. Unboxed
171-
* is the norm, e.g. a local, field or argument of type T. Boxed
172-
* values arise from an IL instruction such as "box !0".
173-
* The EE provides type handles for each different type
174-
* variable and the EE's "canCast" operation decides casting
175-
* for boxed type variable. Thus:
176-
*
177-
* (TI_REF, <type-variable-type-handle>) == boxed type variable
178-
*
179-
* (TI_REF, <type-variable-type-handle>)
180-
* + TI_FLAG_GENERIC_TYPE_VAR == unboxed type variable
181-
*
182-
* Using TI_REF for these may seem odd but using TI_STRUCT means the
183-
* code-generation parts of the importer get confused when they
184-
* can't work out the size, GC-ness etc. of the "struct". So using TI_REF
185-
* just tricks these backend parts into generating pseudo-trees for
186-
* the generic code we're verifying. These trees then get thrown away
187-
* anyway as we do verification of generic code in import-only mode.
188-
*
189-
*/
145+
/*****************************************************************************
146+
* Declares the typeInfo class, which represents the type of an entity on the
147+
* stack, in a local variable or an argument.
148+
*
149+
* Flags: LLLLLLLLLLLLLLLLffffffffffTTTTTT
150+
*
151+
* L = local var # or instance field #
152+
* x = unused
153+
* f = flags
154+
* T = type
155+
*
156+
* The lower bits are used to store the type component, and may be one of:
157+
*
158+
* TI_* (primitive) - see tyelist.h for enumeration (BYTE, SHORT, INT..)
159+
* TI_REF - OBJREF / ARRAY use m_cls for the type
160+
* (including arrays and null objref)
161+
* TI_STRUCT - VALUE type, use m_cls for the actual type
162+
*
163+
* NOTE carefully that BYREF info is not stored here. You will never see a
164+
* TI_BYREF in this component. For example, the type component
165+
* of a "byref TI_INT" is TI_FLAG_BYREF | TI_INT.
166+
*
167+
* NOTE carefully that Generic Type Variable info is
168+
* only stored here in part. Values of type "T" (e.g "!0" in ILASM syntax),
169+
* i.e. some generic variable type, appear only when verifying generic
170+
* code. They come in two flavours: unboxed and boxed. Unboxed
171+
* is the norm, e.g. a local, field or argument of type T. Boxed
172+
* values arise from an IL instruction such as "box !0".
173+
* The EE provides type handles for each different type
174+
* variable and the EE's "canCast" operation decides casting
175+
* for boxed type variable. Thus:
176+
*
177+
* (TI_REF, <type-variable-type-handle>) == boxed type variable
178+
*
179+
* (TI_REF, <type-variable-type-handle>)
180+
* + TI_FLAG_GENERIC_TYPE_VAR == unboxed type variable
181+
*
182+
* Using TI_REF for these may seem odd but using TI_STRUCT means the
183+
* code-generation parts of the importer get confused when they
184+
* can't work out the size, GC-ness etc. of the "struct". So using TI_REF
185+
* just tricks these backend parts into generating pseudo-trees for
186+
* the generic code we're verifying. These trees then get thrown away
187+
* anyway as we do verification of generic code in import-only mode.
188+
*
189+
*/
190190

191191
#define TI_FLAG_DATA_BITS 6
192192
#define TI_FLAG_DATA_MASK ((1 << TI_FLAG_DATA_BITS) - 1)
193193

194-
// Flag indicating this item is uninitialized
195-
// Note that if UNINIT and BYREF are both set,
196-
// it means byref (uninit x) - i.e. we are pointing to an uninit <something>
194+
// Flag indicating this item is uninitialized
195+
// Note that if UNINIT and BYREF are both set,
196+
// it means byref (uninit x) - i.e. we are pointing to an uninit <something>
197197

198198
#define TI_FLAG_UNINIT_OBJREF 0x00000040
199199

200-
// Flag indicating this item is a byref <something>
200+
// Flag indicating this item is a byref <something>
201201

202202
#define TI_FLAG_BYREF 0x00000080
203203

204-
// This item is a byref generated using the readonly. prefix
205-
// to a ldelema or Address function on an array type. The
206-
// runtime type check is ignored in these cases, but the
207-
// resulting byref can only be used in order to perform a
208-
// constraint call.
204+
// This item is a byref generated using the readonly. prefix
205+
// to a ldelema or Address function on an array type. The
206+
// runtime type check is ignored in these cases, but the
207+
// resulting byref can only be used in order to perform a
208+
// constraint call.
209209

210210
#define TI_FLAG_BYREF_READONLY 0x00000100
211211

@@ -224,23 +224,23 @@ inline ti_types JITtype2tiType(CorInfoType type)
224224
// This item contains resolved token. It is used for ctor delegate optimization.
225225
#define TI_FLAG_TOKEN 0x00000400
226226

227-
// This item contains the 'this' pointer (used for tracking)
227+
// This item contains the 'this' pointer (used for tracking)
228228

229229
#define TI_FLAG_THIS_PTR 0x00001000
230230

231-
// This item is a byref to something which has a permanent home
232-
// (e.g. a static field, or instance field of an object in GC heap, as
233-
// opposed to the stack or a local variable). TI_FLAG_BYREF must also be
234-
// set. This information is useful for tail calls and return byrefs.
235-
//
236-
// Instructions that generate a permanent home byref:
237-
//
238-
// ldelema
239-
// ldflda of a ref object or another permanent home byref
240-
// array element address Get() helper
241-
// call or calli to a method that returns a byref and is verifiable or SkipVerify
242-
// dup
243-
// unbox
231+
// This item is a byref to something which has a permanent home
232+
// (e.g. a static field, or instance field of an object in GC heap, as
233+
// opposed to the stack or a local variable). TI_FLAG_BYREF must also be
234+
// set. This information is useful for tail calls and return byrefs.
235+
//
236+
// Instructions that generate a permanent home byref:
237+
//
238+
// ldelema
239+
// ldflda of a ref object or another permanent home byref
240+
// array element address Get() helper
241+
// call or calli to a method that returns a byref and is verifiable or SkipVerify
242+
// dup
243+
// unbox
244244

245245
#define TI_FLAG_BYREF_PERMANENT_HOME 0x00002000
246246

@@ -252,12 +252,12 @@ inline ti_types JITtype2tiType(CorInfoType type)
252252
// e.g. the result of a "box T" instruction.
253253
#define TI_FLAG_GENERIC_TYPE_VAR 0x00004000
254254

255-
// Number of bits local var # is shifted
255+
// Number of bits local var # is shifted
256256

257257
#define TI_FLAG_LOCAL_VAR_SHIFT 16
258258
#define TI_FLAG_LOCAL_VAR_MASK 0xFFFF0000
259259

260-
// Field info uses the same space as the local info
260+
// Field info uses the same space as the local info
261261

262262
#define TI_FLAG_FIELD_SHIFT TI_FLAG_LOCAL_VAR_SHIFT
263263
#define TI_FLAG_FIELD_MASK TI_FLAG_LOCAL_VAR_MASK
@@ -283,7 +283,8 @@ class typeInfo
283283
{
284284

285285
private:
286-
union {
286+
union
287+
{
287288
struct
288289
{
289290
ti_types type : TI_FLAG_DATA_BITS;
@@ -301,7 +302,8 @@ class typeInfo
301302
DWORD m_flags;
302303
};
303304

304-
union {
305+
union
306+
{
305307
CORINFO_CLASS_HANDLE m_cls;
306308
// Valid only for type TI_METHOD without IsToken
307309
CORINFO_METHOD_HANDLE m_method;
@@ -405,8 +407,8 @@ class typeInfo
405407
}
406408

407409
unsigned type = li.m_flags & TI_FLAG_DATA_MASK;
408-
assert(TI_ERROR <
409-
TI_ONLY_ENUM); // TI_ERROR looks like it needs more than enum. This optimises the success case a bit
410+
assert(TI_ERROR < TI_ONLY_ENUM); // TI_ERROR looks like it needs more than enum. This optimises the success
411+
// case a bit
410412
if (type > TI_ONLY_ENUM)
411413
{
412414
return true;
@@ -664,9 +666,9 @@ class typeInfo
664666
// as primitives
665667
bool IsValueClassWithClsHnd() const
666668
{
667-
if ((GetType() == TI_STRUCT) ||
668-
(m_cls && GetType() != TI_REF && GetType() != TI_METHOD &&
669-
GetType() != TI_ERROR)) // necessary because if byref bit is set, we return TI_ERROR)
669+
if ((GetType() == TI_STRUCT) || (m_cls && GetType() != TI_REF && GetType() != TI_METHOD &&
670+
GetType() != TI_ERROR)) // necessary because if byref bit is set, we return
671+
// TI_ERROR)
670672
{
671673
return true;
672674
}

src/coreclr/jit/alloc.h

+5-9
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ArenaAllocator
5252
void* allocateNewPage(size_t size);
5353

5454
static void* allocateHostMemory(size_t size, size_t* pActualSize);
55-
static void freeHostMemory(void* block, size_t size);
55+
static void freeHostMemory(void* block, size_t size);
5656

5757
#if MEASURE_MEM_ALLOC
5858
struct MemStats
@@ -125,8 +125,8 @@ class ArenaAllocator
125125

126126
public:
127127
MemStatsAllocator* getMemStatsAllocator(CompMemKind kind);
128-
void finishMemStats();
129-
void dumpMemStats(FILE* file);
128+
void finishMemStats();
129+
void dumpMemStats(FILE* file);
130130

131131
static void dumpMaxMemStats(FILE* file);
132132
static void dumpAggregateMemStats(FILE* file);
@@ -243,9 +243,7 @@ class CompAllocator
243243

244244
// Deallocate a block of memory previously allocated by `allocate`.
245245
// The arena allocator does not release memory so this doesn't do anything.
246-
void deallocate(void* p)
247-
{
248-
}
246+
void deallocate(void* p) {}
249247
};
250248

251249
// Global operator new overloads that work with CompAllocator
@@ -270,9 +268,7 @@ class CompIAllocator : public IAllocator
270268
char m_zeroLenAllocTarg;
271269

272270
public:
273-
CompIAllocator(CompAllocator alloc) : m_alloc(alloc)
274-
{
275-
}
271+
CompIAllocator(CompAllocator alloc) : m_alloc(alloc) {}
276272

277273
// Allocates a block of memory at least `sz` in size.
278274
virtual void* Alloc(size_t sz) override

src/coreclr/jit/assertionprop.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -1597,9 +1597,8 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
15971597
assertion.op1.lcl.ssaNum = op1->AsLclVarCommon()->GetSsaNum();
15981598

15991599
assert((assertion.op1.lcl.ssaNum == SsaConfig::RESERVED_SSA_NUM) ||
1600-
(assertion.op1.vn ==
1601-
vnStore->VNConservativeNormalValue(
1602-
lvaTable[lclNum].GetPerSsaData(assertion.op1.lcl.ssaNum)->m_vnPair)));
1600+
(assertion.op1.vn == vnStore->VNConservativeNormalValue(
1601+
lvaTable[lclNum].GetPerSsaData(assertion.op1.lcl.ssaNum)->m_vnPair)));
16031602

16041603
ssize_t cnsValue = 0;
16051604
GenTreeFlags iconFlags = GTF_EMPTY;
@@ -2416,8 +2415,8 @@ AssertionInfo Compiler::optAssertionGenJtrue(GenTree* tree)
24162415
ValueNum op1VN = vnStore->VNConservativeNormalValue(op1->gtVNPair);
24172416
ValueNum op2VN = vnStore->VNConservativeNormalValue(op2->gtVNPair);
24182417
// If op1 is lcl and op2 is const or lcl, create assertion.
2419-
if ((op1->gtOper == GT_LCL_VAR) &&
2420-
((op2->OperKind() & GTK_CONST) || (op2->gtOper == GT_LCL_VAR))) // Fix for Dev10 851483
2418+
if ((op1->gtOper == GT_LCL_VAR) && ((op2->OperKind() & GTK_CONST) || (op2->gtOper == GT_LCL_VAR))) // Fix for Dev10
2419+
// 851483
24212420
{
24222421
return optCreateJtrueAssertions(op1, op2, assertionKind);
24232422
}
@@ -2741,10 +2740,10 @@ AssertionIndex Compiler::optAssertionIsSubrange(GenTree* tree, IntegralRange ran
27412740
for (AssertionIndex index = 1; index <= optAssertionCount; index++)
27422741
{
27432742
AssertionDsc* curAssertion = optGetAssertion(index);
2744-
if ((optLocalAssertionProp ||
2745-
BitVecOps::IsMember(apTraits, assertions, index - 1)) && // either local prop or use propagated assertions
2746-
(curAssertion->assertionKind == OAK_SUBRANGE) &&
2747-
(curAssertion->op1.kind == O1K_LCLVAR))
2743+
if ((optLocalAssertionProp || BitVecOps::IsMember(apTraits, assertions, index - 1)) && // either local prop or
2744+
// use propagated
2745+
// assertions
2746+
(curAssertion->assertionKind == OAK_SUBRANGE) && (curAssertion->op1.kind == O1K_LCLVAR))
27482747
{
27492748
// For local assertion prop use comparison on locals, and use comparison on vns for global prop.
27502749
bool isEqual = optLocalAssertionProp
@@ -3087,7 +3086,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
30873086
//
30883087
GenTree* Compiler::optConstantAssertionProp(AssertionDsc* curAssertion,
30893088
GenTreeLclVarCommon* tree,
3090-
Statement* stmt DEBUGARG(AssertionIndex index))
3089+
Statement* stmt DEBUGARG(AssertionIndex index))
30913090
{
30923091
const unsigned lclNum = tree->GetLclNum();
30933092

@@ -3304,7 +3303,7 @@ bool Compiler::optAssertionProp_LclVarTypeCheck(GenTree* tree, LclVarDsc* lclVar
33043303
//
33053304
GenTree* Compiler::optCopyAssertionProp(AssertionDsc* curAssertion,
33063305
GenTreeLclVarCommon* tree,
3307-
Statement* stmt DEBUGARG(AssertionIndex index))
3306+
Statement* stmt DEBUGARG(AssertionIndex index))
33083307
{
33093308
const AssertionDsc::AssertionDscOp1& op1 = curAssertion->op1;
33103309
const AssertionDsc::AssertionDscOp2& op2 = curAssertion->op2;
@@ -3841,8 +3840,9 @@ GenTree* Compiler::optAssertionPropGlobal_RelOp(ASSERT_VALARG_TP assertions, Gen
38413840
{
38423841
printf("\nVN relop based copy assertion prop in " FMT_BB ":\n", compCurBB->bbNum);
38433842
printf("Assertion index=#%02u: V%02d.%02d %s V%02d.%02d\n", index, op1->AsLclVar()->GetLclNum(),
3844-
op1->AsLclVar()->GetSsaNum(), (curAssertion->assertionKind == OAK_EQUAL) ? "==" : "!=",
3845-
op2->AsLclVar()->GetLclNum(), op2->AsLclVar()->GetSsaNum());
3843+
op1->AsLclVar()->GetSsaNum(),
3844+
(curAssertion->assertionKind == OAK_EQUAL) ? "==" : "!=", op2->AsLclVar()->GetLclNum(),
3845+
op2->AsLclVar()->GetSsaNum());
38463846
gtDispTree(tree, nullptr, nullptr, true);
38473847
}
38483848
#endif
@@ -4168,7 +4168,7 @@ GenTree* Compiler::optAssertionProp_Ind(ASSERT_VALARG_TP assertions, GenTree* tr
41684168
// If both VN and assertion table yield a matching assertion, "pVnBased"
41694169
// is only set and the return value is "NO_ASSERTION_INDEX."
41704170
//
4171-
bool Compiler::optAssertionIsNonNull(GenTree* op,
4171+
bool Compiler::optAssertionIsNonNull(GenTree* op,
41724172
ASSERT_VALARG_TP assertions DEBUGARG(bool* pVnBased)
41734173
DEBUGARG(AssertionIndex* pIndex))
41744174
{
@@ -4204,7 +4204,7 @@ bool Compiler::optAssertionIsNonNull(GenTree* op,
42044204
// Returns:
42054205
// index of assertion, or NO_ASSERTION_INDEX
42064206
//
4207-
AssertionIndex Compiler::optAssertionIsNonNullInternal(GenTree* op,
4207+
AssertionIndex Compiler::optAssertionIsNonNullInternal(GenTree* op,
42084208
ASSERT_VALARG_TP assertions DEBUGARG(bool* pVnBased))
42094209
{
42104210

src/coreclr/jit/bitset.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,7 @@ class BitSetOpsWithCounter
432432
Env m_env;
433433

434434
public:
435-
Iter(Env env, BitSetValueArgType bs) : m_iter(env, bs), m_env(env)
436-
{
437-
}
435+
Iter(Env env, BitSetValueArgType bs) : m_iter(env, bs), m_env(env) {}
438436

439437
bool NextElem(unsigned* pElem)
440438
{

0 commit comments

Comments
 (0)