MCPcopy Index your code
hub / github.com/clojure/clojure / addMergedType

Method addMergedType

src/jvm/clojure/asm/SymbolTable.java:1196–1212  ·  view source on GitHub ↗

Adds a merged type in the type table of this symbol table. Does nothing if the type table already contains a similar type. @param typeTableIndex1 a Symbol#TYPE_TAG type, specified by its index in the type table. @param typeTableIndex2 another Symbol#TYPE_TAG type, specified by i

(final int typeTableIndex1, final int typeTableIndex2)

Source from the content-addressed store, hash-verified

1194 * corresponding to the common super class of the given types.
1195 */
1196 int addMergedType(final int typeTableIndex1, final int typeTableIndex2) {
1197 // TODO sort the arguments? The merge result should be independent of their order.
1198 long data = typeTableIndex1 | (((long) typeTableIndex2) << 32);
1199 int hashCode = hash(Symbol.MERGED_TYPE_TAG, typeTableIndex1 + typeTableIndex2);
1200 Entry entry = get(hashCode);
1201 while (entry != null) {
1202 if (entry.tag == Symbol.MERGED_TYPE_TAG && entry.hashCode == hashCode && entry.data == data) {
1203 return entry.info;
1204 }
1205 entry = entry.next;
1206 }
1207 String type1 = typeTable[typeTableIndex1].value;
1208 String type2 = typeTable[typeTableIndex2].value;
1209 int commonSuperTypeIndex = addType(classWriter.getCommonSuperClass(type1, type2));
1210 put(new Entry(typeCount, Symbol.MERGED_TYPE_TAG, data, hashCode)).info = commonSuperTypeIndex;
1211 return commonSuperTypeIndex;
1212 }
1213
1214 /**
1215 * Adds the given type Symbol to {@link #typeTable}.

Callers 1

mergeMethod · 0.80

Calls 5

hashMethod · 0.95
getMethod · 0.95
addTypeMethod · 0.95
putMethod · 0.95
getCommonSuperClassMethod · 0.45

Tested by

no test coverage detected