Compare commits

..

3 Commits

Author SHA1 Message Date
neuecc
80704e489d Merge branch 'fix-il2cpp' 2020-06-09 14:52:23 +09:00
neuecc
3c0aa03643 if def 2020-06-09 14:52:04 +09:00
neuecc
37cd00d347 2.0.15? 2020-06-09 12:16:28 +09:00
7 changed files with 36 additions and 1476 deletions

View File

@@ -690,6 +690,8 @@ foreach (var (type, size) in TaskPool.GetCacheSizeInfo())
}
```
> In UnityEditor profiler shows allocation of compiler generated AsyncStateMachine but it only occurs in debug(development) build. C# Compiler generate AsyncStateMachine as class on Debug build and as struct on Release build. And also currently due to IL2CPP limitation, in IL2CPP build, UniTask do boxing AsyncStateMachine when needed so sometimes exists `one` allocation.
API References
---
UniTask's API References is hosted at [cysharp.github.io/UniTask](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.html) by [DocFX](https://dotnet.github.io/docfx/) and [Cysharp/DocfXTemplate](https://github.com/Cysharp/DocfxTemplate).

View File

@@ -45,7 +45,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{
static TaskPool<AsyncUniTaskVoid<TStateMachine>> pool;
#if ENABLE_IL2CPP
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
#else
TStateMachine stateMachine;
#endif
public Action MoveNext { get; }
@@ -113,7 +117,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{
static TaskPool<AsyncUniTask<TStateMachine>> pool;
#if ENABLE_IL2CPP
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
#else
TStateMachine stateMachine;
#endif
public Action MoveNext { get; }
@@ -224,7 +232,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{
static TaskPool<AsyncUniTask<TStateMachine, T>> pool;
#if ENABLE_IL2CPP
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
#else
TStateMachine stateMachine;
#endif
public Action MoveNext { get; }
@@ -245,7 +257,8 @@ namespace Cysharp.Threading.Tasks.CompilerServices
runnerPromiseFieldRef = result; // set runner before copied.
result.stateMachine = stateMachine; // copy struct StateMachine(in release build).
UnityEngine.Debug.Log($"SetStateMachine State:" + StateMachineUtility.GetState(stateMachine));
// UnityEngine.Debug.Log($"SetStateMachine State:" + StateMachineUtility.GetState(stateMachine));
}
@@ -268,7 +281,7 @@ namespace Cysharp.Threading.Tasks.CompilerServices
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void Run()
{
UnityEngine.Debug.Log($"MoveNext State:" + StateMachineUtility.GetState(stateMachine));
// UnityEngine.Debug.Log($"MoveNext State:" + StateMachineUtility.GetState(stateMachine));
stateMachine.MoveNext();
}

View File

@@ -19,7 +19,7 @@ namespace Cysharp.Threading.Tasks.Linq
{
internal static async UniTask<TSource[]> ToArrayAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
{
UnityEngine.Debug.Log("Called ToArray");
// UnityEngine.Debug.Log("Called ToArray");
var pool = ArrayPool<TSource>.Shared;
var array = pool.Rent(16);

View File

@@ -1,7 +1,7 @@
{
"name": "com.cysharp.unitask",
"displayName": "UniTask",
"version": "2.0.14",
"version": "2.0.15",
"unity": "2018.4",
"description": "Provides an efficient async/await integration to Unity.",
"keywords": [ "async/await", "async", "Task", "UniTask" ],

View File

@@ -413,6 +413,19 @@ public class SandboxMain : MonoBehaviour
Debug.Log("after");
}
private async UniTaskVoid ExecuteAsync()
{
Debug.Log("1");
{
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
}
Debug.Log("------------------");
{
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
Debug.Log("2");
}
}
void Start()
{
@@ -423,7 +436,7 @@ public class SandboxMain : MonoBehaviour
//StartCoroutine(TestCoroutine().ToCoroutine());
Application.logMessageReceived += Application_logMessageReceived;
// Application.logMessageReceived += Application_logMessageReceived;
@@ -432,13 +445,9 @@ public class SandboxMain : MonoBehaviour
okButton.onClick.AddListener(UniTask.UnityAction(async () =>
{
{
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
}
Debug.Log("------------------");
{
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
}
_ = ExecuteAsync();
await UniTask.Yield();
//await DelayCheck();
/*

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 370f60b2e4cd92d4faafda153c9c5f8a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: