コード例 #1
0
        /// <summary>
        /// This method used to run forever because of the bug
        /// </summary>
        private bool Remove(string key)
        {
            int hc = key.GetHashCode();
            Log("Making sure internal object contains hashcode key " + hc);
            if (!_internalObject.ContainsKey(hc))
            {
                return false;
            }
            int keyIndex = _keysToIndexMapping[hc].Cast<int>();
            Log("Key index is " + keyIndex);
            _keysToIndexMapping.RemoveKey(hc);
            Log("Key index removed from keys to index mapping. Rebuilding keys array");

            NativeArray<string> newKeys = new NativeArray<string>();
            int length = _keys.Length;
            int newLength = _keys.Length - 1;
            for (int i = 0; i < newLength; i++)
            {
                Log("At index: " + i);
                if (i == keyIndex)
                {
                    continue;
                }
                newKeys.Push(_keys[i]);
            }
            _keys = newKeys;

            _internalObject.RemoveKey(hc);
            Log("Dictionary::Remove done!");
            return true;
        }
コード例 #2
0
ファイル: SystemCalls.cs プロジェクト: sidecut/xaeios
 public static string GetStackTrace(Exception exception)
 {
     XaeiOSException xaeiosException = (XaeiOSException)exception;
     Continuation continuation = xaeiosException.ThrowContext;
     // TODO: Create StackWalker framework
     NativeArray<string> buffer = new NativeArray<string>();
     while (continuation != null)
     {
         buffer.Push("at ");
         string methodName = RuntimeHelpers.GetMethodNameForStackTrace(continuation.Frame.Function);
         if (methodName == null)
         {
             methodName = "[External Code]"; // TODO: Provide something more descriptive.  Maybe a code pointer?
         }
         buffer.Push(methodName);
         // TODO: Debug symbols should put C# line numbers here, rather than xaeios execution pointers
         // TODO: These execution pointers are wrong!!!, the execution pointer is set to the next execution pointer at the BEGINNING of the current execution block
         buffer.Push(":");
         buffer.Push((continuation.ExecutionPointer).ToString());
         buffer.Push("\n");
         continuation = continuation.ParentContinuation;
     }
     return buffer.Join("");
 }
コード例 #3
0
ファイル: String.cs プロジェクト: sidecut/xaeios
 internal static string NativeConcat(string[] objs)
 {
     NativeArray<string> sb = new NativeArray<string>();
     for (int i = 0; i < objs.Length; i++)
     {
         sb.Push(objs[i]);
     }
     return sb.Join("");
 }