Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address feedback:
clarify variable name
add race condition TODO
  • Loading branch information
yowl committed Jul 24, 2020
commit f2de717c7163a9e7c27e181112213854c31b24df
Original file line number Diff line number Diff line change
Expand Up @@ -1104,9 +1104,9 @@ private LLVMValueRef CastToPointerToTypeDesc(LLVMValueRef source, TypeDesc type,
return CastIfNecessary(source, LLVMTypeRef.CreatePointer(GetLLVMTypeForTypeDesc(type), 0), (name ?? "") + type.ToString());
}

private void CastingStore(LLVMValueRef address, StackEntry value, TypeDesc targetType, bool withBarrier, string targetName = null)
private void CastingStore(LLVMValueRef address, StackEntry value, TypeDesc targetType, bool withGCBarrier, string targetName = null)
{
if (withBarrier && targetType.IsGCPointer)
if (withGCBarrier && targetType.IsGCPointer)
{
CallRuntime(_method.Context, "InternalCalls", "RhpAssignRef", new StackEntry[]
{
Expand All @@ -1117,7 +1117,7 @@ private void CastingStore(LLVMValueRef address, StackEntry value, TypeDesc targe
{
var typedStoreLocation = CastToPointerToTypeDesc(address, targetType, targetName);
var llvmValue = value.ValueAsType(targetType, _builder);
if (withBarrier && IsStruct(targetType))
if (withGCBarrier && IsStruct(targetType))
{
StoreStruct(address, llvmValue, targetType, typedStoreLocation);
}
Expand All @@ -1135,6 +1135,7 @@ private static bool IsStruct(TypeDesc typeDesc)

private void StoreStruct(LLVMValueRef address, LLVMValueRef llvmValue, TypeDesc targetType, LLVMValueRef typedStoreLocation, bool childStruct = false)
{
// TODO: if this is used for anything multithreaded, this foreach and the subsequent BuildStore are susceptible to a race condition
foreach (FieldDesc f in targetType.GetFields())
{
if (f.IsStatic) continue;
Expand Down