jdk

Форк
0
/
lambdaProxyClassDictionary.cpp 
77 строк · 3.5 Кб
1
/*
2
 * Copyright (c) 2021, 2023, 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

25
#include "precompiled.hpp"
26
#include "cds/archiveBuilder.hpp"
27
#include "cds/lambdaProxyClassDictionary.hpp"
28
#include "classfile/systemDictionaryShared.hpp"
29
#include "memory/resourceArea.hpp"
30

31
DumpTimeLambdaProxyClassInfo::~DumpTimeLambdaProxyClassInfo() {
32
  if (_proxy_klasses != nullptr) {
33
    delete _proxy_klasses;
34
  }
35
}
36

37
void LambdaProxyClassKey::init_for_archive(LambdaProxyClassKey& dumptime_key) {
38
  ArchiveBuilder* b = ArchiveBuilder::current();
39

40
  b->write_pointer_in_buffer(&_caller_ik,                dumptime_key._caller_ik);
41
  b->write_pointer_in_buffer(&_instantiated_method_type, dumptime_key._instantiated_method_type);
42
  b->write_pointer_in_buffer(&_invoked_name,             dumptime_key._invoked_name);
43
  b->write_pointer_in_buffer(&_invoked_type,             dumptime_key._invoked_type);
44
  b->write_pointer_in_buffer(&_member_method,            dumptime_key._member_method);
45
  b->write_pointer_in_buffer(&_method_type,              dumptime_key._method_type);
46
}
47

48
unsigned int LambdaProxyClassKey::hash() const {
49
  return SystemDictionaryShared::hash_for_shared_dictionary((address)_caller_ik) +
50
         SystemDictionaryShared::hash_for_shared_dictionary((address)_invoked_name) +
51
         SystemDictionaryShared::hash_for_shared_dictionary((address)_invoked_type) +
52
         SystemDictionaryShared::hash_for_shared_dictionary((address)_method_type) +
53
         SystemDictionaryShared::hash_for_shared_dictionary((address)_instantiated_method_type);
54
}
55

56
#ifndef PRODUCT
57
void LambdaProxyClassKey::print_on(outputStream* st) const {
58
  ResourceMark rm;
59
  st->print_cr("LambdaProxyClassKey       : " INTPTR_FORMAT " hash: %0x08x", p2i(this), hash());
60
  st->print_cr("_caller_ik                : %s", _caller_ik->external_name());
61
  st->print_cr("_instantiated_method_type : %s", _instantiated_method_type->as_C_string());
62
  st->print_cr("_invoked_name             : %s", _invoked_name->as_C_string());
63
  st->print_cr("_invoked_type             : %s", _invoked_type->as_C_string());
64
  st->print_cr("_member_method            : %s", _member_method->name()->as_C_string());
65
  st->print_cr("_method_type              : %s", _method_type->as_C_string());
66
}
67

68
void RunTimeLambdaProxyClassInfo::print_on(outputStream* st) const {
69
  _key.print_on(st);
70
}
71
#endif
72

73
void RunTimeLambdaProxyClassInfo::init(LambdaProxyClassKey& key, DumpTimeLambdaProxyClassInfo& info) {
74
  _key.init_for_archive(key);
75
  ArchiveBuilder::current()->write_pointer_in_buffer(&_proxy_klass_head,
76
                                                     info._proxy_klasses->at(0));
77
}
78

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.