comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java @ 16529:f6ac86d3334e

Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
author Christian Wimmer <christian.wimmer@oracle.com>
date Tue, 15 Jul 2014 16:34:53 -0700
parents e44dd5a90947
children ada0a7729b6f
comparison
equal deleted inserted replaced
16510:b0ea5c266655 16529:f6ac86d3334e
107 /** 107 /**
108 * Accesses the current stack, i.e., the contents of the {@link Frame}s and the associated 108 * Accesses the current stack, i.e., the contents of the {@link Frame}s and the associated
109 * {@link CallTarget}s. Iteration starts at the caller frame, i.e., it does not include the 109 * {@link CallTarget}s. Iteration starts at the caller frame, i.e., it does not include the
110 * current frame. 110 * current frame.
111 * 111 *
112 * @return a lazy collection of {@link FrameInstance}. 112 * Iteration continues as long as {@link FrameInstanceVisitor#visitFrame}, which is invoked for
113 * every {@link FrameInstance}, returns null. Any non-null result of the visitor indicates that
114 * frame iteration should stop.
115 *
116 * @param visitor the visitor that is called for every matching frame.
117 * @return the last result returned by the visitor (which is non-null to indicate that iteration
118 * should stop), or null if the whole stack was iterated.
113 */ 119 */
114 Iterable<FrameInstance> getStackTrace(); 120 <T> T iterateFrames(FrameInstanceVisitor<T> visitor);
121
122 /**
123 * Accesses the caller frame. This is a convenience method that returns the first frame that is
124 * passed to the visitor of {@link #iterateFrames}.
125 */
126 FrameInstance getCallerFrame();
115 127
116 /** 128 /**
117 * Accesses the current frame, i.e., the frame of the closest {@link CallTarget}. It is 129 * Accesses the current frame, i.e., the frame of the closest {@link CallTarget}. It is
118 * important to note that this {@link FrameInstance} supports only slow path access. 130 * important to note that this {@link FrameInstance} supports only slow path access.
119 */ 131 */