Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlot.java @ 12644:e122dc0436be
convert FrameSlot interface to a final class.
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 30 Oct 2013 19:05:29 +0100 |
parents | 494b818b527c |
children | 80b0bd9e29c8 |
comparison
equal
deleted
inserted
replaced
12643:856a9864ed93 | 12644:e122dc0436be |
---|---|
22 * or visit www.oracle.com if you need additional information or have any | 22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. | 23 * questions. |
24 */ | 24 */ |
25 package com.oracle.truffle.api.frame; | 25 package com.oracle.truffle.api.frame; |
26 | 26 |
27 import com.oracle.truffle.api.*; | |
28 | |
27 /** | 29 /** |
28 * A slot in a frame that can store a value of a given type. | 30 * A slot in a frame that can store a value of a given type. |
29 */ | 31 */ |
30 public interface FrameSlot extends Cloneable { | 32 public final class FrameSlot implements Cloneable { |
31 | 33 |
32 Object getIdentifier(); | 34 private final FrameDescriptor descriptor; |
35 private final Object identifier; | |
36 private final int index; | |
37 @com.oracle.truffle.api.CompilerDirectives.CompilationFinal private FrameSlotKind kind; | |
33 | 38 |
34 int getIndex(); | 39 public FrameSlot(FrameDescriptor descriptor, Object identifier, int index, FrameSlotKind kind) { |
40 this.descriptor = descriptor; | |
41 this.identifier = identifier; | |
42 this.index = index; | |
43 this.kind = kind; | |
44 } | |
35 | 45 |
36 FrameSlotKind getKind(); | 46 public Object getIdentifier() { |
47 return identifier; | |
48 } | |
37 | 49 |
38 void setKind(FrameSlotKind kind); | 50 public int getIndex() { |
51 return index; | |
52 } | |
39 | 53 |
40 FrameDescriptor getFrameDescriptor(); | 54 public FrameSlotKind getKind() { |
55 return kind; | |
56 } | |
57 | |
58 public void setKind(final FrameSlotKind kind) { | |
59 if (this.kind != kind) { | |
60 CompilerDirectives.transferToInterpreter(); | |
61 this.kind = kind; | |
62 this.descriptor.updateVersion(); | |
63 } | |
64 } | |
65 | |
66 @Override | |
67 public String toString() { | |
68 return "[" + index + "," + identifier + "," + kind + "]"; | |
69 } | |
70 | |
71 public FrameDescriptor getFrameDescriptor() { | |
72 return this.descriptor; | |
73 } | |
41 } | 74 } |