// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.fasterxml.jackson.core.sym; import com.fasterxml.jackson.core.util.InternCache; import java.util.Arrays; import java.util.concurrent.atomic.AtomicReference; public final class ByteQuadsCanonicalizer { private static final class TableInfo { public final int count; public final int longNameOffset; public final int mainHash[]; public final String names[]; public final int size; public final int spilloverEnd; public final int tertiaryShift; public static TableInfo createInitial(int i) { int j = i << 3; return new TableInfo(i, 0, ByteQuadsCanonicalizer._calcTertiaryShift(i), new int[j], new String[i << 1], j - i, j); } public TableInfo(int i, int j, int k, int ai[], String as[], int l, int i1) { size = i; count = j; tertiaryShift = k; mainHash = ai; names = as; spilloverEnd = l; longNameOffset = i1; } public TableInfo(ByteQuadsCanonicalizer bytequadscanonicalizer) { size = bytequadscanonicalizer._hashSize; count = bytequadscanonicalizer._count; tertiaryShift = bytequadscanonicalizer._tertiaryShift; mainHash = bytequadscanonicalizer._hashArea; names = bytequadscanonicalizer._names; spilloverEnd = bytequadscanonicalizer._spilloverEnd; longNameOffset = bytequadscanonicalizer._longNameOffset; } } private static final int DEFAULT_T_SIZE = 64; static final int MAX_ENTRIES_FOR_REUSE = 6000; private static final int MAX_T_SIZE = 0x10000; static final int MIN_HASH_SIZE = 16; private static final int MULT = 33; private static final int MULT2 = 0x1003f; private static final int MULT3 = 31; protected int _count; protected final boolean _failOnDoS; protected int _hashArea[]; private boolean _hashShared; protected int _hashSize; protected boolean _intern; protected int _longNameOffset; protected String _names[]; private transient boolean _needRehash; protected final ByteQuadsCanonicalizer _parent; protected int _secondaryStart; private final int _seed; protected int _spilloverEnd; protected final AtomicReference _tableInfo; protected int _tertiaryShift; protected int _tertiaryStart; private ByteQuadsCanonicalizer(int i, boolean flag, int j, boolean flag1) { _parent = null; _seed = j; _intern = flag; _failOnDoS = flag1; if (i >= 16) goto _L2; else goto _L1 _L1: j = 16; _L4: _tableInfo = new AtomicReference(TableInfo.createInitial(j)); return; _L2: j = i; if ((i - 1 & i) != 0) { j = 16; while (j < i) { j += j; } } if (true) goto _L4; else goto _L3 _L3: } private ByteQuadsCanonicalizer(ByteQuadsCanonicalizer bytequadscanonicalizer, boolean flag, int i, boolean flag1, TableInfo tableinfo) { _parent = bytequadscanonicalizer; _seed = i; _intern = flag; _failOnDoS = flag1; _tableInfo = null; _count = tableinfo.count; _hashSize = tableinfo.size; _secondaryStart = _hashSize << 2; _tertiaryStart = _secondaryStart + (_secondaryStart >> 1); _tertiaryShift = tableinfo.tertiaryShift; _hashArea = tableinfo.mainHash; _names = tableinfo.names; _spilloverEnd = tableinfo.spilloverEnd; _longNameOffset = tableinfo.longNameOffset; _needRehash = false; _hashShared = true; } private int _appendLongName(int ai[], int i) { int j = _longNameOffset; if (j + i > _hashArea.length) { int l = _hashArea.length; int i1 = Math.min(4096, _hashSize); int k = _hashArea.length; l = Math.max((j + i) - l, i1); _hashArea = Arrays.copyOf(_hashArea, k + l); } System.arraycopy(ai, 0, _hashArea, j, i); _longNameOffset = _longNameOffset + i; return j; } private final int _calcOffset(int i) { return (i & _hashSize - 1) << 2; } static int _calcTertiaryShift(int i) { i >>= 2; if (i < 64) { return 4; } if (i <= 256) { return 5; } return i > 1024 ? 7 : 6; } private int _findOffsetForAdd(int i) { int ai[]; int j; j = _calcOffset(i); ai = _hashArea; if (ai[j + 3] != 0) goto _L2; else goto _L1 _L1: i = j; _L4: return i; _L2: int i1 = _secondaryStart + ((j >> 3) << 2); i = i1; if (ai[i1 + 3] != 0) { int j1 = _tertiaryStart + ((j >> _tertiaryShift + 2) << _tertiaryShift); int k1 = _tertiaryShift; i = j1; label0: do { label1: { int k = i; if (k >= j1 + (1 << k1)) { break label1; } i = k; if (ai[k + 3] == 0) { break label0; } i = k + 4; } } while (true); } if (true) goto _L4; else goto _L3 _L3: i = _spilloverEnd; _spilloverEnd = _spilloverEnd + 4; int l = _hashSize; if (_spilloverEnd >= l << 3) { if (_failOnDoS) { _reportTooManyCollisions(); } _needRehash = true; } return i; } private String _findSecondary(int i, int j) { Object obj; int ai[]; int k; int l; obj = null; k = _tertiaryStart + ((i >> _tertiaryShift + 2) << _tertiaryShift); ai = _hashArea; l = _tertiaryShift; i = k; _L7: if (i >= k + (1 << l)) goto _L2; else goto _L1 _L1: int i1 = ai[i + 3]; if (j != ai[i] || 1 != i1) goto _L4; else goto _L3 _L3: String s = _names[i >> 2]; _L6: return s; _L4: s = obj; if (i1 == 0) goto _L6; else goto _L5 _L5: i += 4; goto _L7 _L2: i = _spilloverStart(); _L9: s = obj; if (i >= _spilloverEnd) goto _L6; else goto _L8 _L8: if (j == ai[i] && 1 == ai[i + 3]) { return _names[i >> 2]; } i += 4; goto _L9 } private String _findSecondary(int i, int j, int k) { Object obj; int ai[]; int l; int i1; obj = null; l = _tertiaryStart + ((i >> _tertiaryShift + 2) << _tertiaryShift); ai = _hashArea; i1 = _tertiaryShift; i = l; _L7: if (i >= l + (1 << i1)) goto _L2; else goto _L1 _L1: int j1 = ai[i + 3]; if (j != ai[i] || k != ai[i + 1] || 2 != j1) goto _L4; else goto _L3 _L3: String s = _names[i >> 2]; _L6: return s; _L4: s = obj; if (j1 == 0) goto _L6; else goto _L5 _L5: i += 4; goto _L7 _L2: i = _spilloverStart(); _L9: s = obj; if (i >= _spilloverEnd) goto _L6; else goto _L8 _L8: if (j == ai[i] && k == ai[i + 1] && 2 == ai[i + 3]) { return _names[i >> 2]; } i += 4; goto _L9 } private String _findSecondary(int i, int j, int k, int l) { Object obj; int ai[]; int i1; int j1; obj = null; i1 = _tertiaryStart + ((i >> _tertiaryShift + 2) << _tertiaryShift); ai = _hashArea; j1 = _tertiaryShift; i = i1; _L7: if (i >= i1 + (1 << j1)) goto _L2; else goto _L1 _L1: int k1 = ai[i + 3]; if (j != ai[i] || k != ai[i + 1] || l != ai[i + 2] || 3 != k1) goto _L4; else goto _L3 _L3: String s = _names[i >> 2]; _L6: return s; _L4: s = obj; if (k1 == 0) goto _L6; else goto _L5 _L5: i += 4; goto _L7 _L2: i = _spilloverStart(); _L9: s = obj; if (i >= _spilloverEnd) goto _L6; else goto _L8 _L8: if (j == ai[i] && k == ai[i + 1] && l == ai[i + 2] && 3 == ai[i + 3]) { return _names[i >> 2]; } i += 4; goto _L9 } private String _findSecondary(int i, int j, int ai[], int k) { Object obj; int ai1[]; int l; int i1; obj = null; l = _tertiaryStart + ((i >> _tertiaryShift + 2) << _tertiaryShift); ai1 = _hashArea; i1 = _tertiaryShift; i = l; _L7: if (i >= l + (1 << i1)) goto _L2; else goto _L1 _L1: int j1 = ai1[i + 3]; if (j != ai1[i] || k != j1) goto _L4; else goto _L3 _L3: String s = _names[i >> 2]; _L6: return s; _L4: s = obj; if (j1 == 0) goto _L6; else goto _L5 _L5: i += 4; goto _L7 _L2: i = _spilloverStart(); _L9: s = obj; if (i >= _spilloverEnd) goto _L6; else goto _L8 _L8: if (j == ai1[i] && k == ai1[i + 3] && _verifyLongName(ai, k, ai1[i + 1])) { return _names[i >> 2]; } i += 4; goto _L9 } private final int _spilloverStart() { int i = _hashSize; return (i << 3) - i; } private boolean _verifyLongName(int ai[], int i, int j) { int ai1[]; int k; int i1; int l1; int i2; int j2; int k2; int l2; int i3; boolean flag1; flag1 = false; ai1 = _hashArea; k2 = 0; l2 = 0; i3 = 0; i2 = 0; k = j; i1 = j; j2 = j; l1 = j; i; JVM INSTR tableswitch 4 8: default 68 // 4 180 // 5 154 // 6 128 // 7 102 // 8 80; goto _L1 _L2 _L3 _L4 _L5 _L6 _L1: boolean flag = _verifyLongName2(ai, i, j); _L8: return flag; _L6: if (ai[0] != ai1[j]) { return false; } i2 = 0 + 1; k = j + 1; _L5: if (ai[i2] != ai1[k]) { return false; } k2 = i2 + 1; i1 = k + 1; _L4: if (ai[k2] != ai1[i1]) { return false; } l2 = k2 + 1; j2 = i1 + 1; _L3: if (ai[l2] != ai1[j2]) { return false; } i3 = l2 + 1; l1 = j2 + 1; _L2: j = i3 + 1; int l = ai[i3]; i = l1 + 1; if (l != ai1[l1]) { return false; } l = j + 1; int j1 = ai[j]; j = i + 1; flag = flag1; if (j1 == ai1[i]) { i = l + 1; l = ai[l]; int k1 = j + 1; if (l != ai1[j]) { return false; } flag = flag1; if (ai[i] == ai1[k1]) { return true; } } if (true) goto _L8; else goto _L7 _L7: } private boolean _verifyLongName2(int ai[], int i, int j) { int k = 0; do { int l = k + 1; if (ai[k] != _hashArea[j]) { return false; } if (l >= i) { return true; } k = l; j++; } while (true); } private void _verifyNeedForRehash() { if (_count > _hashSize >> 1 && (_spilloverEnd - _spilloverStart() >> 2 > _count + 1 >> 7 || (double)_count > (double)_hashSize * 0.80000000000000004D)) { _needRehash = true; } } private void _verifySharing() { if (_hashShared) { _hashArea = Arrays.copyOf(_hashArea, _hashArea.length); _names = (String[])Arrays.copyOf(_names, _names.length); _hashShared = false; } if (_needRehash) { rehash(); } } public static ByteQuadsCanonicalizer createRoot() { long l = System.currentTimeMillis(); return createRoot((int)l + (int)(l >>> 32) | 1); } protected static ByteQuadsCanonicalizer createRoot(int i) { return new ByteQuadsCanonicalizer(64, true, i, true); } private void mergeChild(TableInfo tableinfo) { int i = tableinfo.count; TableInfo tableinfo1 = (TableInfo)_tableInfo.get(); if (i == tableinfo1.count) { return; } if (i > 6000) { tableinfo = TableInfo.createInitial(64); } _tableInfo.compareAndSet(tableinfo1, tableinfo); } private void nukeSymbols(boolean flag) { _count = 0; _spilloverEnd = _spilloverStart(); _longNameOffset = _hashSize << 3; if (flag) { Arrays.fill(_hashArea, 0); Arrays.fill(_names, null); } } private void rehash() { int ai2[]; String as[]; int i; int j; int k; int l; _needRehash = false; _hashShared = false; ai2 = _hashArea; as = _names; i = _hashSize; k = _count; j = i + i; l = _spilloverEnd; if (j <= 0x10000) goto _L2; else goto _L1 _L1: nukeSymbols(true); _L8: return; _L2: int ai[]; _hashArea = new int[ai2.length + (i << 3)]; _hashSize = j; _secondaryStart = j << 2; _tertiaryStart = _secondaryStart + (_secondaryStart >> 1); _tertiaryShift = _calcTertiaryShift(j); _names = new String[as.length << 1]; nukeSymbols(false); j = 0; ai = new int[16]; i = 0; _L4: int i1; if (i >= l) { continue; /* Loop/switch isn't completed */ } i1 = ai2[i + 3]; if (i1 != 0) { break; /* Loop/switch isn't completed */ } _L6: i += 4; if (true) goto _L4; else goto _L3 _L3: j++; String s = as[i >> 2]; switch (i1) { default: int ai1[] = ai; if (i1 > ai.length) { ai1 = new int[i1]; } System.arraycopy(ai2, ai2[i + 1], ai1, 0, i1); addName(s, ai1, i1); ai = ai1; break; case 1: // '\001' ai[0] = ai2[i]; addName(s, ai, 1); break; case 2: // '\002' ai[0] = ai2[i]; ai[1] = ai2[i + 1]; addName(s, ai, 2); break; case 3: // '\003' ai[0] = ai2[i]; ai[1] = ai2[i + 1]; ai[2] = ai2[i + 2]; addName(s, ai, 3); break; } if (true) goto _L6; else goto _L5 _L5: if (j == k) goto _L8; else goto _L7 _L7: throw new IllegalStateException((new StringBuilder()).append("Failed rehash(): old count=").append(k).append(", copyCount=").append(j).toString()); } protected void _reportTooManyCollisions() { if (_hashSize <= 1024) { return; } else { throw new IllegalStateException((new StringBuilder()).append("Spill-over slots in symbol table with ").append(_count).append(" entries, hash area of ").append(_hashSize).append(" slots is now full (all ").append(_hashSize >> 3).append(" slots -- suspect a DoS attack based on hash collisions.").append(" You can disable the check via `JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW`").toString()); } } public String addName(String s, int i) { _verifySharing(); String s1 = s; if (_intern) { s1 = InternCache.instance.intern(s); } int j = _findOffsetForAdd(calcHash(i)); _hashArea[j] = i; _hashArea[j + 3] = 1; _names[j >> 2] = s1; _count = _count + 1; _verifyNeedForRehash(); return s1; } public String addName(String s, int i, int j) { _verifySharing(); String s1 = s; if (_intern) { s1 = InternCache.instance.intern(s); } int k; if (j == 0) { k = calcHash(i); } else { k = calcHash(i, j); } k = _findOffsetForAdd(k); _hashArea[k] = i; _hashArea[k + 1] = j; _hashArea[k + 3] = 2; _names[k >> 2] = s1; _count = _count + 1; _verifyNeedForRehash(); return s1; } public String addName(String s, int i, int j, int k) { _verifySharing(); String s1 = s; if (_intern) { s1 = InternCache.instance.intern(s); } int l = _findOffsetForAdd(calcHash(i, j, k)); _hashArea[l] = i; _hashArea[l + 1] = j; _hashArea[l + 2] = k; _hashArea[l + 3] = 3; _names[l >> 2] = s1; _count = _count + 1; _verifyNeedForRehash(); return s1; } public String addName(String s, int ai[], int i) { String s1; _verifySharing(); s1 = s; if (_intern) { s1 = InternCache.instance.intern(s); } i; JVM INSTR tableswitch 1 3: default 52 // 1 136 // 2 169 // 3 216; goto _L1 _L2 _L3 _L4 _L1: int k = calcHash(ai, i); int j = _findOffsetForAdd(k); _hashArea[j] = k; k = _appendLongName(ai, i); _hashArea[j + 1] = k; _hashArea[j + 3] = i; i = j; _L6: _names[i >> 2] = s1; _count = _count + 1; _verifyNeedForRehash(); return s1; _L2: i = _findOffsetForAdd(calcHash(ai[0])); _hashArea[i] = ai[0]; _hashArea[i + 3] = 1; continue; /* Loop/switch isn't completed */ _L3: i = _findOffsetForAdd(calcHash(ai[0], ai[1])); _hashArea[i] = ai[0]; _hashArea[i + 1] = ai[1]; _hashArea[i + 3] = 2; continue; /* Loop/switch isn't completed */ _L4: i = _findOffsetForAdd(calcHash(ai[0], ai[1], ai[2])); _hashArea[i] = ai[0]; _hashArea[i + 1] = ai[1]; _hashArea[i + 2] = ai[2]; _hashArea[i + 3] = 3; if (true) goto _L6; else goto _L5 _L5: } public int bucketCount() { return _hashSize; } public int calcHash(int i) { i ^= _seed; i += i >>> 16; i ^= i << 3; return i + (i >>> 12); } public int calcHash(int i, int j) { i += i >>> 15; i = (i ^ i >>> 9) + j * 33 ^ _seed; i += i >>> 16; i ^= i >>> 4; return i + (i << 3); } public int calcHash(int i, int j, int k) { i ^= _seed; i = ((i + (i >>> 9)) * 31 + j) * 33; i = i + (i >>> 15) ^ k; i += i >>> 4; i += i >>> 15; return i ^ i << 9; } public int calcHash(int ai[], int i) { if (i < 4) { throw new IllegalArgumentException(); } int j = ai[0] ^ _seed; j = j + (j >>> 9) + ai[1]; j = (j + (j >>> 15)) * 33 ^ ai[2]; int l = j + (j >>> 4); for (int k = 3; k < i; k++) { int i1 = ai[k]; l += i1 ^ i1 >> 21; } i = l * 0x1003f; i += i >>> 19; return i ^ i << 5; } public String findName(int i) { Object obj; int ai[]; int j; int k; obj = null; j = _calcOffset(calcHash(i)); ai = _hashArea; k = ai[j + 3]; if (k != 1) goto _L2; else goto _L1 _L1: if (ai[j] != i) goto _L4; else goto _L3 _L3: String s = _names[j >> 2]; _L5: return s; _L2: s = obj; if (k == 0) goto _L5; else goto _L4 _L4: int i1; int l = _secondaryStart + ((j >> 3) << 2); i1 = ai[l + 3]; if (i1 == 1) { if (ai[l] == i) { return _names[l >> 2]; } break; /* Loop/switch isn't completed */ } s = obj; if (i1 == 0) goto _L5; else goto _L6 _L6: return _findSecondary(j, i); } public String findName(int i, int j) { Object obj; int ai[]; int k; int l; obj = null; k = _calcOffset(calcHash(i, j)); ai = _hashArea; l = ai[k + 3]; if (l != 2) goto _L2; else goto _L1 _L1: if (i != ai[k] || j != ai[k + 1]) goto _L4; else goto _L3 _L3: String s = _names[k >> 2]; _L5: return s; _L2: s = obj; if (l == 0) goto _L5; else goto _L4 _L4: int j1; int i1 = _secondaryStart + ((k >> 3) << 2); j1 = ai[i1 + 3]; if (j1 == 2) { if (i == ai[i1] && j == ai[i1 + 1]) { return _names[i1 >> 2]; } break; /* Loop/switch isn't completed */ } s = obj; if (j1 == 0) goto _L5; else goto _L6 _L6: return _findSecondary(k, i, j); } public String findName(int i, int j, int k) { Object obj; int ai[]; int l; int i1; obj = null; l = _calcOffset(calcHash(i, j, k)); ai = _hashArea; i1 = ai[l + 3]; if (i1 != 3) goto _L2; else goto _L1 _L1: if (i != ai[l] || ai[l + 1] != j || ai[l + 2] != k) goto _L4; else goto _L3 _L3: String s = _names[l >> 2]; _L5: return s; _L2: s = obj; if (i1 == 0) goto _L5; else goto _L4 _L4: int k1; int j1 = _secondaryStart + ((l >> 3) << 2); k1 = ai[j1 + 3]; if (k1 == 3) { if (i == ai[j1] && ai[j1 + 1] == j && ai[j1 + 2] == k) { return _names[j1 >> 2]; } break; /* Loop/switch isn't completed */ } s = obj; if (k1 == 0) goto _L5; else goto _L6 _L6: return _findSecondary(l, i, j, k); } public String findName(int ai[], int i) { Object obj = null; if (i >= 4) goto _L2; else goto _L1 _L1: if (i != 3) goto _L4; else goto _L3 _L3: String s = findName(ai[0], ai[1], ai[2]); _L6: return s; _L4: if (i == 2) { return findName(ai[0], ai[1]); } else { return findName(ai[0]); } _L2: int j = calcHash(ai, i); int k = _calcOffset(j); int ai1[] = _hashArea; int l = ai1[k + 3]; if (j == ai1[k] && l == i && _verifyLongName(ai, i, ai1[k + 1])) { return _names[k >> 2]; } s = obj; if (l != 0) { int i1 = _secondaryStart + ((k >> 3) << 2); int j1 = ai1[i1 + 3]; if (j == ai1[i1] && j1 == i && _verifyLongName(ai, i, ai1[i1 + 1])) { return _names[i1 >> 2]; } s = obj; if (l != 0) { return _findSecondary(k, j, ai, i); } } if (true) goto _L6; else goto _L5 _L5: } public int hashSeed() { return _seed; } public ByteQuadsCanonicalizer makeChild(int i) { return new ByteQuadsCanonicalizer(this, com.fasterxml.jackson.core.JsonFactory.Feature.INTERN_FIELD_NAMES.enabledIn(i), _seed, com.fasterxml.jackson.core.JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW.enabledIn(i), (TableInfo)_tableInfo.get()); } public boolean maybeDirty() { return !_hashShared; } public int primaryCount() { int j = 0; int i = 3; for (int l = _secondaryStart; i < l;) { int k = j; if (_hashArea[i] != 0) { k = j + 1; } i += 4; j = k; } return j; } public void release() { if (_parent != null && maybeDirty()) { _parent.mergeChild(new TableInfo(this)); _hashShared = true; } } public int secondaryCount() { int j = 0; int i = _secondaryStart + 3; for (int l = _tertiaryStart; i < l;) { int k = j; if (_hashArea[i] != 0) { k = j + 1; } i += 4; j = k; } return j; } public int size() { if (_tableInfo != null) { return ((TableInfo)_tableInfo.get()).count; } else { return _count; } } public int spilloverCount() { return _spilloverEnd - _spilloverStart() >> 2; } public int tertiaryCount() { int j = 0; int k = _tertiaryStart + 3; int i1 = _hashSize; int i = k; do { int l = i; if (l < k + i1) { i = j; if (_hashArea[l] != 0) { i = j + 1; } l += 4; j = i; i = l; } else { return j; } } while (true); } public String toString() { int i = primaryCount(); int j = secondaryCount(); int k = tertiaryCount(); int l = spilloverCount(); int i1 = totalCount(); return String.format("[%s: size=%d, hashSize=%d, %d/%d/%d/%d pri/sec/ter/spill (=%s), total:%d]", new Object[] { getClass().getName(), Integer.valueOf(_count), Integer.valueOf(_hashSize), Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(k), Integer.valueOf(l), Integer.valueOf(i1), Integer.valueOf(i + j + k + l), Integer.valueOf(i1) }); } public int totalCount() { int j = 0; int i = 3; for (int l = _hashSize; i < l << 3;) { int k = j; if (_hashArea[i] != 0) { k = j + 1; } i += 4; j = k; } return j; } }