src/hotspot/share/ci/ciObjArrayKlass.cpp
changeset 58722 cba8afa5cfed
parent 51997 9ce37fa2e179
equal deleted inserted replaced
58720:ae0af9fb3dbb 58722:cba8afa5cfed
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   110   int element_len = element_name->utf8_length();
   110   int element_len = element_name->utf8_length();
   111 
   111 
   112   Symbol* base_name_sym = element_name->get_symbol();
   112   Symbol* base_name_sym = element_name->get_symbol();
   113   char* name;
   113   char* name;
   114 
   114 
   115   if (base_name_sym->char_at(0) == '[' ||
   115   if (base_name_sym->char_at(0) == JVM_SIGNATURE_ARRAY ||
   116       (base_name_sym->char_at(0) == 'L' &&  // watch package name 'Lxx'
   116       (base_name_sym->char_at(0) == JVM_SIGNATURE_CLASS &&  // watch package name 'Lxx'
   117        base_name_sym->char_at(element_len-1) == ';')) {
   117        base_name_sym->char_at(element_len-1) == JVM_SIGNATURE_ENDCLASS)) {
   118 
   118 
   119     int new_len = element_len + dimension + 1; // for the ['s and '\0'
   119     int new_len = element_len + dimension + 1; // for the ['s and '\0'
   120     name = CURRENT_THREAD_ENV->name_buffer(new_len);
   120     name = CURRENT_THREAD_ENV->name_buffer(new_len);
   121 
   121 
   122     int pos = 0;
   122     int pos = 0;
   123     for ( ; pos < dimension; pos++) {
   123     for ( ; pos < dimension; pos++) {
   124       name[pos] = '[';
   124       name[pos] = JVM_SIGNATURE_ARRAY;
   125     }
   125     }
   126     strncpy(name+pos, (char*)element_name->base(), element_len);
   126     strncpy(name+pos, (char*)element_name->base(), element_len);
   127     name[new_len-1] = '\0';
   127     name[new_len-1] = '\0';
   128   } else {
   128   } else {
   129     int new_len =   3                       // for L, ;, and '\0'
   129     int new_len =   3                       // for L, ;, and '\0'
   131                   + element_len;
   131                   + element_len;
   132 
   132 
   133     name = CURRENT_THREAD_ENV->name_buffer(new_len);
   133     name = CURRENT_THREAD_ENV->name_buffer(new_len);
   134     int pos = 0;
   134     int pos = 0;
   135     for ( ; pos < dimension; pos++) {
   135     for ( ; pos < dimension; pos++) {
   136       name[pos] = '[';
   136       name[pos] = JVM_SIGNATURE_ARRAY;
   137     }
   137     }
   138     name[pos++] = 'L';
   138     name[pos++] = JVM_SIGNATURE_CLASS;
   139     strncpy(name+pos, (char*)element_name->base(), element_len);
   139     strncpy(name+pos, (char*)element_name->base(), element_len);
   140     name[new_len-2] = ';';
   140     name[new_len-2] = JVM_SIGNATURE_ENDCLASS;
   141     name[new_len-1] = '\0';
   141     name[new_len-1] = '\0';
   142   }
   142   }
   143   return ciSymbol::make(name);
   143   return ciSymbol::make(name);
   144 }
   144 }
   145 
   145