1#ifndef INTERNAL_IMEMO_H
2#define INTERNAL_IMEMO_H
15#include "internal/gc.h"
23#define IMEMO_MASK 0x0f
26#define IMEMO_FL_USHIFT (FL_USHIFT + 4)
27#define IMEMO_FL_USER0 FL_USER4
28#define IMEMO_FL_USER1 FL_USER5
29#define IMEMO_FL_USER2 FL_USER6
30#define IMEMO_FL_USER3 FL_USER7
31#define IMEMO_FL_USER4 FL_USER8
32#define IMEMO_FL_USER5 FL_USER9
71#define THROW_DATA_CONSUMED IMEMO_FL_USER0
76#if SIZEOF_INT * 2 > SIZEOF_VALUE
120#define THROW_DATA_P(err) imemo_throw_data_p((VALUE)err)
121#define MEMO_CAST(m) ((struct MEMO *)(m))
122#define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
123#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
124#define NEW_MEMO_FOR(type, value) \
125 ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
126#define NEW_PARTIAL_MEMO_FOR(type, value, member) \
127 ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
128 rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
129 MEMO_FOR(type, value))
138static inline bool imemo_throw_data_p(
VALUE imemo);
140static inline VALUE rb_imemo_tmpbuf_auto_free_pointer(
void);
141static inline void *RB_IMEMO_TMPBUF_PTR(
VALUE v);
142static inline void *rb_imemo_tmpbuf_set_ptr(
VALUE v,
void *
ptr);
143static inline VALUE rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(
VALUE str);
144static inline void MEMO_V1_SET(
struct MEMO *m,
VALUE v);
145static inline void MEMO_V2_SET(
struct MEMO *m,
VALUE v);
147RUBY_SYMBOL_EXPORT_BEGIN
150#define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
155RUBY_SYMBOL_EXPORT_END
178#define IMEMO_TYPE_P(v, t) imemo_type_p((VALUE)v, t)
193rb_imemo_tmpbuf_auto_free_pointer(
void)
199RB_IMEMO_TMPBUF_PTR(
VALUE v)
206rb_imemo_tmpbuf_set_ptr(
VALUE v,
void *
ptr)
212rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(
VALUE str)
222 imemo = rb_imemo_tmpbuf_auto_free_pointer();
char str[HTML_ESCAPE_MAX_LEN+1]
#define RSTRING_LEN(string)
#define RSTRING_PTR(string)
void * ruby_xmalloc(size_t size)
Allocates a storage instance.
rb_imemo_tmpbuf_t * rb_imemo_tmpbuf_parser_heap(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt)
void rb_strterm_mark(VALUE obj)
const char * rb_imemo_name(enum imemo_type type)
@ imemo_ifunc
iterator function
@ imemo_cref
class reference
@ imemo_svar
special variable
struct vm_ifunc * rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int max_argc)
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
Thin wrapper to ruby/config.h.
#define UNLIMITED_ARGUMENTS
Internal header for Array.
rb_block_call_func * rb_block_call_func_t
VALUE type(ANYARGS)
ANYARGS-ed function type.
#define RB_OBJ_WRITE(a, slot, b)
WB for new reference from ‘a’ to ‘b’.
#define SafeStringValue(v)
rb_atomic_t cnt[RUBY_NSIG]
struct rb_imemo_tmpbuf_struct * next
IFUNC (Internal FUNCtion)
struct vm_ifunc_argc argc
rb_block_call_func_t func
const VALUE cref_or_me
class reference or rb_method_entry_t
const struct rb_control_frame_struct * catch_frame