# HG changeset patch
# User Jaroslav Tulach
- * Usage example: - * - *
- * class SampleNode extends Node { - * - * final ByteValueProfile profile = ByteValueProfile.createIdentityProfile(); - * - * byte execute(byte input) { - * byte profiledValue = profile.profile(input); - * // compiler may know now more about profiledValue - * return profiledValue; - * } - * } - *- *
- * + * Usage example: {@codesnippet ByteValueProfileSample} * * {@inheritDoc} * diff -r a5e58793bbca -r 114a6a77b440 truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/ByteValueProfileTest.java --- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/ByteValueProfileTest.java Wed Dec 30 11:06:33 2015 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/ByteValueProfileTest.java Wed Dec 30 15:33:13 2015 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.truffle.api.profiles; +import com.oracle.truffle.api.nodes.Node; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; @@ -113,4 +114,15 @@ p.toString(); // test that it is not crashing } + // BEGIN: ByteValueProfileSample + class SampleNode extends Node { + final ByteValueProfile profile = ByteValueProfile.createIdentityProfile(); + + byte execute(byte input) { + byte profiledValue = profile.profile(input); + // compiler may know now more about profiledValue + return profiledValue; + } + } + // END: ByteValueProfileSample }