]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/continuations/ContRef.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / continuations / ContRef.java
1 package org.simantics.scl.compiler.internal.codegen.continuations;\r
2 \r
3 import org.simantics.scl.compiler.internal.codegen.references.Val;\r
4 import org.simantics.scl.compiler.internal.codegen.references.ValRef;\r
5 import org.simantics.scl.compiler.internal.codegen.ssa.SSAExit;\r
6 \r
7 \r
8 public final class ContRef {\r
9     public static final ValRef[] EMPTY_ARRAY = new ValRef[0];\r
10 \r
11     Cont binding;\r
12     ContRef prev; // FreeVars with the same binding form a linked list\r
13     ContRef next;     \r
14     SSAExit parent;\r
15     \r
16     ContRef(Cont binding) {\r
17         this.binding = binding;\r
18         \r
19         ContRef head = binding.occurrence;\r
20         binding.occurrence = this;\r
21         this.next = head;\r
22         if(head != null)\r
23             head.prev = this;\r
24     }    \r
25     \r
26     public void remove() {\r
27         if(prev == null)\r
28             binding.occurrence = next;\r
29         else\r
30             prev.next = next;\r
31         if(next != null)\r
32             next.prev = prev;\r
33     }\r
34 \r
35     public Cont getBinding() {\r
36         return binding;\r
37     }\r
38     \r
39     public ContRef getNext() {\r
40         return next;\r
41     }\r
42 \r
43     public void setParent(SSAExit parent) {\r
44         this.parent = parent;\r
45     }\r
46 \r
47     public Cont addParametersInFront(Val[] newParameters, Val[] oldParameters, Cont proxy) {\r
48         return parent.addParametersInFrontOf(this, newParameters, oldParameters, proxy);\r
49     }\r
50     \r
51     public SSAExit getParent() {\r
52         return parent;\r
53     }\r
54 }\r