Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/guides/mrbconf.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,6 @@ largest value of required alignment.
- Make it available `Symbol.all_symbols` in `mrbgems/mruby-symbol-ext`
- Increase heap memory usage.

`MRB_NO_DIRECT_THREADING`
`MRB_USE_VM_SWITCH_DISPATCH`

- Turn off direct threading optimization in VM loop
- Turn on switch dispatch in VM loop
4 changes: 2 additions & 2 deletions include/mrbconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@
#if defined(DISABLE_STDIO) || defined(MRB_DISABLE_STDIO)
# define MRB_NO_STDIO
#endif
#ifdef MRB_DISABLE_DIRECT_THREADING
# define MRB_NO_DIRECT_THREADING
#if defined(MRB_DISABLE_DIRECT_THREADING) || defined(MRB_NO_DIRECT_THREADING)
# define MRB_USE_VM_SWITCH_DISPATCH
#endif
#if defined(ENABLE_DEBUG) || defined(MRB_ENABLE_DEBUG_HOOK)
# define MRB_USE_DEBUG_HOOK
Expand Down
12 changes: 6 additions & 6 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,13 +1251,13 @@ prepare_tagged_break(mrb_state *mrb, uint32_t tag, const struct RProc *proc, mrb
#define BYTECODE_DECODER(x) (x)
#endif

#ifndef MRB_NO_DIRECT_THREADING
#if defined __GNUC__ || defined __clang__ || defined __INTEL_COMPILER
#define DIRECT_THREADED
#ifndef MRB_USE_VM_SWITCH_DISPATCH
#if !defined __GNUC__ && !defined __clang__ && !defined __INTEL_COMPILER
#define MRB_USE_VM_SWITCH_DISPATCH
#endif
#endif /* ifndef MRB_NO_DIRECT_THREADING */
#endif /* ifndef MRB_USE_VM_SWITCH_DISPATCH */

#ifndef DIRECT_THREADED
#ifdef MRB_USE_VM_SWITCH_DISPATCH

#define INIT_DISPATCH for (;;) { insn = BYTECODE_DECODER(*pc); CODE_FETCH_HOOK(mrb, irep, pc, regs); switch (insn) {
#define CASE(insn,ops) case insn: pc++; FETCH_ ## ops (); mrb->c->ci->pc = pc; L_ ## insn ## _BODY:
Expand Down Expand Up @@ -1364,7 +1364,7 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc)
mrb_sym mid;
const struct mrb_irep_catch_handler *ch;

#ifdef DIRECT_THREADED
#ifndef MRB_USE_VM_SWITCH_DISPATCH
static const void * const optable[] = {
#define OPCODE(x,_) &&L_OP_ ## x,
#include "mruby/ops.h"
Expand Down