deep

a Cross Development Platform for Java

User Tools

Site Tools


dev:crosscompiler:arrays

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:crosscompiler:arrays [2019/07/16 12:01] – [Multidimensional Arrays] ursgrafdev:crosscompiler:arrays [2022/12/20 11:24] (current) ursgraf
Line 5: Line 5:
 The field //length// denotes the number of elements of the array (16 bit). //heap// is used for the garbage collection ([[..:rts:heap|Heap Manager and Garbage Collection]]). In between there is a byte which contains an array bit. This is used for type checking. The //P// bit is for garbage collection. It is set for arrays of primitive types\\ The field //length// denotes the number of elements of the array (16 bit). //heap// is used for the garbage collection ([[..:rts:heap|Heap Manager and Garbage Collection]]). In between there is a byte which contains an array bit. This is used for type checking. The //P// bit is for garbage collection. It is set for arrays of primitive types\\
 When accessing array elements the code generator inserts code to check if the element index is in the range 0 to //length//.\\ When accessing array elements the code generator inserts code to check if the element index is in the range 0 to //length//.\\
-If the field //length// is used in Java the Bytecode instruktion //arraylength// is used. This instruktion has to be translated such as the //length// field is accessed.+If the field //length// is used in Java the Bytecode instruktion //arraylength// is used. This instruktion has to be translated so that the //length// field is accessed.
  
 ===== Generating Arrays ===== ===== Generating Arrays =====
Line 28: Line 28:
 <code> <code>
   0  iconst_4   0  iconst_4
-  1  anewarray ch/ntb/junitTarget/comp/objects/ClassA +  1  anewarray org/deepjava/junitTarget/comp/objects/ClassA 
-  4  putstatic ch/ntb/junitTarget/comp/objects/InheritanceTest.a1: Ljava/lang/Object[];+  4  putstatic org/deepjava/junitTarget/comp/objects/InheritanceTest.a1: Ljava/lang/Object[];
 </code> </code>
 Here, as well, the reference to //[ClassA// has to be fetched from the object directory when generating the SSA. There are cases when there is no entry for //[ClassA//. This is the case when there is never a type check for the type //[ClassA//. Then the SSA has a reference to null and the //Tag// can be 0 as well.  Here, as well, the reference to //[ClassA// has to be fetched from the object directory when generating the SSA. There are cases when there is no entry for //[ClassA//. This is the case when there is never a type check for the type //[ClassA//. Then the SSA has a reference to null and the //Tag// can be 0 as well. 
Line 52: Line 52:
 1 iconst_3 1 iconst_3
 2 multianewarray short[][] 2 multianewarray short[][]
-6 putstatic ch/ntb/inf/deep/runtime/mpc555/test/ArrayTest3.a1: short[][]+6 putstatic org/deepjava/runtime/mpc555/test/ArrayTest3.a1: short[][]
 </code> </code>
 If an array is immediately initialized  If an array is immediately initialized 
dev/crosscompiler/arrays.1563271278.txt.gz · Last modified: 2019/07/16 12:01 by ursgraf