Skip to content

Commit

Permalink
Fix access to ematch buffer elements
Browse files Browse the repository at this point in the history
  • Loading branch information
gkronber committed Sep 10, 2024
1 parent cd064e6 commit f8d82eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@ function buffer_readable(g, limit, ematch_buffer)
k = length(ematch_buffer)

while k > limit
delimiter = ematch_buffer[k]
delimiter = ematch_buffer.v[k]
@assert delimiter == 0xffffffffffffffffffffffffffffffff
n = k - 1

next_delimiter_idx = 0
n_elems = 0
for i in n:-1:1
n_elems += 1
if ematch_buffer[i] == 0xffffffffffffffffffffffffffffffff
if ematch_buffer.v[i] == 0xffffffffffffffffffffffffffffffff
n_elems -= 1
next_delimiter_idx = i
break
end
end

match_info = ematch_buffer[next_delimiter_idx + 1]
match_info = ematch_buffer.v[next_delimiter_idx + 1]
id = v_pair_first(match_info)
rule_idx = reinterpret(Int, v_pair_last(match_info))
rule_idx = abs(rule_idx)

bindings = @view ematch_buffer[(next_delimiter_idx + 2):n]
bindings = @view ematch_buffer.v[(next_delimiter_idx + 2):n]

print("$id E-Classes: ", map(x -> reinterpret(Int, v_pair_first(x)), bindings))
print(" Nodes: ", map(x -> reinterpret(Int, v_pair_last(x)), bindings), "\n")
Expand Down

1 comment on commit f8d82eb

@gkronber
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not test this (only used for debugging).
The v_pair_last seem to be always zero.

Please sign in to comment.