# HG changeset patch # User Jaroslav Tulach # Date 1451485993 -3600 # Node ID 114a6a77b440c8ec7ffff65a659ff06ae3f56549 # Parent a5e58793bbca2903f7d544aa653f6e48a426d5fe Colorifying ByteValueProfile sample code diff -r a5e58793bbca -r 114a6a77b440 truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/ByteValueProfile.java --- a/truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/ByteValueProfile.java Wed Dec 30 11:06:33 2015 +0100 +++ b/truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/ByteValueProfile.java Wed Dec 30 15:33:13 2015 +0100 @@ -37,22 +37,7 @@ *

* *

- * 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 }