author | zgu |
Fri, 18 Oct 2019 11:36:35 -0400 | |
changeset 58686 | 0279391875bf |
parent 54669 | ad45b3802d4e |
permissions | -rw-r--r-- |
43972 | 1 |
/* |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
50858
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
43972 | 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 |
package jdk.vm.ci.hotspot; |
|
24 |
||
25 |
/** |
|
26 |
* Describes a C++ field exposed via {@link HotSpotVMConfigAccess}. |
|
27 |
*/ |
|
28 |
public final class VMField { |
|
29 |
||
30 |
/** |
|
31 |
* Fully qualified name of the represented field (e.g., "Klass::_name"). |
|
32 |
*/ |
|
33 |
public final String name; |
|
34 |
||
35 |
/** |
|
36 |
* The represented field's type (e.g., "Symbol*"). This may be {@code null}. |
|
37 |
*/ |
|
38 |
public final String type; |
|
39 |
||
40 |
/** |
|
41 |
* If the represented field is non-static, this is its offset within the containing structure. |
|
42 |
*/ |
|
43 |
public final long offset; |
|
44 |
||
45 |
/** |
|
46 |
* If the represented field is static, this is its address. Otherwise, this is 0. |
|
47 |
*/ |
|
48 |
public final long address; |
|
49 |
||
50 |
/** |
|
51 |
* Value of the field represented as a boxed boolean if its C++ type is bool otherwise as a |
|
52 |
* boxed long; only valid for non-oop static fields. This value is only captured once, during |
|
53 |
* JVMCI initialization. If {@link #type} cannot be meaningfully (e.g., a struct) or safely |
|
54 |
* (e.g., an oop) expressed as a boxed object, this is {@code null}. |
|
55 |
*/ |
|
56 |
public final Object value; |
|
57 |
||
58 |
/** |
|
59 |
* Determines if the represented field is static. |
|
60 |
*/ |
|
61 |
public boolean isStatic() { |
|
62 |
return address != 0; |
|
63 |
} |
|
64 |
||
65 |
/** |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
50858
diff
changeset
|
66 |
* Creates a description of a non-static field. |
43972 | 67 |
*/ |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
50858
diff
changeset
|
68 |
@VMEntryPoint |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
50858
diff
changeset
|
69 |
VMField(String name, String type, long offset, long address, Object value) { |
43972 | 70 |
this.name = name; |
71 |
this.type = type; |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
50858
diff
changeset
|
72 |
this.offset = offset; |
43972 | 73 |
this.address = address; |
74 |
this.value = value; |
|
75 |
} |
|
76 |
||
77 |
@Override |
|
78 |
public String toString() { |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
50858
diff
changeset
|
79 |
String val = value == null ? "null" : (type.contains("*") ? String.format("0x%x", value) : String.format("%s", value)); |
43972 | 80 |
return String.format("Field[name=%s, type=%s, offset=%d, address=0x%x, value=%s]", name, type, offset, address, val); |
81 |
} |
|
82 |
} |