+#if USES_NEW_SUBTYPE
+/* build_display ***************************************************************
+
+ Builds the entire display for a class. This entails filling the fixed part
+ as well as allocating and initializing the overflow part.
+
+ See Cliff Click and John Rose: Fast subtype checking in the Hotspot JVM.
+
+*******************************************************************************/
+
+static classinfo *build_display(classinfo *c)
+{
+ int depth, i;
+ int depth_fixed;
+ classinfo *super;
+
+ do {
+ /* Handle arrays. */
+ if (c->vftbl->arraydesc) {
+ arraydescriptor *a = c->vftbl->arraydesc;
+ if (a->elementvftbl && a->elementvftbl->clazz->super) {
+ classinfo *cls = a->elementvftbl->clazz->super;
+ int n;
+ for (n=0; n<a->dimension; n++)
+ cls = class_array_of(cls, true);
+ super = cls;
+ break;
+ }
+ if (a->componentvftbl && a->elementvftbl) {
+ super = a->componentvftbl->clazz;
+ break;
+ }
+ }
+ /* Normal classes. */
+ super = c->super;
+ } while (false);
+ if (super) {
+ if (!link_class(super))
+ return NULL;
+ depth = super->vftbl->subtype_depth + 1;
+ } else
+ /* java.lang.Object doesn't have a super class. */
+ depth = 0;
+
+ /* Now copy super's display, append c->vftbl and initialize the remaining fields. */
+ if (depth >= DISPLAY_SIZE) {
+ c->vftbl->subtype_overflow = MNEW(vftbl_t *, depth - DISPLAY_SIZE + 1);
+#if defined(ENABLE_STATISTICS)
+ if (opt_stat)
+ count_vftbl_len += sizeof(vftbl_t*) * (depth - DISPLAY_SIZE + 1);
+#endif
+ memcpy(c->vftbl->subtype_overflow, super->vftbl->subtype_overflow, sizeof(vftbl_t*) * (depth - DISPLAY_SIZE));
+ c->vftbl->subtype_overflow[depth - DISPLAY_SIZE] = c->vftbl;
+ depth_fixed = DISPLAY_SIZE;
+ }
+ else {
+ depth_fixed = depth;
+ c->vftbl->subtype_display[depth] = c->vftbl;
+ }
+
+ if (super)
+ memcpy(c->vftbl->subtype_display, super->vftbl->subtype_display, sizeof(vftbl_t*) * depth_fixed);
+ for (i=depth_fixed+1; i<=DISPLAY_SIZE; i++)
+ c->vftbl->subtype_display[i] = NULL;
+ c->vftbl->subtype_offset = OFFSET(vftbl_t, subtype_display[0]) + sizeof(vftbl_t*) * depth_fixed;
+ c->vftbl->subtype_depth = depth;
+
+ return c;
+}
+#endif
+