From 79ccb33586c13f89a4ebd2bed7bddda2c0ef082b Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 25 Nov 2019 06:48:19 -0800 Subject: [PATCH] Mintest changes --- BeefBuild/BeefProj.toml | 2 +- BeefTools/TestDLL/TestDLL.cpp | 8 +- IDE/BeefProj.toml | 2 +- IDE/mintest/BeefProj.toml | 30 ++- IDE/mintest/BeefSpace.toml | 83 ++++++- IDE/mintest/minlib/src/System/String.bf | 12 + IDE/mintest/mintest2/src/main4.bf | 26 +- IDE/mintest/src/main.bf | 6 + IDE/mintest/src/main3.bf | 302 ++++++++---------------- IDEHelper/Tests/BeefSpace.toml | 3 + 10 files changed, 253 insertions(+), 221 deletions(-) diff --git a/BeefBuild/BeefProj.toml b/BeefBuild/BeefProj.toml index a2aff879..4b864dd5 100644 --- a/BeefBuild/BeefProj.toml +++ b/BeefBuild/BeefProj.toml @@ -20,7 +20,7 @@ TargetName = "$(ProjectName)_d" OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib Rpcrt4.lib Ole32.lib" CLibType = "Dynamic" BeefLibType = "DynamicDebug" -DebugCommandArguments = "-platform=x86_64-none-linux-android21 -workspace=C:/proj/Android/BeefTest/app/src/main/cpp/../beef/\"" +DebugCommandArguments = "-proddir=..\\..\\IDEHelper\\Tests -test" DebugWorkingDirectory = "c:\\beef\\ide\\mintest" EnvironmentVars = ["_NO_DEBUG_HEAP=1"] PreprocessorMacros = ["DEBUG", "CLI"] diff --git a/BeefTools/TestDLL/TestDLL.cpp b/BeefTools/TestDLL/TestDLL.cpp index 6661e997..fc8d64e0 100644 --- a/BeefTools/TestDLL/TestDLL.cpp +++ b/BeefTools/TestDLL/TestDLL.cpp @@ -1,4 +1,5 @@ -#define _ENABLE_ATOMIC_ALIGNMENT_FIX +//2 +#define _ENABLE_ATOMIC_ALIGNMENT_FIX #include #include @@ -82,7 +83,7 @@ StructA GetSA() return StructA(); } -// THIS IS VERSION 3. +// THIS IS VERSION 6. extern "C" __declspec(dllexport) void Test2(int aa, int bb, int cc, int dd) { @@ -107,9 +108,6 @@ __declspec(dllexport) void Test2(int aa, int bb, int cc, int dd) int a = 123; int b = 234; int c = 345; - - //GetA(); - //GetB(); } extern "C" diff --git a/IDE/BeefProj.toml b/IDE/BeefProj.toml index 9f62fbd9..98e11371 100644 --- a/IDE/BeefProj.toml +++ b/IDE/BeefProj.toml @@ -25,7 +25,7 @@ OtherLinkFlags = "" TargetDirectory = "$(WorkspaceDir)/dist" TargetName = "BeefIDE_d" OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib" -DebugCommandArguments = "-proddir=C:\\Beef\\IDE" +DebugCommandArguments = "-proddir=C:\\_Beef\\TestApp" DebugWorkingDirectory = "c:\\Beef\\IDE\\Tests\\EmptyTest" EnvironmentVars = ["_NO_DEBUG_HEAP=1"] diff --git a/IDE/mintest/BeefProj.toml b/IDE/mintest/BeefProj.toml index 55773dab..38d31656 100644 --- a/IDE/mintest/BeefProj.toml +++ b/IDE/mintest/BeefProj.toml @@ -12,7 +12,7 @@ Description = "Mintest" [Configs.Debug.Win64] CLibType = "Static" -BeefLibType = "Static" +BeefLibType = "DynamicDebug" StackSize = 4194304 DebugCommandArguments = "hey=\"yo man\" zag= zoogles boof stoopers \"\"\"abc efg\"\"\"" DebugWorkingDirectory = ".\\" @@ -26,6 +26,13 @@ OtherLinkFlags = "" CLibType = "Static" BeefLibType = "Static" +[Configs.Debug.iOS] +BuildKind = "StaticLib" + +[Configs.Debug.aarch64-none-linux-android21] +BuildKind = "StaticLib" +RelocType = "PIC" + [Configs.Release.Win64] OtherLinkFlags = "$(LinkFlags) C:\\Beef\\BeefTools\\TestDLL\\x64\\Debug\\TestDLL.lib" DebugCommandArguments = "hey=\"yo man\" zag= zoogles boof stoopers \"abc efg\"" @@ -33,6 +40,13 @@ DebugCommandArguments = "hey=\"yo man\" zag= zoogles boof stoopers \"abc efg [Configs.Release.WinFart] OtherLinkFlags = "" +[Configs.Release.iOS] +BuildKind = "StaticLib" + +[Configs.Release.aarch64-none-linux-android21] +BuildKind = "StaticLib" +RelocType = "PIC" + [Configs.Paranoid.Win32] CLibType = "Static" BeefLibType = "Static" @@ -47,6 +61,13 @@ OtherLinkFlags = "" CLibType = "Static" BeefLibType = "Static" +[Configs.Paranoid.iOS] +BuildKind = "StaticLib" + +[Configs.Paranoid.aarch64-none-linux-android21] +BuildKind = "StaticLib" +RelocType = "PIC" + [Configs.Test.Win32] CLibType = "Static" BeefLibType = "Static" @@ -61,6 +82,13 @@ OtherLinkFlags = "" CLibType = "Static" BeefLibType = "Static" +[Configs.Test.iOS] +BuildKind = "StaticLib" + +[Configs.Test.aarch64-none-linux-android21] +BuildKind = "StaticLib" +RelocType = "PIC" + [ProjectFolder] [[ProjectFolder.Items]] diff --git a/IDE/mintest/BeefSpace.toml b/IDE/mintest/BeefSpace.toml index e105e041..38bb6c23 100644 --- a/IDE/mintest/BeefSpace.toml +++ b/IDE/mintest/BeefSpace.toml @@ -14,8 +14,10 @@ ConfigSelections = {mintest2 = {Enabled = false}} IntermediateType = "ObjectAndIRCode" COptimizationLevel = "Og" +[[Configs.Debug.Win64.DistinctOptions]] +Filter = "System.String" + [Configs.Debug.WinFart] -MachineType = "x86" Toolset = "GNU" EmitDebugInfo = "No" EmitDynamicCastCheck = false @@ -25,6 +27,23 @@ EnableRealtimeLeakCheck = false AllowHotSwapping = false AllocStackTraceDepth = 0 +[Configs.Debug.Linux64] +Toolset = "GNU" +EnableRealtimeLeakCheck = false + +[Configs.Debug.macOS] +Toolset = "GNU" +EnableRealtimeLeakCheck = false + +[Configs.Debug.iOS] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +IntermediateType = "Bitcode" + +[Configs.Debug.aarch64-none-linux-android21] +Toolset = "GNU" +EnableRealtimeLeakCheck = false + [Configs.Release.Win32] Toolset = "GNU" BfOptimizationLevel = "OgPlus" @@ -39,7 +58,6 @@ IntermediateType = "ObjectAndIRCode" COptimizationLevel = "O3" [Configs.Release.WinFart] -MachineType = "x86" Toolset = "GNU" BfOptimizationLevel = "O0" EmitDebugInfo = "No" @@ -47,6 +65,19 @@ AllocStackTraceDepth = 0 IncrementalBuild = true COptimizationLevel = "O0" +[Configs.Release.Linux64] +Toolset = "GNU" + +[Configs.Release.macOS] +Toolset = "GNU" + +[Configs.Release.iOS] +Toolset = "GNU" +IntermediateType = "Bitcode" + +[Configs.Release.aarch64-none-linux-android21] +Toolset = "GNU" + [Configs.Test.Win32] Toolset = "GNU" BfSIMDSetting = "None" @@ -71,7 +102,6 @@ COptimizationLevel = "O2" ConfigSelections = {mintest = {Config = "Debug"}} [Configs.Test.WinFart] -MachineType = "x86" Toolset = "GNU" BuildKind = "Normal" EmitDebugInfo = "No" @@ -83,6 +113,27 @@ AllowHotSwapping = false AllocStackTraceDepth = 0 COptimizationLevel = "O2" +[Configs.Test.Linux64] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +COptimizationLevel = "O2" + +[Configs.Test.macOS] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +COptimizationLevel = "O2" + +[Configs.Test.iOS] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +IntermediateType = "Bitcode" +COptimizationLevel = "O2" + +[Configs.Test.aarch64-none-linux-android21] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +COptimizationLevel = "O2" + [Configs.Paranoid.Win32] Toolset = "GNU" EmitDynamicCastCheck = false @@ -103,7 +154,6 @@ COptimizationLevel = "O2" ConfigSelections = {mintest2 = {Enabled = false}} [Configs.Paranoid.WinFart] -MachineType = "x86" Toolset = "GNU" EmitDebugInfo = "No" EmitDynamicCastCheck = false @@ -114,3 +164,28 @@ EnableSideStack = false AllowHotSwapping = false AllocStackTraceDepth = 0 COptimizationLevel = "O2" + +[Configs.Paranoid.Linux64] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +EnableSideStack = false +COptimizationLevel = "O2" + +[Configs.Paranoid.macOS] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +EnableSideStack = false +COptimizationLevel = "O2" + +[Configs.Paranoid.iOS] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +EnableSideStack = false +IntermediateType = "Bitcode" +COptimizationLevel = "O2" + +[Configs.Paranoid.aarch64-none-linux-android21] +Toolset = "GNU" +EnableRealtimeLeakCheck = false +EnableSideStack = false +COptimizationLevel = "O2" diff --git a/IDE/mintest/minlib/src/System/String.bf b/IDE/mintest/minlib/src/System/String.bf index c455f35a..8685bb22 100644 --- a/IDE/mintest/minlib/src/System/String.bf +++ b/IDE/mintest/minlib/src/System/String.bf @@ -982,6 +982,18 @@ namespace System } ptr } + + /*public mixin ToNewCStr() + { + char8* ptr = null; + if (mPtr != null) + { + ptr = new:mixin char8[mLength + 1]* (?); + Internal.MemCpy(ptr, mPtr, mLength); + ptr[mLength] = 0; + } + ptr + }*/ } static diff --git a/IDE/mintest/mintest2/src/main4.bf b/IDE/mintest/mintest2/src/main4.bf index f4c8827e..4e230658 100644 --- a/IDE/mintest/mintest2/src/main4.bf +++ b/IDE/mintest/mintest2/src/main4.bf @@ -1,12 +1,34 @@ using System; // Zapples +struct StructA +{ + public T mVal; -static + public static bool operator< (StructA lhs, TOther rhs) where bool : operator T < TOther + { + return true; + } + + /*public static TResult operator+(StructA lhs, TOther rhs) + where TResult = operator T * TOther + { + return lhs.mVal * rhs; + }*/ +} + +class TestA { - + public void Bloop() + { + StructA sa; + sa.mVal = 1.23f; + let res = sa < 100; + + int a = 1 * 2; + } } /*class Mintest2 diff --git a/IDE/mintest/src/main.bf b/IDE/mintest/src/main.bf index 7d1c256e..d054a15b 100644 --- a/IDE/mintest/src/main.bf +++ b/IDE/mintest/src/main.bf @@ -196,6 +196,12 @@ namespace Hey.Dude.Bro public static int Main(String[] args) { + TypeCode tc = .Boolean; + + PrintF("Hey\n"); + + //Test2(1, 2, 3, 4); + /*IHashable ih = (int32)TypeCode.Boolean; let hashCode = ih.GetHashCode();*/ diff --git a/IDE/mintest/src/main3.bf b/IDE/mintest/src/main3.bf index 3c458b4f..d6345046 100644 --- a/IDE/mintest/src/main3.bf +++ b/IDE/mintest/src/main3.bf @@ -9,270 +9,158 @@ using System.Threading; //#define A //#define B -class ClassA -{ - public virtual void ClassA0() - { - } - - public virtual void ClassA1() - { - } -} - -class ClassB -{ -} - -#if B -class ClassC : ClassB -{ - public override void ToString(System.String strBuffer) - { - base.ToString(strBuffer); - } -} -#elif A -class ClassC : ClassA -{ - public override void ToString(System.String strBuffer) - { - base.ToString(strBuffer); - } -} -#endif - -class ClassD -{ - public String mStr; - int mA6; - - public virtual void Poo() - { - PrintF("Poo\n"); - } - - public virtual void Poo2() - { - PrintF("Poo2\n"); - } -} - -class ClassD2 -{ - int mA5; - -} - -class ClassE : ClassD -{ - public void Zog2() - { - } -} - -class ClassF : ClassE -{ -} - -[NoDiscard("Use this value!")] -struct TestStruct +struct StructA { public int mA; - public int mB; -} -class Bloozer -{ - int mA; -} - -enum Zorf : IDisposable -{ - case A; - case B; - - public void Dispose() + public static StructA operator+(StructA lhs, float rhs) { + StructA newVal = .(); + newVal.mA = lhs.mA + (int)rhs; + return newVal; } } -class IFaceA +struct StructB { - public static void Fart() + public int mA; + + public static bool operator==(StructA lhs, StructB rhs) { + return lhs.mA == rhs.mA; } } -class Zlips : IFaceA, IDisposable -{ - static void Fart() - { - } - public void Dispose() +struct StructC +{ + public int mA; + + public static operator StructD(StructC val) { - PrintF("Disposed"); + StructD conv; + conv.mA = val.mA; + return conv; } } -class Testo +struct StructD { - public this() + public int mA; + + public static operator StructD(StructC val) { - PrintF("Testo this %p\n", this); - } public ~this() - { - PrintF("Testo ~this %p\n", this); + StructC conv; + conv.mA = val.mA; + return conv; } } -class Norg +struct StructE { - public String mVal; - public int32 mA; - public int32 mB; + public int mA; - public int32 GetIt(int32 a, int32 b, int32 c) + public static operator StructD(StructE val) { - return a + b + c + mA; + StructC conv; + conv.mA = val.mA; + return conv; } +} - public static int32 GetIt(Blurg bl, int32 a, int32 b, int32 c) - { - return a + b + c + bl.mA; - } +class ClassA +{ + public int mA; +} - public virtual int Zorf +struct StructK +{ + +} + +struct StructL : StructK +{ + public int mA; +} + +struct Checker +{ + public static int CheckIt(int* iPtr, int len) { - set + int acc = 0; + for (int i < len) { - mA = (.)value; - } - - get - { - return mA; + acc += iPtr[i]; } + return acc; } - public virtual int GetVal() + public static int CheckItSpan(int* iPtr, int len) { - return 99; - } -} + Span span = .(iPtr, len); -class Norg2 : Norg -{ - public int mVal2; - - public int Zof => 123; - - public int GetIt() => 234; - - /*public override int Zorf - { - set + int acc = 0; + for (int i < len) { - base.Zorf = 123; + acc += span[i]; } - }*/ + return acc; + } -} - -enum TestEnumA -{ - A, - B, - C -} - -[AttributeUsage(.Field, .ReflectAttribute, ReflectUser=.All)] -struct FoofAttribute : Attribute -{ - int32 mA; - int32 mB; - int32 mC; - - public this(int32 a, int32 b, int32 c) + public static int CheckItSpanOpt(int* iPtr, int len) { - mA = a; - mB = b; - mC = c; + OptSpan span = .(iPtr, len); + + int acc = 0; + for (int i < len) + { + acc += span[i]; + } + return acc; } } struct Blurg { - [Foof(1, 2, 3)] - public String mVal; - public int32 mA; - public int32 mB; - - public this() + static int GetHash(T val) where T : IHashable { - mVal = "z"; - mA = 111; - mB = 222; + return val.GetHashCode(); } - void TestIt(String a, String b) + public static int32 LongCall( + int abcdefghijklmnopqrstuvwxyz0, + int abcdefghijklmnopqrstuvwxyz1, + int abcdefghijklmnopqrstuvwxyz2, + int abcdefghijklmnopqrstuvwxyz3, + int abcdefghijklmnopqrstuvwxyz4, + int abcdefghijklmnopqrstuvwxyz5, + int abcdefghijklmnopqrstuvwxyz6, + int abcdefghijklmnopqrstuvwxyz7, + int abcdefghijklmnopqrstuvwxyz8, + int abcdefghijklmnopqrstuvwxyz9 + ) { - } - - TestStruct GetTS() - { - return .(); - } - - static void Test(int a, int b) - { - PrintF("a0"); - } - - [Error("This property can only be accessed directly from a typeof() expression")] - static void Test(int a, int b, int c) - { - } - - public static Result GetMe() - { - return 123; + return 0; } public static int32 Hey() { - let t = typeof(Self); - let field = t.GetField("mVal").Value; - var foofAttrib = field.GetCustomAttribute(); + TypeCode tc = .Boolean; + //int h = GetHash(tc); - //for (TypeCode tc < .Boolean) + var val = tc.Underlying; + var valRef = ref tc.UnderlyingRef; - //Test(1, 2, 3); + let maxVal = typeof(TypeCode).MaxValue; + + int a = 100; + + String str = new:gCRTAlloc String(a); + + delete:gCRTAlloc str; - /*TestEnumA ta = .A; - IHashable ih = ta;*/ return 123; } } - -struct Florg -{ - int mA = 123; - - public void Dispose() mut - { - } -} - -class CustomAlloc -{ - public void* Alloc(int size, int align) - { - //return Internal.Malloc(size); - return null; - } -} - diff --git a/IDEHelper/Tests/BeefSpace.toml b/IDEHelper/Tests/BeefSpace.toml index 8c29f4ab..d008e4ea 100644 --- a/IDEHelper/Tests/BeefSpace.toml +++ b/IDEHelper/Tests/BeefSpace.toml @@ -6,6 +6,7 @@ StartupProject = "Tests" [Configs.Debug.Win64] BfOptimizationLevel = "O0" +IntermediateType = "ObjectAndIRCode" [Configs.Test.Win64] IntermediateType = "ObjectAndIRCode" @@ -14,9 +15,11 @@ ConfigSelections = {TestsB = {Config = "Test"}} [Configs.Test.Linux64] IntermediateType = "ObjectAndIRCode" +COptimizationLevel = "O2" ConfigSelections = {TestsB = {Config = "Test"}} [Configs.Test.macOS] +COptimizationLevel = "O2" ConfigSelections = {TestsB = {Config = "Test"}} [Configs.TestFail.Win64]