Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement mrb_raise with panic #35

Open
lopopolo opened this issue Jul 8, 2019 · 6 comments · May be fixed by #1904
Open

Implement mrb_raise with panic #35

lopopolo opened this issue Jul 8, 2019 · 6 comments · May be fixed by #1904
Labels
A-C-API Area: C APIs for compatibility with existing interpreters. A-vm Area: Interpreter VM implementations. B-mruby Backend: Implementation of artichoke-core using mruby. CAPI-mruby C API: mruby MRB_API-compatible C API. S-blocked Status: Marked as blocked ❌ on something else such as other implementation work.

Comments

@lopopolo
Copy link
Member

lopopolo commented Jul 8, 2019

The gymnastics and sad times in artichoke/ferrocarril#168 become unnecessary if we have a memory safe unwind. panic is exactly that.

Implement mrb_raise, mrb_raisef and mrb_protect in Rust in mrb-sys exported to C so libmruby can use them.

@lopopolo
Copy link
Member Author

lopopolo commented Jul 8, 2019

This will allow removing the dependency on mruby-error mrbgem.

Eval and Funcall would implement "catch" with panic::catch_unwind.

@lopopolo
Copy link
Member Author

lopopolo commented Jul 8, 2019

Add the test for the TODO in artichoke/ferrocarril#168.

Psuedo code, called in a loop 100 times. This is expected to leak 100MB.

unsafe extern "C" throws(mrb, slf) {
    let interp = unwrap_interpreter(mrb);
    let s = Box::new(std::iter::repeat("a").take(1024 * 1024).collect::<String>());
    RuntimeError::raise(interp, "oh no")
}

@lopopolo lopopolo transferred this issue from artichoke/ferrocarril Jul 28, 2019
@lopopolo lopopolo added this to the VM milestone Jul 28, 2019
@lopopolo lopopolo added Backend: mruby CAPI-mruby C API: mruby MRB_API-compatible C API. labels Aug 4, 2019
@lopopolo
Copy link
Member Author

lopopolo commented Aug 5, 2019

This is currently blocked on rust-lang/rfcs#2699.

@lopopolo lopopolo added S-blocked Status: Marked as blocked ❌ on something else such as other implementation work. A-vm Area: Interpreter VM implementations. A-C-API Area: C APIs for compatibility with existing interpreters. labels Aug 5, 2019
@lopopolo lopopolo removed this from the VM milestone Aug 6, 2019
@github-actions github-actions bot removed the B-mruby label Aug 8, 2020
@lopopolo lopopolo added the B-mruby Backend: Implementation of artichoke-core using mruby. label Aug 8, 2020
@lopopolo
Copy link
Member Author

The linked RFC resulted in unwind ABIs: https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html

Upstream tracking issue: rust-lang/rust#74990

@lopopolo
Copy link
Member Author

The C-unwind ABI has been implemented and is currently on nightly: rust-lang/rust#76570.

@lopopolo
Copy link
Member Author

this is happening! rust-lang/rfcs#2945 (comment)

lopopolo added a commit that referenced this issue Jun 12, 2022
The Rust team has put out a call for testing on the `c_unwind` feature
and associated `C-unwind` ABI:

- rust-lang/rfcs#2945 (comment)

I intend to implement mruby's exception unwinding using Rust's panic
infrastructure:

- #35

This commit changes the Rust toolchain to nightly for this test. Merging
this experiment will be blocked on the `C-unwind` ABI making it to
stable.
lopopolo added a commit that referenced this issue Jun 12, 2022
`mruby-error` implements `mrb_protect` and `mrb_ensure`. These two
functions are used to stop the propagation of exception unwinding in
mruby, which natively uses either `setjmp`/`longjmp` or C++'s `catch`
and `throw`.

I intend to reimplement these functions in Rust using Rust panics:
`std::panic::catch_unwind` and `std::panic::panic_any`.

See:

- #35
@lopopolo lopopolo linked a pull request Jun 12, 2022 that will close this issue
lopopolo added a commit that referenced this issue Jun 28, 2022
The Rust team has put out a call for testing on the `c_unwind` feature
and associated `C-unwind` ABI:

- rust-lang/rfcs#2945 (comment)

I intend to implement mruby's exception unwinding using Rust's panic
infrastructure:

- #35

This commit changes the Rust toolchain to nightly for this test. Merging
this experiment will be blocked on the `C-unwind` ABI making it to
stable.
lopopolo added a commit that referenced this issue Jun 28, 2022
`mruby-error` implements `mrb_protect` and `mrb_ensure`. These two
functions are used to stop the propagation of exception unwinding in
mruby, which natively uses either `setjmp`/`longjmp` or C++'s `catch`
and `throw`.

I intend to reimplement these functions in Rust using Rust panics:
`std::panic::catch_unwind` and `std::panic::panic_any`.

