我從 Colt 看到了這個(gè)例外OpenLongObjectHashMap:java.lang.ArithmeticException: divide by zero at cern.colt.map.OpenLongObjectHashMap.indexOfKey(Unknown Source) at cern.colt.map.OpenLongObjectHashMap.get(Unknown Source)它是不可復(fù)制的。這是 indexOfKey:protected int indexOfKey(long key) { final long tab[] = table; final byte stat[] = state; final int length = tab.length; final int hash = HashFunctions.hash(key) & 0x7FFFFFFF; int i = hash % length; int decrement = hash % (length-2); // double hashing, see http://www.eece.unm.edu/faculty/heileman/hash/node4.html //int decrement = (hash / length) % length; if (decrement == 0) decrement = 1; // stop if we find a free slot, or if we find the key itself. // do skip over removed slots (yes, open addressing is like that...) while (stat[i] != FREE && (stat[i] == REMOVED || tab[i] != key)) { i -= decrement; //hashCollisions++; if (i<0) i+=length; } if (stat[i] == FREE) return -1; // not found return i; //found, return index where key is contained}因此,唯一使用的除數(shù)是length和(length - 2),其中l(wèi)ength是table.length,table是一個(gè)內(nèi)部數(shù)組。但是,表只初始化為最小大小為 3 的數(shù)組(默認(rèn)值為 277,這是我正在使用的)。整數(shù)環(huán)繞似乎也不可能。所以這似乎是一個(gè)不可能的錯(cuò)誤。有任何想法嗎?
1 回答

BIG陽
TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊
這原來是正在使用的 IBM JDK JIT 編譯器中的 Java 編譯器優(yōu)化錯(cuò)誤。
請參閱此錯(cuò)誤報(bào)告:IJ06000:意外除以零異常
推薦的修復(fù)方法是禁用問題方法的 LoopVersioner 優(yōu)化。
添加回答
舉報(bào)
0/150
提交
取消