src/hotspot/share/jvmci/compilerRuntime.cpp
changeset 53147 db1d11c253d8
parent 49480 d7df2dd501ce
child 53582 881c5fbeb849
equal deleted inserted replaced
53146:62a4355dc9c8 53147:db1d11c253d8
     1 /*
     1 /*
     2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 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.
    31 #include "runtime/compilationPolicy.hpp"
    31 #include "runtime/compilationPolicy.hpp"
    32 #include "runtime/frame.inline.hpp"
    32 #include "runtime/frame.inline.hpp"
    33 #include "runtime/deoptimization.hpp"
    33 #include "runtime/deoptimization.hpp"
    34 #include "runtime/interfaceSupport.inline.hpp"
    34 #include "runtime/interfaceSupport.inline.hpp"
    35 #include "runtime/vframe.inline.hpp"
    35 #include "runtime/vframe.inline.hpp"
       
    36 #include "utilities/sizes.hpp"
    36 #include "aot/aotLoader.hpp"
    37 #include "aot/aotLoader.hpp"
    37 
    38 
    38 // Resolve and allocate String
    39 // Resolve and allocate String
    39 JRT_BLOCK_ENTRY(void, CompilerRuntime::resolve_string_by_symbol(JavaThread *thread, void* string_result, const char* name))
    40 JRT_BLOCK_ENTRY(void, CompilerRuntime::resolve_string_by_symbol(JavaThread *thread, void* string_result, const char* name))
    40   JRT_BLOCK
    41   JRT_BLOCK
    41     oop str = *(oop*)string_result; // Is it resolved already?
    42     oop str = *(oop*)string_result; // Is it resolved already?
    42     if (str == NULL) { // Do resolution
    43     if (str == NULL) { // Do resolution
    43       // First 2 bytes of name contains length (number of bytes).
    44       // First 2 bytes of name contains length (number of bytes).
    44       int len = build_u2_from((address)name);
    45       int len = Bytes::get_Java_u2((address)name);
    45       name += 2;
    46       name += 2;
    46       TempNewSymbol sym = SymbolTable::new_symbol(name, len, CHECK);
    47       TempNewSymbol sym = SymbolTable::new_symbol(name, len, CHECK);
    47       str = StringTable::intern(sym, CHECK);
    48       str = StringTable::intern(sym, CHECK);
    48       assert(java_lang_String::is_instance(str), "must be string");
    49       assert(java_lang_String::is_instance(str), "must be string");
    49       *(oop*)string_result = str; // Store result
    50       *(oop*)string_result = str; // Store result
    90   Klass* k = NULL;
    91   Klass* k = NULL;
    91   JRT_BLOCK
    92   JRT_BLOCK
    92     k = *klass_result; // Is it resolved already?
    93     k = *klass_result; // Is it resolved already?
    93     if (k == NULL) { // Do resolution
    94     if (k == NULL) { // Do resolution
    94       // First 2 bytes of name contains length (number of bytes).
    95       // First 2 bytes of name contains length (number of bytes).
    95       int len = build_u2_from((address)name);
    96       int len = Bytes::get_Java_u2((address)name);
    96       name += 2;
    97       name += 2;
    97       k = CompilerRuntime::resolve_klass_helper(thread, name, len, CHECK_NULL);
    98       k = CompilerRuntime::resolve_klass_helper(thread, name, len, CHECK_NULL);
    98       *klass_result = k; // Store result
    99       *klass_result = k; // Store result
    99     }
   100     }
   100   JRT_BLOCK_END
   101   JRT_BLOCK_END
   184 JRT_BLOCK_ENTRY(MethodCounters*, CompilerRuntime::resolve_method_by_symbol_and_load_counters(JavaThread *thread, MethodCounters** counters_result, Klass* klass, const char* data))
   185 JRT_BLOCK_ENTRY(MethodCounters*, CompilerRuntime::resolve_method_by_symbol_and_load_counters(JavaThread *thread, MethodCounters** counters_result, Klass* klass, const char* data))
   185   MethodCounters* c = *counters_result; // Is it resolved already?
   186   MethodCounters* c = *counters_result; // Is it resolved already?
   186   JRT_BLOCK
   187   JRT_BLOCK
   187      if (c == NULL) { // Do resolution
   188      if (c == NULL) { // Do resolution
   188        // Get method name and its length
   189        // Get method name and its length
   189        int method_name_len = build_u2_from((address)data);
   190        int method_name_len = Bytes::get_Java_u2((address)data);
   190        data += sizeof(u2);
   191        data += sizeof(u2);
   191        const char* method_name = data;
   192        const char* method_name = data;
   192        data += method_name_len;
   193        data += method_name_len;
   193 
   194 
   194        // Get signature and its length
   195        // Get signature and its length
   195        int signature_name_len = build_u2_from((address)data);
   196        int signature_name_len = Bytes::get_Java_u2((address)data);
   196        data += sizeof(u2);
   197        data += sizeof(u2);
   197        const char* signature_name = data;
   198        const char* signature_name = data;
   198 
   199 
   199        assert(klass != NULL, "Klass parameter must not be null");
   200        assert(klass != NULL, "Klass parameter must not be null");
   200        Method* m = resolve_method_helper(klass, method_name, method_name_len, signature_name, signature_name_len);
   201        Method* m = resolve_method_helper(klass, method_name, method_name_len, signature_name, signature_name_len);
   219     k = klass_result[0]; // Is it initialized already?
   220     k = klass_result[0]; // Is it initialized already?
   220     if (k == NULL) { // Do initialized
   221     if (k == NULL) { // Do initialized
   221       k = klass_result[1]; // Is it resolved already?
   222       k = klass_result[1]; // Is it resolved already?
   222       if (k == NULL) { // Do resolution
   223       if (k == NULL) { // Do resolution
   223         // First 2 bytes of name contains length (number of bytes).
   224         // First 2 bytes of name contains length (number of bytes).
   224         int len = build_u2_from((address)name);
   225         int len = Bytes::get_Java_u2((address)name);
   225         const char *cname = name + 2;
   226         const char *cname = name + 2;
   226         k = CompilerRuntime::resolve_klass_helper(thread,  cname, len, CHECK_NULL);
   227         k = CompilerRuntime::resolve_klass_helper(thread,  cname, len, CHECK_NULL);
   227         klass_result[1] = k; // Store resolved result
   228         klass_result[1] = k; // Store resolved result
   228       }
   229       }
   229       Klass* k0 = klass_result[0]; // Is it initialized already?
   230       Klass* k0 = klass_result[0]; // Is it initialized already?