MasonProtter / Bumper.jl

Bring Your Own Stack
MIT License
152 stars 6 forks source link

@alloc detection too narrow #23

Open annuges opened 9 months ago

annuges commented 9 months ago

In the switchover from 0.3 to 0.4 when replacing the function based alloc with the macro based version I always got the error that the @alloc is not within a @no_escape block even though it obviously was.

turns out the problem was my usage as Bumper.@alloc instead of just @alloc. From what I can see from a quick glance over the code the replacement code is looking explicitly for an @alloc. Perhaps this could bei widened?

MasonProtter commented 9 months ago

Ah interesting. So the trick here is that @alloc is not really its own macro. It's really just a special marker meant to be seen and handled by @no_escape. So I guess what I'd say is that you shouldn't really be typing Bumper.@alloc but only ever use @alloc directly..

I'll give some thought as to whether there's a clean way I can throw a better error here or something.