comparison jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Mark.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 jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationResult.java@22110ef74a40
children 1d4ce2d19e52
comparison
equal deleted inserted replaced
22772:f16c1266b0de 22773:9273bb6ba33e
1 /*
2 * Copyright (c) 2009, 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.code.site;
24
25 import java.util.Objects;
26
27 /**
28 * Represents a mark in the machine code that can be used by the runtime for its own purposes. A
29 * mark can reference other marks.
30 */
31 public final class Mark extends Site {
32
33 public final Object id;
34
35 public Mark(int pcOffset, Object id) {
36 super(pcOffset);
37 this.id = id;
38 }
39
40 @Override
41 public String toString() {
42 if (id == null) {
43 return String.format("%d[<mar>]", pcOffset);
44 } else if (id instanceof Integer) {
45 return String.format("%d[<mark with id %s>]", pcOffset, Integer.toHexString((Integer) id));
46 } else {
47 return String.format("%d[<mark with id %s>]", pcOffset, id.toString());
48 }
49 }
50
51 @Override
52 public boolean equals(Object obj) {
53 if (this == obj) {
54 return true;
55 }
56 if (obj instanceof Mark) {
57 Mark that = (Mark) obj;
58 if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) {
59 return true;
60 }
61 }
62 return false;
63 }
64 }