Skip to content

Commit 800c5c6

Browse files
committed
linux build pass (built with bash on windows)
can't run yes because of assertion on _cardTable
1 parent 199f3ab commit 800c5c6

29 files changed

Lines changed: 407 additions & 248 deletions

lib/Common/Memory/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ add_library (Chakra.Common.Memory OBJECT
2222
MarkContext.cpp
2323
MemoryLogger.cpp
2424
MemoryTracking.cpp
25+
MemUtils.cpp
2526
PageAllocator.cpp
2627
Recycler.cpp
2728
RecyclerHeuristic.cpp

lib/Common/Memory/MemUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Memory::ChakraMemCopy(__bcount(sizeInBytes) void *dst, size_t sizeInBytes, __in_
4747
{
4848
if (!WriteProcessMemory(processHandle, dst, src, count, NULL))
4949
{
50-
wprintf(L"FATAL ERROR: WriteProcessMemory failed, GLE: %d\n", GetLastError());
50+
Output::Print(_u("FATAL ERROR: WriteProcessMemory failed, GLE: %d\n"), GetLastError());
5151
Js::Throw::FatalInternalError();
5252
}
5353
}

lib/Common/Memory/PageAllocator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ PageSegmentBase<T>::PageSegmentBase(PageAllocatorBase<T> * allocator, bool commi
190190

191191
template<typename T>
192192
PageSegmentBase<T>::PageSegmentBase(PageAllocatorBase<T> * allocator, void* address, uint pageCount, uint committedCount) :
193-
SegmentBase(allocator, allocator->maxAllocPageCount), decommitPageCount(0), freePageCount(0)
193+
SegmentBase<T>(allocator, allocator->maxAllocPageCount), decommitPageCount(0), freePageCount(0)
194194
{
195195
this->address = (char*)address;
196196
this->segmentPageCount = pageCount;
@@ -345,7 +345,7 @@ PageSegmentBase<TVirtualAlloc>::AllocDecommitPages(uint pageCount, T freePages,
345345
}
346346
}
347347

348-
void * ret = GetAllocator()->GetVirtualAllocator()->Alloc(pages, pageCount * AutoSystemInfo::PageSize, MEM_COMMIT, PAGE_READWRITE, this->IsInCustomHeapAllocator(), this->allocator->processHandle);
348+
void * ret = this->GetAllocator()->GetVirtualAllocator()->Alloc(pages, pageCount * AutoSystemInfo::PageSize, MEM_COMMIT, PAGE_READWRITE, this->IsInCustomHeapAllocator(), this->allocator->processHandle);
349349
if (ret != nullptr)
350350
{
351351
Assert(ret == pages);
@@ -463,7 +463,7 @@ PageSegmentBase<T>::DecommitPages(__in void * address, uint pageCount)
463463
if (!onlyUpdateState)
464464
{
465465
#pragma warning(suppress: 6250)
466-
GetAllocator()->GetVirtualAllocator()->Free(address, pageCount * AutoSystemInfo::PageSize, MEM_DECOMMIT, this->allocator->processHandle);
466+
this->GetAllocator()->GetVirtualAllocator()->Free(address, pageCount * AutoSystemInfo::PageSize, MEM_DECOMMIT, this->allocator->processHandle);
467467
}
468468

469469
Assert(decommitPageCount == (uint)this->GetCountOfDecommitPages());
@@ -484,7 +484,7 @@ PageSegmentBase<T>::DecommitFreePages(size_t pageToDecommit)
484484
this->ClearBitInFreePagesBitVector(i);
485485
this->SetBitInDecommitPagesBitVector(i);
486486
#pragma warning(suppress: 6250)
487-
GetAllocator()->GetVirtualAllocator()->Free(currentAddress, AutoSystemInfo::PageSize, MEM_DECOMMIT, this->allocator->processHandle);
487+
this->GetAllocator()->GetVirtualAllocator()->Free(currentAddress, AutoSystemInfo::PageSize, MEM_DECOMMIT, this->allocator->processHandle);
488488
decommitCount++;
489489
}
490490
currentAddress += AutoSystemInfo::PageSize;

lib/JITIDL/JITTypes.h

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@ import "wtypes.idl";
1919
#endif
2020

2121
#if defined(_M_X64) && defined(__midl)
22-
#define IDL_PAD1(num) byte struct_pad_##num
23-
#define IDL_PAD2(num) short struct_pad_##num
24-
#define IDL_PAD4(num) int struct_pad_##num
22+
#define IDL_PAD1(num) byte struct_pad_##num;
23+
#define IDL_PAD2(num) short struct_pad_##num;
24+
#define IDL_PAD4(num) int struct_pad_##num;
2525
#else
2626
#define IDL_PAD1(num)
2727
#define IDL_PAD2(num)
2828
#define IDL_PAD4(num)
2929
#endif
3030

31+
#ifndef __midl
32+
#ifndef _MSC_VER
33+
typedef unsigned char boolean;
34+
#endif
35+
#endif
36+
3137
// TODO: OOP JIT, how do we make this better?
3238
const int VTABLE_COUNT = 47;
3339
const int EQUIVALENT_TYPE_CACHE_SIZE_IDL = 8;
@@ -39,16 +45,16 @@ typedef struct TypeHandlerIDL
3945

4046
unsigned short inlineSlotCapacity;
4147
unsigned short offsetOfInlineSlots;
42-
IDL_PAD2(0);
43-
IDL_PAD4(1);
48+
IDL_PAD2(0)
49+
IDL_PAD4(1)
4450
int slotCapacity;
4551
} TypeHandlerIDL;
4652

4753
typedef struct TypeIDL
4854
{
4955
unsigned char flags;
5056
boolean isShared;
51-
IDL_PAD2(0);
57+
IDL_PAD2(0)
5258
int typeId;
5359

5460
CHAKRA_PTR libAddr;
@@ -63,9 +69,9 @@ typedef struct TypeIDL
6369
typedef struct EquivalentTypeSetIDL
6470
{
6571
boolean sortedAndDuplicatesRemoved;
66-
IDL_PAD1(0);
72+
IDL_PAD1(0)
6773
unsigned short count;
68-
IDL_PAD4(1);
74+
IDL_PAD4(1)
6975
IDL_DEF([size_is(count)]) TypeIDL ** types;
7076
} EquivalentTypeSetIDL;
7177

@@ -90,10 +96,10 @@ typedef struct JITTimeConstructorCacheIDL
9096

9197
short inlineSlotCount;
9298

93-
IDL_PAD2(0);
99+
IDL_PAD2(0)
94100
int slotCount;
95101

96-
IDL_PAD4(1);
102+
IDL_PAD4(1)
97103
TypeIDL type;
98104

99105
CHAKRA_PTR runtimeCacheAddr;
@@ -104,13 +110,13 @@ typedef struct JITTimeConstructorCacheIDL
104110
typedef struct ObjTypeSpecFldIDL
105111
{
106112
boolean inUse;
107-
IDL_PAD1(0);
113+
IDL_PAD1(0)
108114
// TODO: OOP JIT we may want to copy some of the data in these pointers
109115
unsigned short flags;
110116
unsigned short slotIndex;
111117
unsigned short fixedFieldCount;
112118
unsigned short fixedFieldInfoArraySize; // 1 (when fixedFieldCount is 0) or fixedFieldCount
113-
IDL_PAD2(1);
119+
IDL_PAD2(1)
114120
int propertyId;
115121
int typeId;
116122
unsigned int id;
@@ -125,10 +131,10 @@ typedef struct ObjTypeSpecFldIDL
125131
typedef struct PinnedTypeRefsIDL
126132
{
127133
boolean isOOPJIT;// REVIEW: remove this
128-
IDL_PAD1(0);
129-
IDL_PAD2(1);
134+
IDL_PAD1(0)
135+
IDL_PAD2(1)
130136
unsigned int count;
131-
IDL_DEF([size_is(count)]) CHAKRA_PTR typeRefs[*];
137+
IDL_DEF([size_is(count)]) CHAKRA_PTR typeRefs[IDL_DEF(*)];
132138

133139
} PinnedTypeRefsIDL;
134140

@@ -140,8 +146,8 @@ typedef struct BVUnitIDL
140146
typedef struct BVFixedIDL
141147
{
142148
unsigned int len;
143-
IDL_PAD4(0);
144-
IDL_DEF([size_is(((len - 1) >> BV_SHIFT) + 1)]) BVUnitIDL data[*];
149+
IDL_PAD4(0)
150+
IDL_DEF([size_is(((len - 1) >> BV_SHIFT) + 1)]) BVUnitIDL data[IDL_DEF(*)];
145151
} BVFixedIDL;
146152

147153
typedef struct CallSiteIDL
@@ -157,7 +163,7 @@ typedef struct ThisIDL
157163
{
158164
unsigned short valueType;
159165
byte thisType;
160-
IDL_PAD1(0);
166+
IDL_PAD1(0)
161167
} ThisIDL;
162168

163169
typedef struct FldIDL
@@ -170,11 +176,11 @@ typedef struct FldIDL
170176
typedef struct ArrayCallSiteIDL
171177
{
172178
byte bits;
173-
IDL_PAD1(0);
174-
IDL_PAD2(1);
179+
IDL_PAD1(0)
180+
IDL_PAD2(1)
175181
unsigned int functionNumber;
176182
unsigned short callSiteNumber;
177-
IDL_PAD2(2);
183+
IDL_PAD2(2)
178184
} ArrayCallSiteIDL;
179185

180186
typedef struct LdElemIDL
@@ -193,7 +199,7 @@ typedef struct StElemIDL
193199
typedef struct ProfileDataIDL
194200
{
195201
byte implicitCallFlags;
196-
IDL_PAD1(0);
202+
IDL_PAD1(0)
197203

198204
ThisIDL thisData;
199205

@@ -247,9 +253,9 @@ typedef struct ThreadContextDataIDL
247253
{
248254
boolean isThreadBound;
249255

250-
IDL_PAD1(0);
251-
IDL_PAD2(1);
252-
IDL_PAD4(2);
256+
IDL_PAD1(0)
257+
IDL_PAD2(1)
258+
IDL_PAD4(2)
253259
CHAKRA_PTR processHandle;
254260
CHAKRA_PTR chakraBaseAddress;
255261
CHAKRA_PTR crtBaseAddress;
@@ -272,7 +278,7 @@ typedef struct ScriptContextDataIDL
272278
boolean isRecyclerVerifyEnabled;
273279
boolean recyclerAllowNativeCodeBumpAllocation;
274280
boolean isSIMDEnabled;
275-
IDL_PAD1(0);
281+
IDL_PAD1(0)
276282
unsigned int recyclerVerifyPad;
277283
CHAKRA_PTR vtableAddresses[VTABLE_COUNT];
278284

@@ -311,7 +317,7 @@ typedef struct SmallSpanSequenceIDL
311317
int baseValue;
312318
unsigned int statementLength;
313319
IDL_DEF([size_is(statementLength)]) unsigned int * statementBuffer;
314-
IDL_PAD4(1);
320+
IDL_PAD4(1)
315321
unsigned int actualOffsetLength; // REVIEW: are lengths the same?
316322
IDL_DEF([size_is(actualOffsetLength)]) unsigned int * actualOffsetList;
317323
} SmallSpanSequenceIDL;
@@ -320,7 +326,7 @@ typedef struct JITLoopHeaderIDL
320326
{
321327
boolean isNested;
322328
boolean isInTry;
323-
IDL_PAD2(0);
329+
IDL_PAD2(0)
324330
unsigned int interpretCount;
325331
unsigned int startOffset;
326332
unsigned int endOffset;
@@ -332,7 +338,7 @@ typedef struct AsmJsDataIDL
332338
boolean usesHeapBuffer;
333339
unsigned short argByteSize;
334340
unsigned short argCount;
335-
IDL_PAD2(0);
341+
IDL_PAD2(0)
336342
int retType;
337343
int intConstCount;
338344
int doubleConstCount;
@@ -362,15 +368,15 @@ typedef struct PropertyRecordIDL
362368
boolean isNumeric;
363369
boolean isBound;
364370
boolean isSymbol;
365-
IDL_PAD1(0);
371+
IDL_PAD1(0)
366372
unsigned int byteCount;
367-
IDL_DEF([size_is(byteCount + sizeof(wchar_t) + (isNumeric ? sizeof(unsigned int) : 0))]) byte buffer[*];
373+
IDL_DEF([size_is(byteCount + sizeof(wchar_t) + (isNumeric ? sizeof(unsigned int) : 0))]) byte buffer[IDL_DEF(*)];
368374
} PropertyRecordIDL;
369375

370376
typedef struct FunctionJITRuntimeIDL
371377
{
372378
unsigned int clonedCacheCount;
373-
IDL_PAD4(0);
379+
IDL_PAD4(0)
374380
IDL_DEF([size_is(clonedCacheCount)]) CHAKRA_PTR * clonedInlineCaches;
375381
} FunctionJITRuntimeIDL;
376382

@@ -381,7 +387,7 @@ typedef struct PropertyIdArrayIDL
381387
boolean hadDuplicates;
382388
boolean has__proto__;
383389
boolean hasNonSimpleParams;
384-
IDL_DEF([size_is(count + extraSlotCount)]) int elements[*];
390+
IDL_DEF([size_is(count + extraSlotCount)]) int elements[IDL_DEF(*)];
385391
} PropertyIdArrayIDL;
386392

387393

@@ -414,7 +420,7 @@ typedef struct RecyclableObjectIDL
414420
typedef struct ConstTableContentIDL
415421
{
416422
unsigned int count;
417-
IDL_PAD4(0);
423+
IDL_PAD4(0)
418424
IDL_DEF([size_is(count)]) RecyclableObjectIDL** content;
419425
} ConstTableContentIDL;
420426

@@ -450,7 +456,7 @@ typedef struct FunctionBodyDataIDL
450456
unsigned short argUsedForBranch;
451457
unsigned short profiledCallSiteCount;
452458

453-
IDL_PAD2(0);
459+
IDL_PAD2(0)
454460

455461
unsigned int funcNumber;
456462
unsigned int sourceContextId;
@@ -485,7 +491,7 @@ typedef struct FunctionBodyDataIDL
485491
unsigned int auxDataCount;
486492
unsigned int auxContextDataCount;
487493

488-
IDL_PAD4(1);
494+
IDL_PAD4(1)
489495

490496
SmallSpanSequenceIDL statementMap;
491497

@@ -533,7 +539,7 @@ typedef struct FunctionJITTimeDataIDL
533539
{
534540
boolean isAggressiveInliningEnabled;
535541
boolean isInlined;
536-
IDL_PAD2(0);
542+
IDL_PAD2(0)
537543
unsigned int localFuncId;
538544
FunctionBodyDataIDL * bodyData; // TODO: oop jit, can these repeat, should we share?
539545

@@ -552,7 +558,7 @@ typedef struct FunctionJITTimeDataIDL
552558

553559
IDL_DEF([size_is(ldFldInlineeCount)]) struct FunctionJITTimeDataIDL ** ldFldInlinees;
554560

555-
IDL_PAD4(1);
561+
IDL_PAD4(1)
556562
unsigned int objTypeSpecFldInfoCount;
557563
IDL_DEF([size_is(objTypeSpecFldInfoCount)]) ObjTypeSpecFldIDL * objTypeSpecFldInfoArray;
558564

@@ -581,8 +587,8 @@ typedef struct XProcNumberPageSegment
581587
typedef struct PolymorphicInlineCacheIDL
582588
{
583589
unsigned short size;
584-
IDL_PAD2(0);
585-
IDL_PAD4(1);
590+
IDL_PAD2(0)
591+
IDL_PAD4(1)
586592
CHAKRA_PTR addr;
587593
CHAKRA_PTR inlineCachesAddr;
588594
} PolymorphicInlineCacheIDL;
@@ -636,15 +642,15 @@ typedef struct NativeDataFixupRecord
636642
unsigned int index;
637643
unsigned int length;
638644
unsigned int startOffset;
639-
IDL_PAD4(0);
645+
IDL_PAD4(0)
640646
struct NativeDataFixupEntry* updateList;
641647
} NativeDataFixupRecord;
642648

643649
typedef struct NativeDataFixupTable
644650
{
645651
unsigned int count;
646-
IDL_PAD4(0);
647-
IDL_DEF([size_is(count)]) NativeDataFixupRecord fixupRecords[*];
652+
IDL_PAD4(0)
653+
IDL_DEF([size_is(count)]) NativeDataFixupRecord fixupRecords[IDL_DEF(*)];
648654
} NativeDataFixupTable;
649655

650656

@@ -674,8 +680,8 @@ typedef struct EquivalentTypeGuardIDL
674680
typedef struct EquivalentTypeGuardOffsets
675681
{
676682
unsigned int count;
677-
IDL_PAD4(0);
678-
IDL_DEF([size_is(count)]) EquivalentTypeGuardIDL guards[*];
683+
IDL_PAD4(0)
684+
IDL_DEF([size_is(count)]) EquivalentTypeGuardIDL guards[IDL_DEF(*)];
679685

680686
} EquivalentTypeGuardOffsets;
681687

@@ -684,21 +690,21 @@ typedef struct TypeGuardTransferEntryIDL
684690
unsigned int propId;
685691
unsigned int guardsCount;
686692
struct TypeGuardTransferEntryIDL* next;
687-
IDL_DEF([size_is(guardsCount)]) int guardOffsets[*];
693+
IDL_DEF([size_is(guardsCount)]) int guardOffsets[IDL_DEF(*)];
688694
} TypeGuardTransferEntryIDL;
689695

690696
typedef struct CtorCacheTransferEntryIDL
691697
{
692698
unsigned int propId;
693699
unsigned int cacheCount;
694-
IDL_DEF([size_is(cacheCount)]) CHAKRA_PTR caches[*];
700+
IDL_DEF([size_is(cacheCount)]) CHAKRA_PTR caches[IDL_DEF(*)];
695701
} CtorCacheTransferEntryIDL;
696702

697703
typedef struct NativeDataBuffer
698704
{
699705
unsigned int len;
700706
unsigned int unused;
701-
IDL_DEF([size_is(len)]) byte data[*];
707+
IDL_DEF([size_is(len)]) byte data[IDL_DEF(*)];
702708
} NativeDataBuffer;
703709

704710
// Fields that JIT modifies
@@ -716,7 +722,7 @@ typedef struct JITOutputIDL
716722

717723
boolean hasJittedStackClosure;
718724

719-
IDL_PAD1(0);
725+
IDL_PAD1(0)
720726

721727
unsigned short pdataCount;
722728
unsigned short xdataSize;

0 commit comments

Comments
 (0)