Class: RubyVM
Defined Under Namespace
Classes: Env, InstructionSequence
Constant Summary collapse
- OPTS =
RubyVM::OPTS, which shows vm build options
:
- INSTRUCTION_NAMES =
RubyVM::INSTRUCTION_NAMES
:
- DEFAULT_PARAMS =
RubyVM::DEFAULT_PARAMS This constant variable shows VM’s default parameters. Note that changing these values does not affect VM execution. Specification is not stable and you should not depend on this value. Of course, this constant is MRI specific.
:
Class Method Summary collapse
-
.NSDR ⇒ Object
:nodoc:.
-
.SDR ⇒ Object
:nodoc:.
-
.stat ⇒ Object
Returns a Hash containing implementation-dependent counters inside the VM.
- .USAGE_ANALYSIS_INSN_STOP ⇒ Object
- .USAGE_ANALYSIS_OPERAND_STOP ⇒ Object
- .USAGE_ANALYSIS_REGISTER_STOP ⇒ Object
Class Method Details
.NSDR ⇒ Object
:nodoc:
2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 |
# File 'vm.c', line 2328
static VALUE
nsdr(void)
{
VALUE ary = rb_ary_new();
#if HAVE_BACKTRACE
#include <execinfo.h>
#define MAX_NATIVE_TRACE 1024
static void *trace[MAX_NATIVE_TRACE];
int n = backtrace(trace, MAX_NATIVE_TRACE);
char **syms = backtrace_symbols(trace, n);
int i;
if (syms == 0) {
rb_memerror();
}
for (i=0; i<n; i++) {
rb_ary_push(ary, rb_str_new2(syms[i]));
}
free(syms); /* OK */
#endif
return ary;
}
|
.SDR ⇒ Object
:nodoc:
2320 2321 2322 2323 2324 2325 |
# File 'vm.c', line 2320
static VALUE
sdr(void)
{
rb_vm_bugreport();
return Qnil;
}
|
.stat ⇒ Hash .stat(hsh) ⇒ Hash .stat(Symbol) ⇒ Numeric
Returns a Hash containing implementation-dependent counters inside the VM.
This hash includes information about method/constant cache serials:
{
:global_method_state=>251,
:global_constant_state=>481,
:class_serial=>9029
}
The contents of the hash are implementation specific and may be changed in the future.
This method is only expected to work on C Ruby.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'vm.c', line 138
static VALUE
vm_stat(int argc, VALUE *argv, VALUE self)
{
static VALUE sym_global_method_state, sym_global_constant_state, sym_class_serial;
VALUE arg = Qnil;
VALUE hash = Qnil, key = Qnil;
if (rb_scan_args(argc, argv, "01", &arg) == 1) {
if (SYMBOL_P(arg))
key = arg;
else if (RB_TYPE_P(arg, T_HASH))
hash = arg;
else
rb_raise(rb_eTypeError, "non-hash or symbol given");
} else if (arg == Qnil) {
hash = rb_hash_new();
}
if (sym_global_method_state == 0) {
#define S(s) sym_##s = ID2SYM(rb_intern_const(#s))
S(global_method_state);
S(global_constant_state);
S(class_serial);
#undef S
}
#define SET(name, attr) \
if (key == sym_##name) \
return SERIALT2NUM(attr); \
else if (hash != Qnil) \
rb_hash_aset(hash, sym_##name, SERIALT2NUM(attr));
SET(global_method_state, ruby_vm_global_method_state);
SET(global_constant_state, ruby_vm_global_constant_state);
SET(class_serial, ruby_vm_class_serial);
#undef SET
if (key != Qnil) /* matched key should return above */
rb_raise(rb_eArgError, "unknown key: %s", RSTRING_PTR(rb_id2str(SYM2ID(key))));
return hash;
}
|
.USAGE_ANALYSIS_INSN_STOP ⇒ Object
2353 |
# File 'vm.c', line 2353 static VALUE usage_analysis_insn_stop(VALUE self); |
.USAGE_ANALYSIS_OPERAND_STOP ⇒ Object
2354 |
# File 'vm.c', line 2354 static VALUE usage_analysis_operand_stop(VALUE self); |
.USAGE_ANALYSIS_REGISTER_STOP ⇒ Object
2355 |
# File 'vm.c', line 2355 static VALUE usage_analysis_register_stop(VALUE self); |