< prev index next >

src/hotspot/share/jvmci/jvmciEnv.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 133     // Build it on the fly if the element class exists.
 134     TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
 135                                                  sym->utf8_length()-1,
 136                                                  CHECK_NULL);
 137 
 138     // Get element Klass recursively.
 139     Klass* elem_klass =
 140       get_klass_by_name_impl(accessing_klass,
 141                              cpool,
 142                              elem_sym,
 143                              require_local);
 144     if (elem_klass != NULL) {
 145       // Now make an array for it
 146       return elem_klass->array_klass(CHECK_NULL);
 147     }
 148   }
 149 
 150   if (found_klass == NULL && !cpool.is_null() && cpool->has_preresolution()) {
 151     // Look inside the constant pool for pre-resolved class entries.
 152     for (int i = cpool->length() - 1; i >= 1; i--) {
 153       if (cpool->tag_at(i).is_klass() || cpool->tag_at(i).is_value_type()) {
 154         Klass*  kls = cpool->resolved_klass_at(i);
 155         if (kls->name() == sym) {
 156           return kls;
 157         }
 158       }
 159     }
 160   }
 161 
 162   return found_klass;
 163 }
 164 
 165 // ------------------------------------------------------------------
 166 Klass* JVMCIEnv::get_klass_by_name(Klass* accessing_klass,
 167                                   Symbol* klass_name,
 168                                   bool require_local) {
 169   ResourceMark rm;
 170   constantPoolHandle cpool;
 171   return get_klass_by_name_impl(accessing_klass,
 172                                 cpool,
 173                                 klass_name,


   1 /*
   2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 133     // Build it on the fly if the element class exists.
 134     TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
 135                                                  sym->utf8_length()-1,
 136                                                  CHECK_NULL);
 137 
 138     // Get element Klass recursively.
 139     Klass* elem_klass =
 140       get_klass_by_name_impl(accessing_klass,
 141                              cpool,
 142                              elem_sym,
 143                              require_local);
 144     if (elem_klass != NULL) {
 145       // Now make an array for it
 146       return elem_klass->array_klass(CHECK_NULL);
 147     }
 148   }
 149 
 150   if (found_klass == NULL && !cpool.is_null() && cpool->has_preresolution()) {
 151     // Look inside the constant pool for pre-resolved class entries.
 152     for (int i = cpool->length() - 1; i >= 1; i--) {
 153       if (cpool->tag_at(i).is_klass()) {
 154         Klass*  kls = cpool->resolved_klass_at(i);
 155         if (kls->name() == sym) {
 156           return kls;
 157         }
 158       }
 159     }
 160   }
 161 
 162   return found_klass;
 163 }
 164 
 165 // ------------------------------------------------------------------
 166 Klass* JVMCIEnv::get_klass_by_name(Klass* accessing_klass,
 167                                   Symbol* klass_name,
 168                                   bool require_local) {
 169   ResourceMark rm;
 170   constantPoolHandle cpool;
 171   return get_klass_by_name_impl(accessing_klass,
 172                                 cpool,
 173                                 klass_name,


< prev index next >