@@ -33,13 +33,11 @@ type thread struct {
3333 sourcePath string
3434
3535 // LLB state for the evaluate call.
36- def * llb.Definition
37- ops map [digest.Digest ]* pb.Op
38- head digest.Digest
39- bps map [digest.Digest ]int
40-
41- frames map [int32 ]* frame
42- framesByDigest map [digest.Digest ]* frame
36+ def * llb.Definition
37+ ops map [digest.Digest ]* pb.Op
38+ head digest.Digest
39+ bps map [digest.Digest ]int
40+ frames map [int32 ]* frame
4341
4442 // Runtime state for the evaluate call.
4543 entrypoint * step
@@ -141,14 +139,13 @@ type step struct {
141139}
142140
143141func (t * thread ) createProgram () error {
144- t .framesByDigest = make (map [digest.Digest ]* frame )
145142 t .frames = make (map [int32 ]* frame )
146143
147144 // Create the entrypoint by using the last node.
148145 // We will build on top of that.
149146 head := & step {
150147 dgst : t .head ,
151- frame : t .getStackFrame (t .head ),
148+ frame : t .getStackFrame (t .head , nil ),
152149 }
153150 t .entrypoint = t .createBranch (head )
154151 return nil
@@ -166,7 +163,7 @@ func (t *thread) createBranch(last *step) (first *step) {
166163 // exit point always matches the one set on first
167164 out : first .out ,
168165 // always set to the same as next which is always first
169- frame : t .getStackFrame (first .dgst ),
166+ frame : t .getStackFrame (first .dgst , first ),
170167 }
171168
172169 op := t .ops [first .dgst ]
@@ -195,7 +192,7 @@ func (t *thread) createBranch(last *step) (first *step) {
195192 in : exit ,
196193 next : exit ,
197194 out : exit ,
198- frame : t .getStackFrame (digest .Digest (inp .Digest )),
195+ frame : t .getStackFrame (digest .Digest (inp .Digest ), nil ),
199196 }
200197 prev .in = t .createBranch (head )
201198 }
@@ -213,11 +210,7 @@ func (t *thread) createBranch(last *step) (first *step) {
213210 return first
214211}
215212
216- func (t * thread ) getStackFrame (dgst digest.Digest ) * frame {
217- if f := t .framesByDigest [dgst ]; f != nil {
218- return f
219- }
220-
213+ func (t * thread ) getStackFrame (dgst digest.Digest , next * step ) * frame {
221214 f := & frame {
222215 op : t .ops [dgst ],
223216 }
@@ -226,7 +219,7 @@ func (t *thread) getStackFrame(dgst digest.Digest) *frame {
226219 f .setNameFromMeta (meta )
227220 }
228221 if loc , ok := t .def .Source .Locations [string (dgst )]; ok {
229- f .fillLocation (t .def , loc , t .sourcePath )
222+ f .fillLocation (t .def , loc , t .sourcePath , next )
230223 }
231224 t .frames [int32 (f .Id )] = f
232225 return f
0 commit comments