1 /* 2 * Copyright (c) 2016, 2019, 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 26 package jdk.tools.jaotc; 27 28 import java.util.HashMap; 29 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; 30 31 /** 32 * Constants used to mark special positions in code being installed into the code cache by Graal C++ 33 * code. 34 */ 35 enum MarkId { 36 VERIFIED_ENTRY("CodeInstaller::VERIFIED_ENTRY"), 37 UNVERIFIED_ENTRY("CodeInstaller::UNVERIFIED_ENTRY"), 38 OSR_ENTRY("CodeInstaller::OSR_ENTRY"), 39 EXCEPTION_HANDLER_ENTRY("CodeInstaller::EXCEPTION_HANDLER_ENTRY"), 40 DEOPT_HANDLER_ENTRY("CodeInstaller::DEOPT_HANDLER_ENTRY"), 41 INVOKEINTERFACE("CodeInstaller::INVOKEINTERFACE"), 42 INVOKEVIRTUAL("CodeInstaller::INVOKEVIRTUAL"), 43 INVOKESTATIC("CodeInstaller::INVOKESTATIC"), 44 INVOKESPECIAL("CodeInstaller::INVOKESPECIAL"), 45 INLINE_INVOKE("CodeInstaller::INLINE_INVOKE"), 46 POLL_NEAR("CodeInstaller::POLL_NEAR"), 47 POLL_RETURN_NEAR("CodeInstaller::POLL_RETURN_NEAR"), 48 POLL_FAR("CodeInstaller::POLL_FAR"), 49 POLL_RETURN_FAR("CodeInstaller::POLL_RETURN_FAR"), 50 CARD_TABLE_ADDRESS("CodeInstaller::CARD_TABLE_ADDRESS"), 51 HEAP_TOP_ADDRESS("CodeInstaller::HEAP_TOP_ADDRESS"), 52 HEAP_END_ADDRESS("CodeInstaller::HEAP_END_ADDRESS"), 53 NARROW_KLASS_BASE_ADDRESS("CodeInstaller::NARROW_KLASS_BASE_ADDRESS"), 54 NARROW_OOP_BASE_ADDRESS("CodeInstaller::NARROW_OOP_BASE_ADDRESS"), 55 CRC_TABLE_ADDRESS("CodeInstaller::CRC_TABLE_ADDRESS"), 56 LOG_OF_HEAP_REGION_GRAIN_BYTES("CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES"), 57 INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED("CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED"); 58 59 private final int value; 60 private static HashMap<Integer, MarkId> lookup = new HashMap<Integer, MarkId>(); 61 62 static { 63 for (MarkId e : values()) { 64 lookup.put(e.value, e); 65 } 66 } 67 MarkId(String name) { 68 this.value = (int) (long) HotSpotJVMCIRuntime.runtime().getConfigStore().getConstants().get(name); 69 } 70 71 static MarkId getEnum(int value) { 72 MarkId e = lookup.get(value); 73 if (e == null) { 74 throw new InternalError("Unknown enum value: " + value); 75 } 76 return e; 77 } 78 }