mruby 3.3.0
mruby is the lightweight implementation of the Ruby language
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
irep.h File Reference

More...

#include "common.h"
#include <mruby/compile.h>
Include dependency graph for irep.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mrb_pool_value
 
struct  mrb_irep_catch_handler
 
struct  mrb_irep
 
struct  mrb_insn_data
 

Macros

#define IREP_TT_NFLAG   1 /* number (non string) flag */
 
#define IREP_TT_SFLAG   2 /* static string flag */
 
#define MRB_ISEQ_NO_FREE   1
 
#define MRB_IREP_NO_FREE   2
 
#define MRB_IREP_STATIC   (MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE)
 
#define mrb_irep_catch_handler_pack(n, v)   uint32_to_bin(n, v)
 
#define mrb_irep_catch_handler_unpack(v)   bin_to_uint32(v)
 

Typedefs

typedef struct mrb_pool_value mrb_pool_value
 

Enumerations

enum  irep_pool_type {
  IREP_TT_STR = 0 , IREP_TT_SSTR = 2 , IREP_TT_INT32 = 1 , IREP_TT_INT64 = 3 ,
  IREP_TT_BIGINT = 7 , IREP_TT_FLOAT = 5
}
 Compiled mruby scripts.
 
enum  mrb_catch_type { MRB_CATCH_RESCUE = 0 , MRB_CATCH_ENSURE = 1 }
 

Functions

mrb_irepmrb_add_irep (mrb_state *mrb)
 
mrb_value mrb_load_irep (mrb_state *, const uint8_t *)
 load mruby bytecode functions Please note! Currently due to interactions with the GC calling these functions will leak one RProc object per function call.
 
mrb_value mrb_load_irep_buf (mrb_state *, const void *, size_t)
 
mrb_value mrb_load_irep_cxt (mrb_state *, const uint8_t *, mrb_ccontext *)
 
mrb_value mrb_load_irep_buf_cxt (mrb_state *, const void *, size_t, mrb_ccontext *)
 
void mrb_irep_incref (mrb_state *, struct mrb_irep *)
 
void mrb_irep_decref (mrb_state *, struct mrb_irep *)
 
void mrb_irep_cutref (mrb_state *, struct mrb_irep *)
 

Detailed Description

See Copyright Notice in mruby.h

Function Documentation

◆ mrb_load_irep()

mrb_value mrb_load_irep ( mrb_state mrb,
const uint8_t *  bin 
)

load mruby bytecode functions Please note! Currently due to interactions with the GC calling these functions will leak one RProc object per function call.

To prevent this save the current memory arena before calling and restore the arena right after, like so int ai = mrb_gc_arena_save(mrb); mrb_value status = mrb_load_irep(mrb, buffer); mrb_gc_arena_restore(mrb, ai);