Skip to content

Commit a5b44a1

Browse files
author
Jianchun Xu
committed
[MERGE #1756 @jianchun] swb: annotate m_dynamicInterpreterThunk
Merge pull request #1756 from jianchun:swbfix1 Fix NoWriteBarrierPtr::operator= signature. Annotate `PointerNoBarrier(void) m_dynamicInterpreterThunk`. Fix related usages.
2 parents 93e1cf6 + 1def932 commit a5b44a1

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

lib/Common/Memory/RecyclerPointers.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class NoWriteBarrierPtr
4646
T** operator&() { return &value; }
4747

4848
// Setters
49-
NoWriteBarrierPtr& operator=(T const& value)
49+
NoWriteBarrierPtr& operator=(T * value)
5050
{
5151
this->value = value;
5252
return *this;
@@ -98,15 +98,15 @@ class WriteBarrierPtr
9898
T const** AddressOf() const { return &ptr; }
9999
T** AddressOf() { return &ptr; }
100100

101-
T const** operator&() const
102-
{
103-
static_assert(false, "Might need to set barrier for this operation, and use AddressOf instead.");
104-
return &ptr;
101+
T const** operator&() const
102+
{
103+
static_assert(false, "Might need to set barrier for this operation, and use AddressOf instead.");
104+
return &ptr;
105105
}
106-
T** operator&()
106+
T** operator&()
107107
{
108-
static_assert(false, "Might need to set barrier for this operation, and use AddressOf instead.");
109-
return &ptr;
108+
static_assert(false, "Might need to set barrier for this operation, and use AddressOf instead.");
109+
return &ptr;
110110
}
111111

112112
// Setters

lib/Runtime/Base/FunctionBody.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4308,7 +4308,7 @@ namespace Js
43084308
#if DYNAMIC_INTERPRETER_THUNK
43094309
if (m_isAsmJsFunction && m_dynamicInterpreterThunk)
43104310
{
4311-
m_scriptContext->ReleaseDynamicAsmJsInterpreterThunk((BYTE*)this->m_dynamicInterpreterThunk, true);
4311+
m_scriptContext->ReleaseDynamicAsmJsInterpreterThunk(this->m_dynamicInterpreterThunk, true);
43124312
this->m_dynamicInterpreterThunk = nullptr;
43134313
}
43144314
#endif
@@ -7329,11 +7329,11 @@ namespace Js
73297329
{
73307330
if (m_isAsmJsFunction)
73317331
{
7332-
m_scriptContext->ReleaseDynamicAsmJsInterpreterThunk((BYTE*)this->m_dynamicInterpreterThunk, /*addtoFreeList*/!isScriptContextClosing);
7332+
m_scriptContext->ReleaseDynamicAsmJsInterpreterThunk(this->m_dynamicInterpreterThunk, /*addtoFreeList*/!isScriptContextClosing);
73337333
}
73347334
else
73357335
{
7336-
m_scriptContext->ReleaseDynamicInterpreterThunk((BYTE*)this->m_dynamicInterpreterThunk, /*addtoFreeList*/!isScriptContextClosing);
7336+
m_scriptContext->ReleaseDynamicInterpreterThunk(this->m_dynamicInterpreterThunk, /*addtoFreeList*/!isScriptContextClosing);
73377337
}
73387338
}
73397339
}

lib/Runtime/Base/FunctionBody.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ namespace Js
17711771
Field(bool) m_utf8SourceHasBeenSet; // start of UTF8-encoded source
17721772
Field(uint) m_sourceIndex; // index into the scriptContext's list of saved sources
17731773
#if DYNAMIC_INTERPRETER_THUNK
1774-
void* m_dynamicInterpreterThunk; // Unique 'thunk' for every interpreted function - used for ETW symbol decoding.
1774+
PointerNoBarrier(void) m_dynamicInterpreterThunk; // Unique 'thunk' for every interpreted function - used for ETW symbol decoding.
17751775
#endif
17761776
Field(uint) m_cbStartOffset; // pUtf8Source is this many bytes from the start of the scriptContext's source buffer.
17771777

@@ -2699,16 +2699,16 @@ namespace Js
26992699
uint GetForInLoopDepth() const { return this->GetCountField(CounterFields::ForInLoopDepth); }
27002700
uint SetForInLoopDepth(uint count) { return this->SetCountField(CounterFields::ForInLoopDepth, count); }
27012701

2702-
bool AllocProfiledForInLoopCount(ProfileId* profileId)
2702+
bool AllocProfiledForInLoopCount(ProfileId* profileId)
27032703
{
2704-
ProfileId profiledForInLoopCount = this->GetProfiledForInLoopCount();
2705-
if (profiledForInLoopCount != Constants::NoProfileId)
2706-
{
2707-
*profileId = profiledForInLoopCount;
2708-
this->IncreaseCountField(CounterFields::ProfiledForInLoopCount);
2709-
return true;
2710-
}
2711-
return false;
2704+
ProfileId profiledForInLoopCount = this->GetProfiledForInLoopCount();
2705+
if (profiledForInLoopCount != Constants::NoProfileId)
2706+
{
2707+
*profileId = profiledForInLoopCount;
2708+
this->IncreaseCountField(CounterFields::ProfiledForInLoopCount);
2709+
return true;
2710+
}
2711+
return false;
27122712
}
27132713
ProfileId GetProfiledForInLoopCount() const { return (ProfileId)this->GetCountField(CounterFields::ProfiledForInLoopCount); }
27142714
void SetProfiledForInLoopCount(ProfileId count) { this->SetCountField(CounterFields::ProfiledForInLoopCount, count); }
@@ -3029,7 +3029,7 @@ namespace Js
30293029
ForInCache * GetForInCacheArray();
30303030
void CleanUpForInCache(bool isShutdown);
30313031

3032-
void AllocateInlineCache();
3032+
void AllocateInlineCache();
30333033
InlineCache * GetInlineCache(uint index);
30343034
bool CanFunctionObjectHaveInlineCaches();
30353035
void** GetInlineCaches();
@@ -3040,8 +3040,8 @@ namespace Js
30403040
IsInstInlineCache * GetIsInstInlineCache(uint index);
30413041
PolymorphicInlineCache * GetPolymorphicInlineCache(uint index);
30423042
PolymorphicInlineCache * CreateNewPolymorphicInlineCache(uint index, PropertyId propertyId, InlineCache * inlineCache);
3043-
PolymorphicInlineCache * CreateBiggerPolymorphicInlineCache(uint index, PropertyId propertyId);
3044-
private:
3043+
PolymorphicInlineCache * CreateBiggerPolymorphicInlineCache(uint index, PropertyId propertyId);
3044+
private:
30453045

30463046
void ResetInlineCaches();
30473047
PolymorphicInlineCache * CreatePolymorphicInlineCache(uint index, uint16 size);

lib/Runtime/Base/ScriptContext.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4853,15 +4853,15 @@ void ScriptContext::RegisterPrototypeChainEnsuredToHaveOnlyWritableDataPropertie
48534853
return this->interpreterThunkEmitter->IsInHeap((void*)address);
48544854
}
48554855

4856-
void ScriptContext::ReleaseDynamicInterpreterThunk(BYTE* address, bool addtoFreeList)
4856+
void ScriptContext::ReleaseDynamicInterpreterThunk(void* address, bool addtoFreeList)
48574857
{
4858-
this->interpreterThunkEmitter->Release(address, addtoFreeList);
4858+
this->interpreterThunkEmitter->Release((BYTE*)address, addtoFreeList);
48594859
}
48604860

4861-
void ScriptContext::ReleaseDynamicAsmJsInterpreterThunk(BYTE* address, bool addtoFreeList)
4861+
void ScriptContext::ReleaseDynamicAsmJsInterpreterThunk(void* address, bool addtoFreeList)
48624862
{
48634863
#ifdef ASMJS_PLAT
4864-
this->asmJsInterpreterThunkEmitter->Release(address, addtoFreeList);
4864+
this->asmJsInterpreterThunkEmitter->Release((BYTE*)address, addtoFreeList);
48654865
#else
48664866
Assert(UNREACHED);
48674867
#endif

lib/Runtime/Base/ScriptContext.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -910,15 +910,15 @@ namespace Js
910910
void SetDirectHostTypeId(TypeId typeId) {directHostTypeId = typeId; }
911911
TypeId GetDirectHostTypeId() const { return directHostTypeId; }
912912

913-
intptr_t GetRemoteScriptAddr()
913+
intptr_t GetRemoteScriptAddr()
914914
{
915915
#if ENABLE_OOP_NATIVE_CODEGEN
916916
if (!m_remoteScriptContextAddr)
917917
{
918918
InitializeRemoteScriptContext();
919919
}
920920
#endif
921-
return m_remoteScriptContextAddr;
921+
return m_remoteScriptContextAddr;
922922
}
923923

924924
char16 const * GetUrl() const { return url; }
@@ -1657,8 +1657,8 @@ namespace Js
16571657
JavascriptMethod GetNextDynamicAsmJsInterpreterThunk(PVOID* ppDynamicInterpreterThunk);
16581658
JavascriptMethod GetNextDynamicInterpreterThunk(PVOID* ppDynamicInterpreterThunk);
16591659
BOOL IsDynamicInterpreterThunk(JavascriptMethod address);
1660-
void ReleaseDynamicInterpreterThunk(BYTE* address, bool addtoFreeList);
1661-
void ReleaseDynamicAsmJsInterpreterThunk(BYTE* address, bool addtoFreeList);
1660+
void ReleaseDynamicInterpreterThunk(void* address, bool addtoFreeList);
1661+
void ReleaseDynamicAsmJsInterpreterThunk(void* address, bool addtoFreeList);
16621662
#endif
16631663

16641664
static Var DebugProfileProbeThunk(RecyclableObject* function, CallInfo callInfo, ...);
@@ -1770,7 +1770,7 @@ namespace Js
17701770

17711771
virtual bool IsRecyclerVerifyEnabled() const override;
17721772
virtual uint GetRecyclerVerifyPad() const override;
1773-
1773+
17741774
virtual Js::Var* GetModuleExportSlotArrayAddress(uint moduleIndex, uint slotIndex) override;
17751775

17761776
Js::SourceTextModuleRecord* GetModuleRecord(uint moduleId) const

0 commit comments

Comments
 (0)