Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/VMField.java @ 23679:b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 15 Jun 2016 00:00:41 +0200 |
parents | |
children | 1439a6614a10 |
comparison
equal
deleted
inserted
replaced
23678:e86a0b0ba969 | 23679:b5557b757040 |
---|---|
1 /* | |
2 * Copyright (c) 2016, 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 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 represented field is non-static, this is its offset within the containing structure. | |
42 */ | |
43 public final long offset; | |
44 | |
45 /** | |
46 * If represented field is static, this is its address. Otherwise, this field is 0. | |
47 */ | |
48 public final long address; | |
49 | |
50 /** | |
51 * Value of the field represented as a boxed long; only valid for non-oop static fields. This | |
52 * value is only captured once, during JVMCI initialization. If {@link #type} cannot be | |
53 * meaningfully (e.g., a struct) or safely (e.g., an oop) expressed as a boxed long, this is | |
54 * {@code null}. | |
55 */ | |
56 public final Long value; | |
57 | |
58 /** | |
59 * Determines if the represented field is static. | |
60 */ | |
61 public boolean isStatic() { | |
62 return address != 0; | |
63 } | |
64 | |
65 /** | |
66 * Creates a description of a non-static field. | |
67 */ | |
68 public VMField(String name, String type, long offset) { | |
69 this.name = name; | |
70 this.type = type; | |
71 this.offset = offset; | |
72 this.address = 0; | |
73 this.value = null; | |
74 } | |
75 | |
76 /** | |
77 * Creates a description of a static field. | |
78 */ | |
79 public VMField(String name, String type, long address, Long value) { | |
80 this.name = name; | |
81 this.type = type; | |
82 this.offset = 0; | |
83 this.address = address; | |
84 this.value = value; | |
85 } | |
86 | |
87 @Override | |
88 public String toString() { | |
89 String val = value == null ? "null" : String.format("0x%x", value); | |
90 return String.format("Field[name=%s, type=%s, offset=%d, address=0x%x, value=%s]", name, type, offset, address, val); | |
91 } | |
92 } |