Browse Source

* when internally taking the address of shortstrings to typecast
them to shortstringclass, make sure the address operator is
"typed" so that we don't insert useless checkcast instructions

git-svn-id: branches/jvmbackend@18621 -

Jonas Maebe 14 years ago
parent
commit
bf2854dae5
2 changed files with 4 additions and 0 deletions
  1. 2 0
      compiler/jvm/njvmld.pas
  2. 2 0
      compiler/jvm/njvmmem.pas

+ 2 - 0
compiler/jvm/njvmld.pas

@@ -98,6 +98,8 @@ function tjvmassignmentnode.pass_1: tnode;
         inserttypeconv_explicit(right,cchartype);
         { call ShortstringClass(@shortstring).setChar(index,char) }
         tvecnode(target).left:=caddrnode.create_internal(tvecnode(target).left);
+        { avoid useless typecheck when casting to shortstringclass }
+        include(tvecnode(target).left.flags,nf_typedaddr);
         inserttypeconv_explicit(tvecnode(target).left,java_shortstring);
         psym:=search_struct_member(tabstractrecorddef(java_shortstring),'SETCHAR');
         if not assigned(psym) or

+ 2 - 0
compiler/jvm/njvmmem.pas

@@ -218,6 +218,8 @@ implementation
                 begin
                   stringclass:=java_shortstring;
                   left:=caddrnode.create_internal(left);
+                  { avoid useless typecheck when casting to shortstringclass }
+                  include(left.flags,nf_typedaddr);
                 end
               else
                 internalerror(2011052407);