Const-string table key: bake the key bytes (into the const-string heap) and their hash at simulate time so the runtime node skips the per-lookup hash_blockz64 walk. Returns the baked key char* (and sets outHash) when keyType is string and keyExpr is an ExprConstString; nullptr otherwise (caller falls back to the regular hashing node).
| 125 | // baked key char* (and sets outHash) when keyType is string and keyExpr is an ExprConstString; |
| 126 | // nullptr otherwise (caller falls back to the regular hashing node). |
| 127 | static __forceinline char * bakeConstStringKey ( Context & context, Expression * keyExpr, |
| 128 | const TypeDecl * keyType, uint64_t & outHash ) { |
| 129 | if ( keyType->baseType != Type::tString || !keyExpr->rtti_isStringConstant() ) return nullptr; |
| 130 | char * keyStr = context.constStringHeap->impl_allocateString(static_cast<ExprConstString*>(keyExpr)->getValue()); |
| 131 | outHash = hash_blockz64((uint8_t *)keyStr); |
| 132 | return keyStr; |
| 133 | } |
| 134 | |
| 135 | struct SimulateVisitor : Visitor { |
| 136 | Context & context; |
no test coverage detected