diff --git a/BeefLibs/corlib/src/IO/StreamReader.bf b/BeefLibs/corlib/src/IO/StreamReader.bf index 07a8fd3b..963d9f37 100644 --- a/BeefLibs/corlib/src/IO/StreamReader.bf +++ b/BeefLibs/corlib/src/IO/StreamReader.bf @@ -210,8 +210,6 @@ namespace System.IO public this(StreamReader streamReader) { - Debug.WriteLine("ReadLineTask this {0}", this); - mStreamReader = streamReader; ThreadPool.QueueUserWorkItem(new => Proc); } diff --git a/IDEHelper/Compiler/BfContext.cpp b/IDEHelper/Compiler/BfContext.cpp index 65a15d97..fd149eb2 100644 --- a/IDEHelper/Compiler/BfContext.cpp +++ b/IDEHelper/Compiler/BfContext.cpp @@ -447,7 +447,7 @@ bool BfContext::ProcessWorkList(bool onlyReifiedTypes, bool onlyReifiedMethods) auto typeInst = methodSpecializationRequest.mType->ToTypeInstance(); module->GetMethodInstance(methodSpecializationRequest.mType->ToTypeInstance(), methodSpecializationRequest.mMethodDef, methodSpecializationRequest.mMethodGenericArguments, - (BfGetMethodInstanceFlags)(methodSpecializationRequest.mFlags | BfGetMethodInstanceFlag_ResultNotUsed)); + (BfGetMethodInstanceFlags)(methodSpecializationRequest.mFlags | BfGetMethodInstanceFlag_ResultNotUsed), methodSpecializationRequest.mForeignType); didWork = true; } } @@ -505,7 +505,11 @@ bool BfContext::ProcessWorkList(bool onlyReifiedTypes, bool onlyReifiedMethods) module->PopulateType(owner, BfPopulateType_Full); if (methodInstance->mDeclModule != NULL) + { + if (!mCompiler->mIsResolveOnly) + BF_ASSERT(!methodInstance->mIsReified || methodInstance->mDeclModule->mIsModuleMutable); ProcessMethod(methodInstance); + } } workIdx = mMethodWorkList.RemoveAt(workIdx); @@ -2452,7 +2456,7 @@ void BfContext::QueueMethodSpecializations(BfTypeInstance* typeInst, bool checkS specializationRequest->mFromModuleRevision = typeInst->mModule->mRevision; specializationRequest->mMethodDef = methodRef.mTypeInstance->mTypeDef->mMethods[methodRef.mMethodNum]; specializationRequest->mMethodGenericArguments = methodRef.mMethodGenericArguments; - specializationRequest->mType = methodRef.mTypeInstance; + specializationRequest->mType = methodRef.mTypeInstance; BfLogSysM("QueueMethodSpecializations typeInst %p specializationRequest %p methodDef %p fromModule %p\n", typeInst, specializationRequest, methodDef, specializationRequest->mFromModule); } diff --git a/IDEHelper/Compiler/BfContext.h b/IDEHelper/Compiler/BfContext.h index 08e92bfa..bdd6db61 100644 --- a/IDEHelper/Compiler/BfContext.h +++ b/IDEHelper/Compiler/BfContext.h @@ -47,12 +47,14 @@ public: BfMethodDef* mMethodDef; BfTypeVector mMethodGenericArguments; BfGetMethodInstanceFlags mFlags; + BfTypeInstance* mForeignType; public: BfMethodSpecializationRequest() { mMethodDef = NULL; mFlags = BfGetMethodInstanceFlag_None; + mForeignType = NULL; } }; diff --git a/IDEHelper/Compiler/BfMangler.cpp b/IDEHelper/Compiler/BfMangler.cpp index 6ac0ac58..c18d974e 100644 --- a/IDEHelper/Compiler/BfMangler.cpp +++ b/IDEHelper/Compiler/BfMangler.cpp @@ -2011,7 +2011,10 @@ void BfMSMangler::Mangle(StringImpl& name, bool is64Bit, BfMethodInstance* metho } else { - AddStr(mangleContext, name, methodDef->mName); + if ((!mangleContext.mCPPMangle) && (!methodDef->mIsMutating) && (!methodDef->mIsStatic) && (methodInst->GetOwner()->IsValueType())) + AddStr(mangleContext, name, methodDef->mName + "__im"); + else + AddStr(mangleContext, name, methodDef->mName); } if ((methodInst->mMethodDef->mDeclaringType->mPartialIdx != -1) && (methodInst->mMethodDef->mDeclaringType->IsExtension()) && @@ -2044,12 +2047,15 @@ void BfMSMangler::Mangle(StringImpl& name, bool is64Bit, BfMethodInstance* metho name += StrFormat("%d$", declType->mPartialIdx); } - if (methodInst->mMangleWithIdx) - name += StrFormat("i%d$", methodInst->mMethodDef->mIdx); - if (methodDef->mCheckedKind == BfCheckedKind_Checked) - name += "CHK$"; - else if (methodDef->mCheckedKind == BfCheckedKind_Unchecked) - name += "UCHK$"; + if (!mangleContext.mCPPMangle) + { + if (methodInst->mMangleWithIdx) + name += StrFormat("i%d$", methodInst->mMethodDef->mIdx); + if (methodDef->mCheckedKind == BfCheckedKind_Checked) + name += "CHK$"; + else if (methodDef->mCheckedKind == BfCheckedKind_Unchecked) + name += "UCHK$"; + } /*if ((methodInst->mMethodInstanceGroup->mOwner->mTypeDef->IsGlobalsContainer()) && (methodInst->mMethodDef->mMethodDeclaration == NULL)) { diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index db1cecf8..d2ddfc62 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -1180,7 +1180,7 @@ void BfModule::StartNewRevision(RebuildKind rebuildKind, bool force) mExtensionCount = 0; mRevision = mCompiler->mRevision; mRebuildIdx++; - ClearModuleData(); + ClearModuleData(!force); // Clear this here, not in ClearModuleData, so we preserve those references even after writing out module if (rebuildKind != BfModule::RebuildKind_None) // Leave string pool refs for when we need to use things like [LinkName("")] methods bofore re-reification @@ -12170,6 +12170,7 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM specializationRequest->mMethodGenericArguments = methodGenericArguments; specializationRequest->mType = typeInst; specializationRequest->mFlags = flags; + specializationRequest->mForeignType = foreignType; } } @@ -22770,7 +22771,7 @@ void BfModule::ReportMemory(MemReporter* memReporter) // ClearModuleData is called immediately after the module is compiled, so don't clear out any data that needs to // be transient through the next compile -void BfModule::ClearModuleData() +void BfModule::ClearModuleData(bool clearTransientData) { BfLogSysM("ClearModuleData %p\n", this); @@ -22782,7 +22783,8 @@ void BfModule::ClearModuleData() mDICompileUnit = BfIRMDNode(); mIsModuleMutable = false; - mIncompleteMethodCount = 0; + if (clearTransientData) + mIncompleteMethodCount = 0; mHasGenericMethods = false; // We don't want to clear these because we want it to persist through module extensions- diff --git a/IDEHelper/Compiler/BfModule.h b/IDEHelper/Compiler/BfModule.h index 0973f07c..eb5fdc01 100644 --- a/IDEHelper/Compiler/BfModule.h +++ b/IDEHelper/Compiler/BfModule.h @@ -1883,7 +1883,7 @@ public: void EnsureIRBuilder(bool dbgVerifyCodeGen = false); void DbgFinish(); BfIRValue CreateForceLinkMarker(BfModule* module, String* outName); - void ClearModuleData(); + void ClearModuleData(bool clearTransientData = true); void DisownMethods(); void ClearModule(); void StartExtension(); // For new method specializations diff --git a/IDEHelper/Tests/LibA/src/LibA0.bf b/IDEHelper/Tests/LibA/src/LibA0.bf index 108c6c37..1b8704b9 100644 --- a/IDEHelper/Tests/LibA/src/LibA0.bf +++ b/IDEHelper/Tests/LibA/src/LibA0.bf @@ -102,7 +102,7 @@ class LibClassA public this() { - Debug.WriteLine("LibA.LibClassA()\n"); + //Debug.WriteLine("LibA.LibClassA()\n"); mA += 100; } @@ -118,7 +118,7 @@ class LibClassA public static int32 GetVal(int32 val, int32 magic, String str) { - Debug.WriteLine("GetVal: {}", str); + //Debug.WriteLine("GetVal: {}", str); sMagic += magic; return val; } diff --git a/IDEHelper/Tests/src/Indexers.bf b/IDEHelper/Tests/src/Indexers.bf index 6fa32bf7..ae4fd683 100644 --- a/IDEHelper/Tests/src/Indexers.bf +++ b/IDEHelper/Tests/src/Indexers.bf @@ -50,7 +50,7 @@ namespace Tests } [Test] - public static void Hey() + public static void TestBasics() { ClassB cc = scope ClassC(); ClassB cb = cc; @@ -64,6 +64,7 @@ namespace Tests StructA sa = default; let sa2 = sa; + Test.Assert(sa[0] == 2); Test.Assert(sa2[0] == 1); }