Uploaded image for project: 'JikesRVM'
  1. RVM-179

Move java/lang/String out of libraryInterface and into a patch against Classpath



      r13293 added a modified version of java.lang.String to libraryInterface so that we have Pure annotations on many methods. Pure annotations can give us a kind of poor mans immutable array, so there introduction to String should prove useful (given Igor Peshansky's past work). Below [1] shows an example of it at work for substring, but you can also think of its applicability for indexOf, ...

      Anyway, we'd prefer that the changes to String didn't require the wholesale inclusion of String into libraryInterface. We could use BCEL to add annotations to String after compilation, or modify the class loader to inject annotations onto known methods. What seems like the simplest approach currently is to create a patch for String that gets applied prior to Classpath's compilation. This means we need to have vmmagic available as part of the Classpath build, and this should be achievable using the --with-vm-classes configure option to Classpath.

      It's worth getting this right as we should repeat it for all the immutable Java classes, such as those descended from Number.


                      • START OF IR DUMP After AdjustBytecodeIndexes FOR < SystemAppCL, Lte
                        st; >.foo ()Ljava/lang/String;
                        -13 LABEL0 Frequency: 0.0
                        0 G yieldpoint_prologue
                        4 EG call t1a(Ljava/lang/String LR = Addr 0x000000a8
                        , virtual_exact"< BootstrapCL, Ljava/lang/String; >.substring (II)Ljava/lang/Str
                        ing;", <TRUEGUARD>, string "hello world", 0, 5 JTOC
                        7 ref_move t0a(Ljava/lang/String = t1a(Ljava/lang/Str
                        -10 G yieldpoint_epilogue
                        -3 return t0a(Ljava/lang/String
                        -1 bbend BB0 (ENTRY)
                      • END OF IR DUMP After Estimate Block Frequencies FOR < SystemAppCL
                        , Ltest; >.foo ()Ljava/lang/String;
                      • START OF IR DUMP After Simple Opts FOR < SystemAppCL, Ltest; >.foo
                        -13 LABEL0 Frequency: 1.0
                        -2 EG ir_prologue
                        0 G yieldpoint_prologue
                        4 ref_move t1sa(Ljava/lang/String = object "hello"
                        -10 G yieldpoint_epilogue
                        -3 return t1sa(Ljava/lang/String
                        -1 bbend BB0 (ENTRY)
                      • END OF IR DUMP After Simple Opts FOR < SystemAppCL, Ltest; >.foo


          Issue links



              • Assignee:
                ianrogers Ian Rogers
                ianrogers Ian Rogers
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: