Cannot drop a lock in `throw_exception_internal`
In my latest commit, I have modified the structure of the exception table (so that it dosn't use unsafe pointers, and in order to fix Issue #53 (closed) ).
In throw_exception_internal
I acquire a read lock the compiled_callsite_table
, we wan't this lock to be realesed before calling exception_restore
, however the borrow checker won't let me:
error[E0505]: cannot move out of `compiled_callsite_table` because it is borrowed
--> src/runtime/exception.rs:89:18
|
65 | let table_entry = compiled_callsite_table.get(&callsite);
| ----------------------- borrow of `compiled_callsite_table` occurs here
...
89 | drop(compiled_callsite_table); // drop the lock first
| ^^^^^^^^^^^^^^^^^^^^^^^ move out of `compiled_callsite_table` occurs here
So I have commented out line 89, and things seam to work.
The function exception_restore
is marked as non-returning, so perhaps the rust compiler is smart enough to do the drop for us, if it isn't, we will get a deadlock if someone tries to acquire a write lock once an exception has been thrown (however currently we only modify the table once at startup, before any exceptions are thrown, so this won't occur).