MCPcopy Create free account
hub / github.com/ReadyTalk/avian / parseInterfaceTable

Function parseInterfaceTable

src/machine.cpp:1229–1304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1227}
1228
1229void parseInterfaceTable(Thread* t,
1230 Stream& s,
1231 GcClass* class_,
1232 GcSingleton* pool,
1233 Gc::Type throwType)
1234{
1235 PROTECT(t, class_);
1236 PROTECT(t, pool);
1237
1238 GcHashMap* map = makeHashMap(t, 0, 0);
1239 PROTECT(t, map);
1240
1241 if (class_->super()) {
1242 addInterfaces(t, class_->super(), map);
1243 }
1244
1245 unsigned count = s.read2();
1246 GcArray* table = 0;
1247 PROTECT(t, table);
1248
1249 if (count) {
1250 table = makeArray(t, count);
1251
1252 GcClassAddendum* addendum = getClassAddendum(t, class_, pool);
1253 addendum->setInterfaceTable(t, table);
1254 }
1255
1256 for (unsigned i = 0; i < count; ++i) {
1257 GcByteArray* name
1258 = cast<GcReference>(t, singletonObject(t, pool, s.read2() - 1))->name();
1259 PROTECT(t, name);
1260
1261 GcClass* interface = resolveClass(
1262 t, class_->loader(), name, true, throwType);
1263
1264 PROTECT(t, interface);
1265
1266 table->setBodyElement(t, i, interface);
1267
1268 hashMapInsertMaybe(t, map, name, interface, byteArrayHash, byteArrayEqual);
1269
1270 addInterfaces(t, interface, map);
1271 }
1272
1273 GcArray* interfaceTable = 0;
1274 if (map->size()) {
1275 unsigned length = map->size();
1276 if ((class_->flags() & ACC_INTERFACE) == 0) {
1277 length *= 2;
1278 }
1279 interfaceTable = makeArray(t, length);
1280 PROTECT(t, interfaceTable);
1281
1282 unsigned i = 0;
1283 for (HashMapIterator it(t, map); it.hasMore();) {
1284 GcClass* interface = cast<GcClass>(t, it.next()->second());
1285
1286 interfaceTable->setBodyElement(t, i, interface);

Callers 1

parseClassFunction · 0.85

Calls 11

addInterfacesFunction · 0.85
getClassAddendumFunction · 0.85
hashMapInsertMaybeFunction · 0.85
flagsMethod · 0.80
resolveClassFunction · 0.70
sizeMethod · 0.65
nextMethod · 0.65
lengthMethod · 0.65
read2Method · 0.45
nameMethod · 0.45
hasMoreMethod · 0.45

Tested by

no test coverage detected