comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java @ 22773:9273bb6ba33e

Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
author Roland Schatz <roland.schatz@oracle.com>
date Fri, 15 Jan 2016 16:50:19 +0100
parents 1bbd4a7c274b
children 5d06abd6d35b
comparison
equal deleted inserted replaced
22772:f16c1266b0de 22773:9273bb6ba33e
1 /* 1 /*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2011, 2016, 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.
20 * or visit www.oracle.com if you need additional information or have any 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 */ 22 */
23 package jdk.vm.ci.hotspot; 23 package jdk.vm.ci.hotspot;
24 24
25 import jdk.vm.ci.code.CompilationResult; 25 import jdk.vm.ci.code.site.DataPatch;
26 import jdk.vm.ci.code.site.Site;
26 import jdk.vm.ci.inittimer.SuppressFBWarnings; 27 import jdk.vm.ci.inittimer.SuppressFBWarnings;
28 import jdk.vm.ci.meta.Assumptions.Assumption;
29 import jdk.vm.ci.meta.ResolvedJavaMethod;
27 30
28 /** 31 /**
29 * {@link HotSpotCompiledCode} destined for installation as an nmethod. 32 * {@link HotSpotCompiledCode} destined for installation as an nmethod.
30 */ 33 */
31 public final class HotSpotCompiledNmethod extends HotSpotCompiledCode { 34 public final class HotSpotCompiledNmethod extends HotSpotCompiledCode {
32 35
33 public final HotSpotResolvedJavaMethod method; 36 protected final HotSpotResolvedJavaMethod method;
34 public final int entryBCI; 37 protected final int entryBCI;
35 38
36 /** 39 /**
37 * Compilation identifier. 40 * Compilation identifier.
38 */ 41 */
39 public final int id; 42 protected final int id;
40 43
41 /** 44 /**
42 * Address of a native {@code JVMCIEnv} object or 0L if no such object exists. 45 * Address of a native {@code JVMCIEnv} object or 0L if no such object exists.
43 */ 46 */
44 public final long jvmciEnv; 47 protected final long jvmciEnv;
45 48
46 public final boolean hasUnsafeAccess; 49 protected final boolean hasUnsafeAccess;
47 50
48 /** 51 /**
49 * May be set by VM if code installation fails. It will describe in more detail why installation 52 * May be set by VM if code installation fails. It will describe in more detail why installation
50 * failed (e.g., exactly which dependency failed). 53 * failed (e.g., exactly which dependency failed).
51 */ 54 */
52 @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "set by the VM") private String installationFailureMessage; 55 @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "set by the VM") private String installationFailureMessage;
53 56
54 public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, int id, long jvmciEnv) { 57 public HotSpotCompiledNmethod(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
55 super(compResult); 58 int dataSectionAlignment, DataPatch[] dataSectionPatches, int totalFrameSize, int customStackAreaOffset, HotSpotResolvedJavaMethod method, int entryBCI, int id, long jvmciEnv,
59 boolean hasUnsafeAccess) {
60 super(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, totalFrameSize, customStackAreaOffset);
56 this.method = method; 61 this.method = method;
57 this.entryBCI = compResult.getEntryBCI(); 62 this.entryBCI = entryBCI;
58 this.id = id; 63 this.id = id;
59 this.jvmciEnv = jvmciEnv; 64 this.jvmciEnv = jvmciEnv;
60 this.hasUnsafeAccess = compResult.hasUnsafeAccess(); 65 this.hasUnsafeAccess = hasUnsafeAccess;
61 } 66 }
62 67
63 @Override 68 @Override
64 public String toString() { 69 public String toString() {
65 return getClass().getSimpleName() + "[" + id + ":" + method.format("%H.%n(%p)%r@") + entryBCI + "]"; 70 return getClass().getSimpleName() + "[" + id + ":" + method.format("%H.%n(%p)%r@") + entryBCI + "]";