Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
vm.h
Go to the documentation of this file.
1 #ifndef RBIMPL_INTERN_VM_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_INTERN_VM_H
26 #include "ruby/internal/value.h"
27 
29 
30 /* vm.c */
31 
32 
39 int rb_sourceline(void);
40 
49 const char *rb_sourcefile(void);
50 
62 int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
63 
64 /* vm_eval.c */
65 
77 VALUE rb_check_funcall(VALUE recv, ID mid, int argc, const VALUE *argv);
78 
96 VALUE rb_check_funcall_kw(VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat);
97 
112 VALUE rb_eval_cmd_kw(VALUE cmd, VALUE arg, int kw_splat);
113 
125 VALUE rb_apply(VALUE recv, ID mid, VALUE args);
126 
144 VALUE rb_obj_instance_eval(int argc, const VALUE *argv, VALUE recv);
145 
169 VALUE rb_obj_instance_exec(int argc, const VALUE *argv, VALUE recv);
170 
181 VALUE rb_mod_module_eval(int argc, const VALUE *argv, VALUE mod);
182 
193 VALUE rb_mod_module_exec(int argc, const VALUE *argv, VALUE mod);
194 
195 /* vm_method.c */
196 
204 #define HAVE_RB_DEFINE_ALLOC_FUNC 1
205 
216 typedef VALUE (*rb_alloc_func_t)(VALUE klass);
217 
226 
237 void rb_undef_alloc_func(VALUE klass);
238 
253 
260 
273 void rb_alias(VALUE klass, ID dst, ID src);
274 
293 void rb_attr(VALUE klass, ID name, int need_reader, int need_writer, int honour_visibility);
294 
307 void rb_remove_method(VALUE klass, const char *name);
308 
319 void rb_remove_method_id(VALUE klass, ID mid);
320 
338 int rb_method_boundp(VALUE klass, ID id, int ex);
339 
350 int rb_method_basic_definition_p(VALUE klass, ID mid);
351 
365 int rb_obj_respond_to(VALUE obj, ID mid, int private_p);
366 
376 int rb_respond_to(VALUE obj, ID mid);
377 
398 VALUE rb_f_notimplement(int argc, const VALUE *argv, VALUE obj, VALUE marker);
399 #if !defined(RUBY_EXPORT) && defined(_WIN32)
400 RUBY_EXTERN VALUE (*const rb_f_notimplement_)(int, const VALUE *, VALUE, VALUE marker);
401 #define rb_f_notimplement (*rb_f_notimplement_)
402 #endif
403 
404 /* vm_backtrace.c */
405 
414 void rb_backtrace(void);
415 
427 
429 
430 #endif /* RBIMPL_INTERN_VM_H */
Tweaking visibility of C variables/functions.
#define RUBY_EXTERN
Declaration of externally visible global variables.
Definition: dllexport.h:45
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:74
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:65
int rb_respond_to(VALUE obj, ID mid)
Queries if the object responds to the method.
Definition: vm_method.c:2960
VALUE(* rb_alloc_func_t)(VALUE klass)
This is the type of functions that ruby calls when trying to allocate an object.
Definition: vm.h:216
void rb_undef_alloc_func(VALUE klass)
Deletes the allocator function of a class.
Definition: vm_method.c:1291
void rb_alias(VALUE klass, ID dst, ID src)
Resembles alias.
Definition: vm_method.c:2289
int rb_method_basic_definition_p(VALUE klass, ID mid)
Well...
Definition: vm_method.c:2838
const char * rb_sourcefile(void)
Resembles __FILE__.
Definition: vm.c:1863
void rb_attr(VALUE klass, ID name, int need_reader, int need_writer, int honour_visibility)
This function resembles now-deprecated Module#attr.
Definition: vm_method.c:1869
void rb_remove_method(VALUE klass, const char *name)
Removes a method.
Definition: vm_method.c:1718
VALUE rb_check_funcall(VALUE recv, ID mid, int argc, const VALUE *argv)
Identical to rb_funcallv(), except it returns RUBY_Qundef instead of raising rb_eNoMethodError.
Definition: vm_eval.c:668
int rb_frame_method_id_and_class(ID *idp, VALUE *klassp)
Resembles __method__.
Definition: vm.c:2879
rb_alloc_func_t rb_get_alloc_func(VALUE klass)
Queries the allocator function of a class.
Definition: vm_method.c:1297
void rb_clear_constant_cache_for_id(ID id)
Clears the inline constant caches associated with a particular ID.
Definition: vm_method.c:140
VALUE rb_check_funcall_kw(VALUE recv, ID mid, int argc, const VALUE *argv, int kw_splat)
Identical to rb_check_funcall(), except you can specify how to handle the last element of the given a...
Definition: vm_eval.c:662
VALUE rb_mod_module_eval(int argc, const VALUE *argv, VALUE mod)
Identical to rb_obj_instance_eval(), except it evaluates within the context of module.
Definition: vm_eval.c:2284
void rb_remove_method_id(VALUE klass, ID mid)
Identical to rb_remove_method(), except it accepts the method name as ID.
Definition: vm_method.c:1712
VALUE rb_mod_module_exec(int argc, const VALUE *argv, VALUE mod)
Identical to rb_obj_instance_exec(), except it evaluates within the context of module.
Definition: vm_eval.c:2318
void rb_define_alloc_func(VALUE klass, rb_alloc_func_t func)
Sets the allocator function of a class.
VALUE rb_obj_instance_exec(int argc, const VALUE *argv, VALUE recv)
Executes the given block within the context of the receiver.
Definition: vm_eval.c:2245
VALUE rb_eval_cmd_kw(VALUE cmd, VALUE arg, int kw_splat)
This API is practically a variant of rb_proc_call_kw() now.
Definition: vm_eval.c:2040
VALUE rb_f_notimplement(int argc, const VALUE *argv, VALUE obj, VALUE marker)
Raises rb_eNotImpError.
Definition: vm_method.c:481
VALUE rb_apply(VALUE recv, ID mid, VALUE args)
Identical to rb_funcallv(), except it takes Ruby's array instead of C's.
Definition: vm_eval.c:1074
VALUE rb_make_backtrace(void)
Creates the good old fashioned array-of-strings style backtrace info.
int rb_method_boundp(VALUE klass, ID id, int ex)
Queries if the klass has this method.
Definition: vm_method.c:1830
void rb_backtrace(void)
Prints the backtrace out to the standard error.
VALUE rb_obj_instance_eval(int argc, const VALUE *argv, VALUE recv)
Evaluates a string containing Ruby source code, or the given block, within the context of the receive...
Definition: vm_eval.c:2215
int rb_sourceline(void)
Resembles __LINE__.
Definition: vm.c:1877
int rb_obj_respond_to(VALUE obj, ID mid, int private_p)
Identical to rb_respond_to(), except it additionally takes the visibility parameter.
Definition: vm_method.c:2944
RBIMPL_ATTR_NORETURN() void rb_eof_error(void)
Utility function to raise rb_eEOFError.
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition: nonnull.h:27
Defines RBIMPL_ATTR_NORETURN.
Defines VALUE and ID.
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition: value.h:52
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40