From 80eb6a6ad4a62a23efcee17ec4ce825d77e4370a Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 7 Dec 2017 17:28:25 +0000 Subject: [PATCH 1/2] TG-1877: Include array pointer types in needed classes Lazy methods attempts a pointer graph walk starting from the main function's parameters to determine what classes may exist before the main function is entered; for example, starting at f(A a) implies that an A instance may exist, and if A itself has a B field that too might exist, and so on. However, until now this failed to account for array-typed parameters and fields. This commit amends gather_field_types to account for this special case. This also adds a test for the generic parameter case, which is not solved yet. --- .../asserthere.class | Bin 0 -> 506 bytes .../lazyloading_array_parameter/test.class | Bin 0 -> 418 bytes .../lazyloading_array_parameter/test.desc | 7 ++++ .../lazyloading_array_parameter/test.java | 22 ++++++++++++ .../asserthere.class | Bin 0 -> 506 bytes .../container.class | Bin 0 -> 218 bytes .../test.class | Bin 0 -> 501 bytes .../test.desc | 7 ++++ .../test.java | 29 +++++++++++++++ .../asserthere.class | Bin 0 -> 597 bytes .../container.class | Bin 0 -> 430 bytes .../test.class | Bin 0 -> 762 bytes .../test.desc | 10 ++++++ .../test.java | 29 +++++++++++++++ src/java_bytecode/ci_lazy_methods.cpp | 34 +++++++++++++----- 15 files changed, 129 insertions(+), 9 deletions(-) create mode 100644 regression/cbmc-java/lazyloading_array_parameter/asserthere.class create mode 100644 regression/cbmc-java/lazyloading_array_parameter/test.class create mode 100644 regression/cbmc-java/lazyloading_array_parameter/test.desc create mode 100644 regression/cbmc-java/lazyloading_array_parameter/test.java create mode 100644 regression/cbmc-java/lazyloading_indirect_array_parameter/asserthere.class create mode 100644 regression/cbmc-java/lazyloading_indirect_array_parameter/container.class create mode 100644 regression/cbmc-java/lazyloading_indirect_array_parameter/test.class create mode 100644 regression/cbmc-java/lazyloading_indirect_array_parameter/test.desc create mode 100644 regression/cbmc-java/lazyloading_indirect_array_parameter/test.java create mode 100644 regression/cbmc-java/lazyloading_indirect_generic_array_parameter/asserthere.class create mode 100644 regression/cbmc-java/lazyloading_indirect_generic_array_parameter/container.class create mode 100644 regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.class create mode 100644 regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.desc create mode 100644 regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.java diff --git a/regression/cbmc-java/lazyloading_array_parameter/asserthere.class b/regression/cbmc-java/lazyloading_array_parameter/asserthere.class new file mode 100644 index 0000000000000000000000000000000000000000..1ee2ea18dc1fcea28d53d0382ac00dedfc2c93cc GIT binary patch literal 506 zcmZ8dO;5s55S;A?g<7Q)L_{$jJfH`;a3n^9dh+9dF_BxLFIudvX^TIGKj2wSB+*3g z{wU+N2pA9V?PlK0?7aQ@e)|B>#D)$Hr5sc&YbfiGQPQxYqk>fpRYGygjv^7pZs13U zZe;g7;Si`x$h2JFjrRz0efyH2v;#*F@+Yn@&W3kA5nd!@Le>c;7R;%46Y63ow)?lI z_WhL6>U+OldM6l$eR1q2%3Lg>cz0kw*ambg7|0?=s3btcv;FJF!8F=Y7zQChpA5PY zq0q2qU>!ArIp?4E2BIHx$T`&ZSVJf~B636F%p5slJmd%dTo;?X9*x&UW+lnMoy>Bb6rAN24%R~s{3fw5TEG>O7(0zIF)=YgEl>)r7FhKV!5oLbht9@^MvVof zCjKbn>`7(wKIYB5dGGt@V+vpwWrZ|~3KAuS1uVK)aIc%BO-1R$_cAm0adxK$7UGsSxvqX>-PPrewS&heH#^cP8SJY-jM-Qc=08HnG7! z()z#rf;X4$PX3+8n21~Fm50~j+2m|~zGO$OFR(t@!1vWy2*|6L|jN8`9o`6NXY&#ZnHiq literal 0 HcmV?d00001 diff --git a/regression/cbmc-java/lazyloading_array_parameter/test.desc b/regression/cbmc-java/lazyloading_array_parameter/test.desc new file mode 100644 index 00000000000..15e3f99d782 --- /dev/null +++ b/regression/cbmc-java/lazyloading_array_parameter/test.desc @@ -0,0 +1,7 @@ +CORE +test.class +--lazy-methods --verbosity 10 --function test.g +^EXIT=0$ +^SIGNAL=0$ +elaborate java::test\.f:\(\)I +VERIFICATION SUCCESSFUL diff --git a/regression/cbmc-java/lazyloading_array_parameter/test.java b/regression/cbmc-java/lazyloading_array_parameter/test.java new file mode 100644 index 00000000000..db6730e70e5 --- /dev/null +++ b/regression/cbmc-java/lazyloading_array_parameter/test.java @@ -0,0 +1,22 @@ + +public class test { + + public int f() { return 1; } + + public static void g(test[] args) { + + if(args == null || args.length != 1 || args[0] == null) + return; + asserthere.doassert(args[0].f() == 1); + + } + +} + +class asserthere { + + // Used to avoid lazy-loading currently marking any class with an + // $assertionsEnabled member (i.e. any class that asserts) as needed. + public static void doassert(boolean condition) { assert(condition); } + +} diff --git a/regression/cbmc-java/lazyloading_indirect_array_parameter/asserthere.class b/regression/cbmc-java/lazyloading_indirect_array_parameter/asserthere.class new file mode 100644 index 0000000000000000000000000000000000000000..b59863c8faebcee8cb8fa2e2c8c73a798b016b81 GIT binary patch literal 506 zcmZ8dyH3ME5S;ZRP8>s?AqKR^vgL;?wV zJ_@mRNI(>KyPBJso!if^*LMINtn1KF&OpVAhKdduWerswHPkgU2&GLk3`Gz*z84-i zp*eJgO`riG)pa~4+9k-XtqX$E^KC)M9Xp;l9p4T`a2}HhY1^M!FsC($sZ0IHv~Et! zyE&t4xj$Zd-ya8-IC5fTCK6$^GcxZ@13Iz>(#Q~MG0=8R@2b5&k9HUYen8M?gRVs& zG^`p}Lz9sI<(~~l!iqTLFVu5cL#WsybOK>7964e%<_G@V02{m>jn_r_TAYD9nGZ(- z!QigRmAIY+AlH~6`v&=P3gsgfN`HiP&jr literal 0 HcmV?d00001 diff --git a/regression/cbmc-java/lazyloading_indirect_array_parameter/container.class b/regression/cbmc-java/lazyloading_indirect_array_parameter/container.class new file mode 100644 index 0000000000000000000000000000000000000000..98dc6905dcd87b8f362712c77c49001e0a6c6b71 GIT binary patch literal 218 zcmW-bu?oUK5JYElos1LX61T*-+_GQ-;!P1j5QI?=ksS0Oon+K#Oms34{2Omxya=M= zAx8zjNyO?=JV?WPudC}-)y&7&>j1zC79GSeoN zU#JOKo86`_kn&m`f46^8_k(>^Zxa#65oMdxiNJ8)YjiuIA}d(cd&z338s|IeGNMal z1)OTPA2j@}mR?VUelIMascYpzA}%rOB8RMtA-EEAF6Oa7cg+$Q(Y#7qbxtaK^)tUg zNFI9nZIw!Y#~`@P;(-H&SYr`rureU4re@eR)v)gW@hrY4G5pKBg24lni|?==ijOe7(i>8xfpv>S z$z0Yb+Y?Lz(z=6Xz7W#Nk@p zsSA~*`JT!}Cy_CM+Jw@UN>#B&?1ErBQJsL3bs>8?M3ZaAj} zoWTUg;Xr^2s+{?lM2#z^`GD1?xqb_)hssGrU`vFx)z3*hIub~m6F1i4P7J{A)a0}sGM zAy#qMMQ2-kU9u7V983HZl`kpJrmkhm0I^zpIEO|8@-sLk< z=t~BFB&QYEjS>vbB+Cf7v8<#{80^8xnCNx=K!=@FR^qmK%7w~!UJ~i1b-~LqSJLP; zbo8T~Gqls9t~94BiYoRuoy+GRcl2kA>FtEPgE+g`ZZz3OG~TFgR3UDp>Bcv+o|y?l z?7%1R+W|xLe{vkdqMrg7Ee9=%E-4EhWiSP34=B5$-H_JlE7%JqHrf>373?9TJp49b T7ki{S8zdrStxNBtyHdR`5(iwv literal 0 HcmV?d00001 diff --git a/regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.class b/regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.class new file mode 100644 index 0000000000000000000000000000000000000000..75992ea936b1f5e8ff66b6ee37f4993d67181db5 GIT binary patch literal 762 zcmZ8e%Wl&^6g^{)q+X1rpzc5NGVP1UC0^?&F+0^Yi!DV*vNC?!rdX!4+J!(Qr}1s*7v5Zez{H z4S~{D6i3;%fZ1vf1muHcHx#J)Q5-&*z8;3@Gc_C&S@M%WjRz`?bUp)Rwiivf!_UG= zwkaT9=6fD78VM}6{2+-l#Z~F1UM>QGg*l9LDjjiwy>qgm@h{Ec!3kCU@7z|=yiLMN zKU2Z0$Le4v$mvI;SY^|ciW_tErz2X1+fSxx5I&6bU5=K1dtbd#9?EcR-1Kk@Ee}=H zY_vUe(4|h@B~a6Sy|Ic%y{E(dFd*cdp2)?z>xD{Fbtq8Z@&E6pU{_5hVVdoQT48xN zDN+)&p0@{B<@eb9HoyeSaA;j-J$gZJbv{EJF)*+|TgpKL9%HX)Kn07;_=Bj?>fv>I zJ#5Gi+RjbNxk+O->EH~O*rg}m(Hry|oga`#osTfS!SuV|QSBbfw{W`VU0tC21WCY_ z?;*`Eu(U*(6E*XD%FG;CTv{QzLfR&yI~1v c) { + + if(c == null) + return; + test[] args = c.test_array; + if(args == null || args.length != 1 || args[0] == null) + return; + asserthere.doassert(args[0].f() == 1); + + } + +} + +class container { + public T[] test_array; +} + +class asserthere { + + // Used to avoid lazy-loading currently marking any class with an + // $assertionsEnabled member (i.e. any class that asserts) as needed. + public static void doassert(boolean condition) { assert(condition); } + +} diff --git a/src/java_bytecode/ci_lazy_methods.cpp b/src/java_bytecode/ci_lazy_methods.cpp index dd434acb372..577bef4b926 100644 --- a/src/java_bytecode/ci_lazy_methods.cpp +++ b/src/java_bytecode/ci_lazy_methods.cpp @@ -477,17 +477,33 @@ void ci_lazy_methodst::gather_field_types( ci_lazy_methods_neededt &needed_lazy_methods) { const auto &underlying_type=to_struct_type(ns.follow(class_type)); - for(const auto &field : underlying_type.components()) + if(is_java_array_tag(underlying_type.get_tag())) { - if(field.type().id()==ID_struct || field.type().id()==ID_symbol) - gather_field_types(field.type(), ns, needed_lazy_methods); - else if(field.type().id()==ID_pointer) + // If class_type is not a symbol this may be a reference array, + // but we can't tell what type. + if(class_type.id() == ID_symbol) { - // Skip array primitive pointers, for example: - if(field.type().subtype().id()!=ID_symbol) - continue; - initialize_all_needed_classes_from_pointer( - to_pointer_type(field.type()), ns, needed_lazy_methods); + const typet &element_type = + java_array_element_type(to_symbol_type(class_type)); + if(element_type.id() == ID_pointer) + { + // This is a reference array -- mark its element type available. + initialize_all_needed_classes_from_pointer( + to_pointer_type(element_type), ns, needed_lazy_methods); + } + } + } + else + { + for(const auto &field : underlying_type.components()) + { + if(field.type().id() == ID_struct || field.type().id() == ID_symbol) + gather_field_types(field.type(), ns, needed_lazy_methods); + else if(field.type().id() == ID_pointer) + { + initialize_all_needed_classes_from_pointer( + to_pointer_type(field.type()), ns, needed_lazy_methods); + } } } } From ae89c94b62c81e372dc3c7d8b8695ae4b76c61d2 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Fri, 15 Dec 2017 17:00:54 +0000 Subject: [PATCH 2/2] Lazy loading: assume concrete generic parameter types are needed This extends the previous commit to assume that generic parameter types are needed, which overapproximates what is requried, but seems likely to suffice in most cases. --- .../test.desc | 5 +-- .../asserthere.class | Bin 0 -> 597 bytes .../container.class | Bin 0 -> 453 bytes .../test.class | Bin 0 -> 800 bytes .../test.desc | 7 ++++ .../test.java | 29 ++++++++++++++ .../asserthere.class | Bin 0 -> 506 bytes .../container.class | Bin 0 -> 308 bytes .../container2.class | Bin 0 -> 301 bytes .../test.class | Bin 0 -> 674 bytes .../test.desc | 13 +++++++ .../test.java | 36 ++++++++++++++++++ src/java_bytecode/ci_lazy_methods.cpp | 35 +++++++++++++++-- 13 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 regression/cbmc-java/lazyloading_multiple_generic_parameters/asserthere.class create mode 100644 regression/cbmc-java/lazyloading_multiple_generic_parameters/container.class create mode 100644 regression/cbmc-java/lazyloading_multiple_generic_parameters/test.class create mode 100644 regression/cbmc-java/lazyloading_multiple_generic_parameters/test.desc create mode 100644 regression/cbmc-java/lazyloading_multiple_generic_parameters/test.java create mode 100644 regression/cbmc-java/lazyloading_nested_generic_parameters/asserthere.class create mode 100644 regression/cbmc-java/lazyloading_nested_generic_parameters/container.class create mode 100644 regression/cbmc-java/lazyloading_nested_generic_parameters/container2.class create mode 100644 regression/cbmc-java/lazyloading_nested_generic_parameters/test.class create mode 100644 regression/cbmc-java/lazyloading_nested_generic_parameters/test.desc create mode 100644 regression/cbmc-java/lazyloading_nested_generic_parameters/test.java diff --git a/regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.desc b/regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.desc index acc4b654945..15e3f99d782 100644 --- a/regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.desc +++ b/regression/cbmc-java/lazyloading_indirect_generic_array_parameter/test.desc @@ -1,10 +1,7 @@ -KNOWNBUG +CORE test.class --lazy-methods --verbosity 10 --function test.g ^EXIT=0$ ^SIGNAL=0$ elaborate java::test\.f:\(\)I VERIFICATION SUCCESSFUL --- --- -See https://diffblue.atlassian.net/browse/TG-1877 diff --git a/regression/cbmc-java/lazyloading_multiple_generic_parameters/asserthere.class b/regression/cbmc-java/lazyloading_multiple_generic_parameters/asserthere.class new file mode 100644 index 0000000000000000000000000000000000000000..6c09f10e28779a4f5d14fe5fd2dcc22ea73e6cb2 GIT binary patch literal 597 zcmZXQO;6iE5Qg9JM;seNLQ){*vmg$@fn0I}RUitd6b@8K&23|^%7U@c+Tq9K5A#W34ky2qq>xtcCc5bwYKbKkHt}sNmTq zrK5y<2=lSbm6q`!G@r2AG}rH8^-)>uW9kp=?*lmh49b3kT6%-3qds)%BSC@4^ZX%n0+GSXg)gdev^7 literal 0 HcmV?d00001 diff --git a/regression/cbmc-java/lazyloading_multiple_generic_parameters/container.class b/regression/cbmc-java/lazyloading_multiple_generic_parameters/container.class new file mode 100644 index 0000000000000000000000000000000000000000..39645cf007c21d08dbce3abce2c6f5b05c60233a GIT binary patch literal 453 zcmZvYu};G<5QcvzX+zRLO9N$P1O~b=(I^r^Vv1l$)TIM*f>m6F1i21UABzczfd}BB z5a&`rrO49x{?EV9=X?KneFJcY10Oc_TVlVJuB6c` z=;(VnXXqqFU1?5N6jdCoI~R}N?(o+ZW$B2XkI5cI>G@`_**`4aw9&8Ax>1F=lBP+| zjNsIKJirz_0zZv0^!^S6hp=dX0HfugMX^oFf=d}p0or}aE@(HTb@BrCOo@#S#r6`0 Z2q+J}4A{mFsqPx-k+N2$chO&}@Dsk-WXS*k literal 0 HcmV?d00001 diff --git a/regression/cbmc-java/lazyloading_multiple_generic_parameters/test.class b/regression/cbmc-java/lazyloading_multiple_generic_parameters/test.class new file mode 100644 index 0000000000000000000000000000000000000000..a46b3d3c1afa88b43d837d3da7f81d754748b6e5 GIT binary patch literal 800 zcmaJ;%Wl(95IxtAICh;Tw2<;@pioL46`_b-s|pDTsgi+3P!@E7Zd~KK1iNw^r2Y+J z!-h>I1c*h&3M9S>AlT_0Dp+xF12-+K zTDT=p*^1&Q+ZNERuEFPo}R&LHbON#zYpp#FyitOe2-gKqK3aCgkw4 zV3KVLh?hCf4x>tq^|z}h`!X#TtA=S$Q#xagwCYgCs&<4oSu(Lvx7vj08=iB;DNnWpkcU~#u}Owr97 z966Z;X|^9I(bc`ANV%Z>yfefKKhfgn0y c) { + + if(c == null) + return; + test[] args = c.test_array; + if(args == null || args.length != 1 || args[0] == null) + return; + asserthere.doassert(args[0].f() == 1); + + } + +} + +class container { + public T[] test_array; +} + +class asserthere { + + // Used to avoid lazy-loading currently marking any class with an + // $assertionsEnabled member (i.e. any class that asserts) as needed. + public static void doassert(boolean condition) { assert(condition); } + +} diff --git a/regression/cbmc-java/lazyloading_nested_generic_parameters/asserthere.class b/regression/cbmc-java/lazyloading_nested_generic_parameters/asserthere.class new file mode 100644 index 0000000000000000000000000000000000000000..fe2c323e94cdf55ac3f26b838bcc19c22fa24f25 GIT binary patch literal 506 zcmZ8d%TB^j6r9rsg;M1yA__6a1-g(8OJX#rD<2DtiR?;yqs7{qw)ippfNM38L=)Zn zQO46EXk6TTPUgF9PKg7cV6NZbC@f;r88OkLt%l+}vd;Tb}#E}y#Gm!|RouPSe8qkq7kVb}3je(YHdRMLeS+v6-@B@NA9ds=M zp<&g)8tR1nFaK;X6jsC`f1$3+8bZYup%Vyu?#L0N5kK(f`dH`nXuK}USK|!a$$U5x z2nKg`uEbT{o`4>?;Xm@7O27sS7LnsVrnVs^Xz2;k7`fUQ**D0S6DS|CQ2Ha>K%Nm9 oROF$B`LK4P2MR^?1*tJKroIqS`QUUPgcALp2Qvuy>H?oD|Q3vM*Lfz1P}fIf0X!Q zZWJ4#vFUE-!xCMC3lUPv3g$oBsz~(vLWe>;^BSb_#O$OMONggo|@7ZI{oY3 z%2VoiK*(*HS*IAEzYCiGZ$uX!KLZF~6*X3$lZSu`WdeId)nPA5t$%>*DFlzK{tdQi M__NjVMC#%B3JO0xcK`qY literal 0 HcmV?d00001 diff --git a/regression/cbmc-java/lazyloading_nested_generic_parameters/test.class b/regression/cbmc-java/lazyloading_nested_generic_parameters/test.class new file mode 100644 index 0000000000000000000000000000000000000000..7f9ac7fe0cecd3a7385df28e4452fb399f0ea80d GIT binary patch literal 674 zcmZuuT~8B16g{)M?Xb(%LMtCuQ4rL2+ep&**3y`mn3yd3P{V^fkZBpqB5uugYxH;U z2YmCz7ZQTT2f`C1{3b#?vm|JUndII(_nv$1xijaNzmEYtL*0Xmc^7w3k+|!^#yyDz z4->fW;QL-Zev$uvmX#t`y$HwFop6TPjJ^SAp{8e<5l#(n-3b&7Kq6!>cQ4tM6(XSmKMj z{1Na6NQX&UpSJ~iL7xkLLL4yQ6Vm3hq(#e3XbrSNZ=ja*;|9(l^%SOIWw?EMn}|+u z2In9+gmnTtteZ>y5Y7p5>y1+s8^_K!xDC5$3Uo)vGa;StaO_`@MvIkc2`CqoZ>HoJ u7bt$3lS+&#)E7`;o%7e2DG^ylK6e3MqI`il$(F)%f!i6~3>TQqqPah-FMLG+ literal 0 HcmV?d00001 diff --git a/regression/cbmc-java/lazyloading_nested_generic_parameters/test.desc b/regression/cbmc-java/lazyloading_nested_generic_parameters/test.desc new file mode 100644 index 00000000000..ae44ea6da9b --- /dev/null +++ b/regression/cbmc-java/lazyloading_nested_generic_parameters/test.desc @@ -0,0 +1,13 @@ +KNOWNBUG +test.class +--lazy-methods --verbosity 10 --function test.g +^EXIT=0$ +^SIGNAL=0$ +elaborate java::test\.f:\(\)I +VERIFICATION SUCCESSFUL +-- +-- +The right methods are loaded, but verification is not successful +because __CPROVER_start doesn't create appropriately typed input for +this kind of nested generic parameter, so dynamic cast checks fail upon +fetching the generic type's field. diff --git a/regression/cbmc-java/lazyloading_nested_generic_parameters/test.java b/regression/cbmc-java/lazyloading_nested_generic_parameters/test.java new file mode 100644 index 00000000000..564c26eb88e --- /dev/null +++ b/regression/cbmc-java/lazyloading_nested_generic_parameters/test.java @@ -0,0 +1,36 @@ + +public class test { + + public int f() { return 1; } + + public static void g(container2> c) { + + if(c == null) + return; + container outer = c.next; + if(outer == null) + return; + test[] args = outer.test_array; + if(args == null || args.length != 1 || args[0] == null) + return; + asserthere.doassert(args[0].f() == 1); + + } + +} + +class container { + public T[] test_array; +} + +class container2 { + public T next; +} + +class asserthere { + + // Used to avoid lazy-loading currently marking any class with an + // $assertionsEnabled member (i.e. any class that asserts) as needed. + public static void doassert(boolean condition) { assert(condition); } + +} diff --git a/src/java_bytecode/ci_lazy_methods.cpp b/src/java_bytecode/ci_lazy_methods.cpp index 577bef4b926..0daa4aac95a 100644 --- a/src/java_bytecode/ci_lazy_methods.cpp +++ b/src/java_bytecode/ci_lazy_methods.cpp @@ -7,7 +7,6 @@ \*******************************************************************/ #include "ci_lazy_methods.h" - #include #include #include @@ -345,6 +344,22 @@ void ci_lazy_methodst::initialize_needed_classes_from_pointer( { gather_field_types(pointer_type.subtype(), ns, needed_lazy_methods); } + + if(is_java_generic_type(pointer_type)) + { + // Assume if this is a generic like X, then any concrete parameters + // will at some point be instantiated. + const auto &generic_args = + to_java_generic_type(pointer_type).generic_type_arguments(); + for(const auto &generic_arg : generic_args) + { + if(!is_java_generic_parameter(generic_arg)) + { + initialize_needed_classes_from_pointer( + generic_arg, ns, needed_lazy_methods); + } + } + } } /// Get places where virtual functions are called. @@ -501,8 +516,22 @@ void ci_lazy_methodst::gather_field_types( gather_field_types(field.type(), ns, needed_lazy_methods); else if(field.type().id() == ID_pointer) { - initialize_all_needed_classes_from_pointer( - to_pointer_type(field.type()), ns, needed_lazy_methods); + if(field.type().subtype().id() == ID_symbol) + { + initialize_all_needed_classes_from_pointer( + to_pointer_type(field.type()), ns, needed_lazy_methods); + } + else + { + // If raw structs were possible this would lead to missed + // dependencies, as both array element and specialised generic type + // information cannot be obtained in this case. + // We should therefore only be skipping pointers such as the uint16t* + // in our internal String representation. + INVARIANT( + field.type().subtype().id() != ID_struct, + "struct types should be referred to by symbol at this stage"); + } } } }