1 /* 2 * Copyright (c) 2015, 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 import jdk.vm.ci.code.CompilationRequest; 26 27 /** 28 * A compilation request with extra HotSpot specific context such as a compilation identifier and 29 * the address of a {@code JVMCIEnv} object that provides native context for a compilation. 30 */ 31 public class HotSpotCompilationRequest extends CompilationRequest { 32 private final long jvmciEnv; 33 private final int id; 34 35 /** 36 * Creates a request to compile a method starting at a given BCI and allocates an identifier to 37 * the request. 38 * 39 * @param method the method to be compiled 40 * @param entryBCI the bytecode index (BCI) at which to start compiling where -1 denotes the 41 * method's entry point 42 * @param jvmciEnv address of a native {@code JVMCIEnv} object or 0L 43 */ 44 public HotSpotCompilationRequest(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv) { 45 this(method, entryBCI, jvmciEnv, method.allocateCompileId(entryBCI)); 46 } 47 48 /** 49 * Creates a request to compile a method starting at a given BCI. 50 * 51 * @param method the method to be compiled 52 * @param entryBCI the bytecode index (BCI) at which to start compiling where -1 denotes the 53 * method's entry point 54 * @param jvmciEnv address of a native {@code JVMCIEnv} object or 0L 55 * @param id an identifier for the request 56 */ 57 public HotSpotCompilationRequest(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) { 58 super(method, entryBCI); 59 this.jvmciEnv = jvmciEnv; 60 this.id = id; 61 } 62 63 @Override 64 public HotSpotResolvedJavaMethod getMethod() { 65 return (HotSpotResolvedJavaMethod) super.getMethod(); 66 } 67 68 /** 69 * Gets the address of the native {@code JVMCIEnv} object or 0L if no such object exists. 70 */ 71 public long getJvmciEnv() { 72 return jvmciEnv; 73 } 74 75 /** 76 * Gets the VM allocated identifier for this compilation. 77 */ 78 public int getId() { 79 return id; 80 } 81 82 }