< prev index next >

src/hotspot/share/jvmci/compilerRuntime.cpp

Print this page


   1 /*
   2  * Copyright (c) 2016, 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  */
  23 
  24 #include "precompiled.hpp"
  25 #include "classfile/stringTable.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "interpreter/linkResolver.hpp"
  28 #include "jvmci/compilerRuntime.hpp"

  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/compilationPolicy.hpp"
  31 #include "runtime/deoptimization.hpp"
  32 #include "runtime/interfaceSupport.hpp"
  33 #include "runtime/vframe.hpp"
  34 #include "aot/aotLoader.hpp"
  35 
  36 // Resolve and allocate String
  37 JRT_BLOCK_ENTRY(void, CompilerRuntime::resolve_string_by_symbol(JavaThread *thread, void* string_result, const char* name))
  38   JRT_BLOCK
  39     oop str = *(oop*)string_result; // Is it resolved already?
  40     if (str == NULL) { // Do resolution
  41       // First 2 bytes of name contains length (number of bytes).
  42       int len = build_u2_from((address)name);
  43       name += 2;
  44       TempNewSymbol sym = SymbolTable::new_symbol(name, len, CHECK);
  45       str = StringTable::intern(sym, CHECK);
  46       assert(java_lang_String::is_instance(str), "must be string");
  47       *(oop*)string_result = str; // Store result
  48     }


   1 /*
   2  * Copyright (c) 2016, 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  */
  23 
  24 #include "precompiled.hpp"
  25 #include "classfile/stringTable.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "interpreter/linkResolver.hpp"
  28 #include "jvmci/compilerRuntime.hpp"
  29 #include "oops/cpCache.inline.hpp"
  30 #include "oops/oop.inline.hpp"
  31 #include "runtime/compilationPolicy.hpp"
  32 #include "runtime/deoptimization.hpp"
  33 #include "runtime/interfaceSupport.hpp"
  34 #include "runtime/vframe.hpp"
  35 #include "aot/aotLoader.hpp"
  36 
  37 // Resolve and allocate String
  38 JRT_BLOCK_ENTRY(void, CompilerRuntime::resolve_string_by_symbol(JavaThread *thread, void* string_result, const char* name))
  39   JRT_BLOCK
  40     oop str = *(oop*)string_result; // Is it resolved already?
  41     if (str == NULL) { // Do resolution
  42       // First 2 bytes of name contains length (number of bytes).
  43       int len = build_u2_from((address)name);
  44       name += 2;
  45       TempNewSymbol sym = SymbolTable::new_symbol(name, len, CHECK);
  46       str = StringTable::intern(sym, CHECK);
  47       assert(java_lang_String::is_instance(str), "must be string");
  48       *(oop*)string_result = str; // Store result
  49     }


< prev index next >