This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:crosscompiler:type_checking [2019/07/12 08:20] – ursgraf | dev:crosscompiler:type_checking [2022/12/20 11:43] (current) – ursgraf | ||
---|---|---|---|
Line 14: | Line 14: | ||
==== Special Case ' | ==== Special Case ' | ||
- | When you check against //Object//, the result must be '' | + | When you check against //Object//, the result must be '' |
A check against an array of //Object// leads to two cases: | A check against an array of //Object// leads to two cases: | ||
- The reference points to an array of regular classes: the check returns '' | - The reference points to an array of regular classes: the check returns '' | ||
Line 22: | Line 22: | ||
All the explanations above were for // | All the explanations above were for // | ||
- The check against //Object// is never necessary. It will be eliminated already in the Bytecode. | - The check against //Object// is never necessary. It will be eliminated already in the Bytecode. | ||
- | - Bei einer misslungenen Prüfung wird eine Trap-Instruktion ausgelöst. | + | - A failing check has to cause an exception. |
- A '' | - A '' | ||
Line 71: | Line 71: | ||
For this reason the type descriptor has a table with all interfaces that this class implements. The compiler will determine at compile time for which interfaces there is ever a type check. Only these will be inserted into the table. \\ | For this reason the type descriptor has a table with all interfaces that this class implements. The compiler will determine at compile time for which interfaces there is ever a type check. Only these will be inserted into the table. \\ | ||
[{{ .: | [{{ .: | ||
- | All the affected interfaces get numbered (//chkId//) and will be inserted into the table starting with the highest number. The checking can now run as follows: the compiler knows the //chkId// of the interface to check against. It will search //chkId// in the table. If found the check returns '' | + | All the affected interfaces get numbered (//chkId//) and will be inserted into the table starting with the highest number. The checking can now run as follows: the compiler knows the //chkId// of the interface to check against. It will search //chkId// in the table. If found, the check returns '' |
Here again, // | Here again, // | ||
Line 77: | Line 77: | ||
The following code | The following code | ||
<code java> | <code java> | ||
- | Object[][][] | + | Object[][][] |
A[] x = new AA[5]; | A[] x = new AA[5]; | ||
- | | + | |
- | | + | |
short[][] y = new short[2][3]; | short[][] y = new short[2][3]; | ||
- | | + | |
- | | + | |
</ | </ | ||
leads to\\ | leads to\\ | ||
[{{ .: | [{{ .: | ||
- | This example can be found in the test cases (//ch.ntb.inf.deep.comp.targettest.arrays.ArrayInstanceTest.testInstance4// | + | This example can be found in the test cases (//org.deepjava.comp.targettest.arrays.ArrayInstanceTest.testInstance4// |