/// <summary>Constructor used when creating a child instance</summary> private BytesToNameCanonicalizer(com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer parent, bool intern, int seed, bool failOnDoS, com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer.TableInfo state) { _parent = parent; _seed = seed; _intern = intern; _failOnDoS = failOnDoS; _tableInfo = null; // not used by child tables // Then copy shared state _count = state.count; _hashMask = state.mainHashMask; _hash = state.mainHash; _mainNames = state.mainNames; _collList = state.collList; _collCount = state.collCount; _collEnd = state.collEnd; _longestCollisionList = state.longestCollisionList; // and then set other state to reflect sharing status _needRehash = false; _hashShared = true; _namesShared = true; _collListShared = true; }
/// <summary>Constructor used when creating a child instance</summary> private ByteQuadsCanonicalizer(com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer parent, bool intern, int seed, bool failOnDoS, com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer.TableInfo state) { _parent = parent; _seed = seed; _intern = intern; _failOnDoS = failOnDoS; _tableInfo = null; // not used by child tables // Then copy shared state _count = state.count; _hashSize = state.size; _secondaryStart = _hashSize << 2; // right after primary area _tertiaryStart = _secondaryStart + (_secondaryStart >> 1); // right after secondary _tertiaryShift = state.tertiaryShift; _hashArea = state.mainHash; _names = state.names; _spilloverEnd = state.spilloverEnd; _longNameOffset = state.longNameOffset; // and then set other state to reflect sharing status _needRehash = false; _hashShared = true; }
/// <summary> /// Constructor used for creating per-<code>JsonFactory</code> "root" /// symbol tables: ones used for merging and sharing common symbols /// </summary> /// <param name="sz">Initial hash area size</param> /// <param name="intern"> /// Whether Strings contained should be /// <see cref="string.Intern()"/> /// ed /// </param> /// <param name="seed"> /// Random seed valued used to make it more difficult to cause /// collisions (used for collision-based DoS attacks). /// </param> private BytesToNameCanonicalizer(int sz, bool intern, int seed, bool failOnDoS) { // 64k entries == 256k mem /* /********************************************************** /* Linkage, needed for merging symbol tables /********************************************************** */ /* /********************************************************** /* Configuration /********************************************************** */ /* /********************************************************** /* Main table state /********************************************************** */ // // // First, global information // // // Then information regarding primary hash array and its // // // matching Name array // // // Then the collision/spill-over area info // // // Info regarding pending rehashing... /* /********************************************************** /* Sharing, versioning /********************************************************** */ // // // Which of the buffers may be shared (and are copy-on-write)? /* /********************************************************** /* Bit of DoS detection goodness /********************************************************** */ /* /********************************************************** /* Life-cycle: constructors /********************************************************** */ _parent = null; _seed = seed; _intern = intern; _failOnDoS = failOnDoS; // Sanity check: let's now allow hash sizes below certain minimum value if (sz < MIN_HASH_SIZE) { sz = MIN_HASH_SIZE; } else { /* Also; size must be 2^N; otherwise hash algorithm won't * work... so let's just pad it up, if so */ if ((sz & (sz - 1)) != 0) { // only true if it's 2^N int curr = MIN_HASH_SIZE; while (curr < sz) { curr += curr; } sz = curr; } } _tableInfo = new java.util.concurrent.atomic.AtomicReference<com.fasterxml.jackson.core.sym.BytesToNameCanonicalizer.TableInfo >(initTableInfo(sz)); }
/// <summary> /// Constructor used for creating per-<code>JsonFactory</code> "root" /// symbol tables: ones used for merging and sharing common symbols /// </summary> /// <param name="sz">Initial primary hash area size</param> /// <param name="intern"> /// Whether Strings contained should be /// <see cref="string.Intern()"/> /// ed /// </param> /// <param name="seed"> /// Random seed valued used to make it more difficult to cause /// collisions (used for collision-based DoS attacks). /// </param> private ByteQuadsCanonicalizer(int sz, bool intern, int seed, bool failOnDoS) { // private static final int DEFAULT_T_SIZE = 256; // 64k entries == 2M mem hash area /* /********************************************************** /* Linkage, needed for merging symbol tables /********************************************************** */ /* /********************************************************** /* Configuration /********************************************************** */ /* /********************************************************** /* First, main hash area info /********************************************************** */ /* /********************************************************** /* Then information on collisions etc /********************************************************** */ /* /********************************************************** /* Sharing, versioning /********************************************************** */ // // // Which of the buffers may be shared (and are copy-on-write)? /* /********************************************************** /* Bit of DoS detection goodness /********************************************************** */ /* /********************************************************** /* Life-cycle: constructors /********************************************************** */ _parent = null; _seed = seed; _intern = intern; _failOnDoS = failOnDoS; // Sanity check: let's now allow hash sizes below certain minimum value if (sz < MIN_HASH_SIZE) { sz = MIN_HASH_SIZE; } else { // Also; size must be 2^N; otherwise hash algorithm won't // work... so let's just pad it up, if so if ((sz & (sz - 1)) != 0) { // only true if it's 2^N int curr = MIN_HASH_SIZE; while (curr < sz) { curr += curr; } sz = curr; } } _tableInfo = new java.util.concurrent.atomic.AtomicReference<com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer.TableInfo >(com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer.TableInfo.createInitial( sz)); }