rb-sys icon indicating copy to clipboard operation
rb-sys copied to clipboard

Implement new `StableApiDefinition` VM control methods

Open ianks opened this issue 1 year ago • 1 comments

In order to support Truffleruby on magnus, we need to support VM control operations, which currently relies on cruby internals.

/// Causes the interpreter to abort with a message. This function never
/// returns (akin to `rb_bug`).
///
/// **Important**: This function is an absolute last resort. It should
/// only be used if all else fails.
fn vm_panic(&self, message: &CStr) -> !;

/// Issues a warning using Ruby's `warn` function (akin to `rb_warning`).
fn vm_warning(msg: &CStr);

ianks avatar Nov 21 '24 02:11 ianks

rb_bug/rb_warn/rb_warning are all implemented on TruffleRuby (as static inline functions) so this should be straightforward. What is used currently for CRuby? I'd imagine it's the same functions so ideally it'd work the same for both.

If the static inline functions are a problem and you need non-static functions, there might be a solution on truffleruby's side, mentioned at the end of https://github.com/oracle/truffleruby/issues/3396#issuecomment-2580778963

eregon avatar May 07 '25 10:05 eregon