package org.metaborg.meta.lang.dynsem.interpreter.nodes.matching;

import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;

public abstract class IntLiteralTermMatchPattern extends LiteralMatchPattern {

	protected final int lit;

	public IntLiteralTermMatchPattern(int lit, SourceSection source) {
		super(source);
		this.lit = lit;
	}

	@Specialization(guards = "i == lit")
	public void doSuccess(int i) {

	}

	@Specialization
	public void doFailure(int i) {
		throw PatternMatchFailure.INSTANCE;
	}

}
@@ -110,16 +110,73 @@
 zation;%0A
+import com.oracle.truffle.api.profiles.ConditionProfile;%0A
 import c
@@ -439,131 +439,177 @@
 %7D%0A%0A%09
-@Specialization(guards = %22i == lit%22)%0A%09public void doSuccess(int i) %7B%0A%0A%09%7D%0A%0A%09@Specialization%0A%09public void doFailure(int i
+private final ConditionProfile profile = ConditionProfile.createCountingProfile();%0A%0A%09@Specialization%0A%09public void doSuccess(int i) %7B%0A%09%09if (profile.profile(i != lit)
 ) %7B%0A
+%09
 %09%09th
@@ -642,13 +642,17 @@
 STANCE;%0A
+%09%09%7D%0A
 %09%7D%0A%0A%7D

Fix competely invalid value specialization in integer literal matching