kuznia-rdzeni / coreblocks

RISC-V out-of-order core for education and research purposes
https://kuznia-rdzeni.github.io/coreblocks/
BSD 3-Clause "New" or "Revised" License
37 stars 15 forks source link

Exclusive branches in diamond call graphs #567

Open tilk opened 9 months ago

tilk commented 9 months ago

Suppose we have a code like this:

@def_method(m, method1):
def _():
    method3(m)

@def_method(m, method2):
def _():
    method3(m)

with Transaction().body(m):
    with m.If(foo):
        method1(m)
    with m.Else():
        method2(m)

Currently, an exception "Method 'method3' can't be called twice from the same transaction" will be raised. But these calls are on syntactically different branches, so they could technically be allowed.

tilk commented 9 months ago

This will require a small redesign of the Transactron core. Currently, method calls are analyzed on direct caller level (methods and transactions which directly call a given method). To solve this issue, they need to by analyzed at transaction level (transitive calls through multiple methods).