See:

- #35
lopopolo added a commit that referenced this issue Jul 24, 2022
The Rust team has put out a call for testing on the `c_unwind` feature
and associated `C-unwind` ABI:

- rust-lang/rfcs#2945 (comment)

I intend to implement mruby's exception unwinding using Rust's panic
infrastructure:

- #35

This commit changes the Rust toolchain to nightly for this test. Merging
this experiment will be blocked on the `C-unwind` ABI making it to
stable.
lopopolo added a commit that referenced this issue Jul 24, 2022
`mruby-error` implements `mrb_protect` and `mrb_ensure`. These two
functions are used to stop the propagation of exception unwinding in
mruby, which natively uses either `setjmp`/`longjmp` or C++'s `catch`
and `throw`.

I intend to reimplement these functions in Rust using Rust panics:
`std::panic::catch_unwind` and `std::panic::panic_any`.

See:

- #35
lopopolo added a commit that referenced this issue Jul 24, 2022
The Rust team has put out a call for testing on the `c_unwind` feature
and associated `C-unwind` ABI:

- rust-lang/rfcs#2945 (comment)

I intend to implement mruby's exception unwinding using Rust's panic
infrastructure:

- #35

This commit changes the Rust toolchain to nightly for this test. Merging
this experiment will be blocked on the `C-unwind` ABI making it to
stable.
lopopolo added a commit that referenced this issue Jul 24, 2022
`mruby-error` implements `mrb_protect` and `mrb_ensure`. These two
functions are used to stop the propagation of exception unwinding in
mruby, which natively uses either `setjmp`/`longjmp` or C++'s `catch`
and `throw`.

I intend to reimplement these functions in Rust using Rust panics:
`std::panic::catch_unwind` and `std::panic::panic_any`.

See:

- #35
lopopolo added a commit that referenced this issue Oct 24, 2022
The Rust team has put out a call for testing on the `c_unwind` feature
and associated `C-unwind` ABI:

- rust-lang/rfcs#2945 (comment)

I intend to implement mruby's exception unwinding using Rust's panic
infrastructure:

- #35

This commit changes the Rust toolchain to nightly for this test. Merging
this experiment will be blocked on the `C-unwind` ABI making it to
stable.
lopopolo added a commit that referenced this issue Oct 24, 2022
`mruby-error` implements `mrb_protect` and `mrb_ensure`. These two
functions are used to stop the propagation of exception unwinding in
mruby, which natively uses either `setjmp`/`longjmp` or C++'s `catch`
and `throw`.

I intend to reimplement these functions in Rust using Rust panics:
`std::panic::catch_unwind` and `std::panic::panic_any`.

See:

- #35
lopopolo added a commit that referenced this issue Nov 8, 2022
The Rust team has put out a call for testing on the `c_unwind` feature
and associated `C-unwind` ABI:

- rust-lang/rfcs#2945 (comment)

I intend to implement mruby's exception unwinding using Rust's panic
infrastructure:

- #35

This commit changes the Rust toolchain to nightly for this test. Merging
this experiment will be blocked on the `C-unwind` ABI making it to
stable.
lopopolo added a commit that referenced this issue Nov 8, 2022
`mruby-error` implements `mrb_protect` and `mrb_ensure`. These two
functions are used to stop the propagation of exception unwinding in
mruby, which natively uses either `setjmp`/`longjmp` or C++'s `catch`
and `throw`.

I intend to reimplement these functions in Rust using Rust panics:
`std::panic::catch_unwind` and `std::panic::panic_any`.

See:

- #35
lopopolo added a commit that referenced this issue Nov 8, 2022
The Rust team has put out a call for testing on the `c_unwind` feature
and associated `C-unwind` ABI:

- rust-lang/rfcs#2945 (comment)

I intend to implement mruby's exception unwinding using Rust's panic
infrastructure:

- #35

This commit changes the Rust toolchain to nightly for this test. Merging
this experiment will be blocked on the `C-unwind` ABI making it to
stable.
lopopolo added a commit that referenced this issue Nov 8, 2022
`mruby-error` implements `mrb_protect` and `mrb_ensure`. These two
functions are used to stop the propagation of exception unwinding in
mruby, which natively uses either `setjmp`/`longjmp` or C++'s `catch`
and `throw`.

I intend to reimplement these functions in Rust using Rust panics:
`std::panic::catch_unwind` and `std::panic::panic_any`.

See:

- #35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-C-API Area: C APIs for compatibility with existing interpreters. A-vm Area: Interpreter VM implementations. B-mruby Backend: Implementation of artichoke-core using mruby. CAPI-mruby C API: mruby MRB_API-compatible C API. S-blocked Status: Marked as blocked ❌ on something else such as other implementation work.
Development

Successfully merging a pull request may close this issue.

1 participant