1 package org.simantics.scl.compiler.internal.codegen.ssa.exits;
3 import java.util.ArrayList;
5 import org.simantics.scl.compiler.internal.codegen.continuations.Cont;
6 import org.simantics.scl.compiler.internal.codegen.continuations.ContRef;
7 import org.simantics.scl.compiler.internal.codegen.references.Val;
8 import org.simantics.scl.compiler.internal.codegen.references.ValRef;
9 import org.simantics.scl.compiler.internal.codegen.ssa.SSABlock;
10 import org.simantics.scl.compiler.internal.codegen.ssa.SSAExit;
11 import org.simantics.scl.compiler.internal.codegen.ssa.SSAFunction;
12 import org.simantics.scl.compiler.internal.codegen.utils.CopyContext;
13 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
14 import org.simantics.scl.compiler.internal.codegen.utils.PrintingContext;
15 import org.simantics.scl.compiler.internal.codegen.utils.SSAValidationContext;
16 import org.simantics.scl.compiler.internal.codegen.utils.ValRefVisitor;
17 import org.simantics.scl.compiler.types.TVar;
18 import org.simantics.scl.compiler.types.Type;
20 public class Throw2 extends SSAExit {
24 public Throw2(ValRef exception) {
25 this.exception = exception;
29 public void toString(PrintingContext context) {
30 context.append("throw ");
31 context.append(exception);
36 public void generateCode(MethodBuilder mb) {
37 mb.pushBoxed(exception.getBinding());
42 public void validate(SSAValidationContext context) {
46 public void destroy() {
51 public SSAExit copy(CopyContext context) {
52 return new Throw2(exception.copy());
56 public void replace(TVar[] vars, Type[] replacements) {
60 public void collectFreeVariables(SSAFunction function,
61 ArrayList<ValRef> vars) {
65 public Cont addParametersInFrontOf(ContRef contRef, Val[] newParameters, Val[] oldParameters,
71 public SSABlock[] getSuccessors() {
72 return SSABlock.EMPTY_ARRAY;
76 public void forValRefs(ValRefVisitor visitor) {
80 public void cleanup() {