Introduce IdentifierManager to improve PDT evaluator performance.

This commit is contained in:
2022-11-01 13:47:04 +08:00
parent 3bfc7eb643
commit 2c9be2ef1e
12 changed files with 229 additions and 145 deletions

View File

@@ -101,11 +101,10 @@ namespace Cryville.Common.Pdt {
/// <param name="offset">The offset on the span to start reading from.</param>
/// <returns>The name of an undefined identifier.</returns>
/// <exception cref="InvalidCastException">The span does not represent an undefined identifier.</exception>
public string AsIdentifier(int offset = 0) {
public int AsIdentifier(int offset = 0) {
if (Type != PdtInternalType.Undefined && Type != PdtInternalType.Array)
throw new InvalidCastException("Not an identifier");
var len = *(int*)(_ptr + offset);
return new string((char*)(_ptr + offset + sizeof(int)), 0, len);
return *(int*)(_ptr + offset);
}
internal void* TrustedAsOfLength(int len) {
if (Length < len)