labath added a comment.

In D91508#2412510 <https://reviews.llvm.org/D91508#2412510>, @tammela wrote:

>> I'm not sure what you mean by that. Can you elaborate?
>
> Sure, it's was just a nod to your previous comment about that running 
> callbacks (C++ lambdas) inside a `pcall` is a dangerous API. Although 
> possible, it requires that the developer be very cautious about implicit 
> throws.

Right. That's why I'd like to have good wrappers, which make it easy to do the 
right thing, and hard to do the wrong one.

I don't think we're quite there yet, but before I comment on the API, I want to 
understand one other thing.

I am puzzled by all the wrapping that's happening inside the `PushSBClass` 
functions. What is that protecting us from? I would hope that pushing a swig 
wrapper on the stack is a safe operation...

> The Lua implementation guarantees at least 20 stack slots when the 
> `lua_State` is created so I've added the stack checks for sanity rather than 
> necessity.

So, IIUC, this can only fail if we are running out of memory? If that's the 
case, then I would remove these checks, as (for better or worse) llvm is not 
robust against memory allocation errors, and they add a fair amount of cruft to 
the code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91508/new/

https://reviews.llvm.org/D91508

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to