@@ -137,58 +137,56 @@ static bool do_pl_match(query *q, unsigned from_chan, cell *p1, pl_idx p1_ctx)
137137{
138138 pl_thread * t = & g_pl_threads [q -> pl -> my_chan ];
139139
140- LOOP :
140+ while (true) {
141+ uint64_t cnt = 0 ;
141142
142- uint64_t cnt = 0 ;
143-
144- while (!t -> head ) {
145- suspend_thread (t , cnt < 1000 ? 0 : cnt < 10000 ? 1 : cnt < 100000 ? 10 : 100 );
146- cnt ++ ;
147- }
143+ while (!t -> head ) {
144+ suspend_thread (t , cnt < 1000 ? 0 : cnt < 10000 ? 1 : cnt < 100000 ? 10 : 100 );
145+ cnt ++ ;
146+ }
148147
149- //printf("*** recv msg nbr_cells=%u\n", t->head->nbr_cells);
148+ //printf("*** recv msg nbr_cells=%u\n", t->head->nbr_cells);
150149
151- try_me (q , MAX_ARITY );
152- acquire_lock (& t -> guard );
153- msg * m = t -> head ;
150+ try_me (q , MAX_ARITY );
151+ acquire_lock (& t -> guard );
152+ msg * m = t -> head ;
154153
155- while (m ) {
156- cell * c = m -> c ;
154+ while (m ) {
155+ cell * c = m -> c ;
157156
158- for (unsigned i = 0 ; i < c -> nbr_cells ; i ++ ) {
159- if (is_ref (& c [i ])) {
160- c [i ].flags &= ~FLAG_VAR_REF ;
157+ for (unsigned i = 0 ; i < c -> nbr_cells ; i ++ ) {
158+ if (is_ref (& c [i ])) {
159+ c [i ].flags &= ~FLAG_VAR_REF ;
160+ }
161161 }
162- }
163162
164- cell * tmp = deep_copy_to_heap (q , c , q -> st .fp , false);
165- check_heap_error (tmp , release_lock (& t -> guard ));
166- unshare_cells (c , c -> nbr_cells );
163+ cell * tmp = deep_copy_to_heap (q , c , q -> st .fp , false);
164+ check_heap_error (tmp , release_lock (& t -> guard ));
165+ unshare_cells (c , c -> nbr_cells );
167166
168- if (unify (q , p1 , p1_ctx , tmp , q -> st .curr_frame )) {
169- q -> curr_chan = m -> from_chan ;
167+ if (unify (q , p1 , p1_ctx , tmp , q -> st .curr_frame )) {
168+ q -> curr_chan = m -> from_chan ;
170169
171- if (m -> prev )
172- m -> prev -> next = m -> next ;
170+ if (m -> prev )
171+ m -> prev -> next = m -> next ;
173172
174- if (m -> next )
175- m -> next -> prev = m -> prev ;
173+ if (m -> next )
174+ m -> next -> prev = m -> prev ;
176175
177- if (t -> head == m )
178- t -> head = m -> next ;
176+ if (t -> head == m )
177+ t -> head = m -> next ;
179178
180- if (t -> tail == m )
181- t -> tail = m -> next ;
179+ if (t -> tail == m )
180+ t -> tail = m -> next ;
182181
183- free (m );
184- return true;
185- }
182+ free (m );
183+ return true;
184+ }
186185
187- undo_me (q );
188- m = m -> next ;
186+ undo_me (q );
187+ m = m -> next ;
188+ }
189189 }
190-
191- goto LOOP ;
192190}
193191
194192static bool bif_pl_match_2 (query * q )
0 commit comments