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