aboutsummaryrefslogtreecommitdiff
path: root/tests/icon/regression/o3_direct_replace.zc
blob: efcd0be26bd20f700d67537cbbf47102dc89af2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
include rt;
include run;
include icon;
// replace an o3 function and call it directly (entry via the patched prologue),
// after warming the compiled region so the store must drop it.
o3 int target() { return 1; }
fn main() {
	int i, s = 0;
	for (i = 0; i < 100; i++) s += target();
	rt.put_n(s); rt.put_c(' ');
	let one = run.tokens("1"), two = run.tokens("2");
	rt.put_n(icon.find_replace(target, one, two)); rt.put_c(' ');
	s = 0;
	for (i = 0; i < 100; i++) s += target();
	rt.put_n(s); rt.put_c(10);
	return 0;
}