Ruby: internal/imemo.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Typedefs | Enumerations | Functions
imemo.h File Reference

IMEMO: Internal memo object. More...

`#include "ruby/internal/config.h"`
`#include <stddef.h>`
`#include "internal/array.h"`
`#include "internal/gc.h"`
`#include "ruby/internal/stdbool.h"`
`#include "ruby/ruby.h"`

Go to the source code of this file.

## Data Structures
struct | vm_svar
| SVAR (Special VARiable) More...
struct | vm_throw_data
| THROW_DATA. More...
struct | vm_ifunc_argc
struct | vm_ifunc
| IFUNC (Internal FUNCtion) More...
struct | rb_imemo_tmpbuf_struct
struct | MEMO
| MEMO. More...

## Macros
#define | IMEMO_DEBUG 0
#define | IMEMO_MASK 0x0f
#define | IMEMO_FL_USHIFT (FL_USHIFT + 4)
#define | IMEMO_FL_USER0 FL_USER4
#define | IMEMO_FL_USER1 FL_USER5
#define | IMEMO_FL_USER2 FL_USER6
#define | IMEMO_FL_USER3 FL_USER7
#define | IMEMO_FL_USER4 FL_USER8
#define | IMEMO_FL_USER5 FL_USER9
#define | THROW_DATA_CONSUMED IMEMO_FL_USER0
#define | THROW_DATA_P(err) imemo_throw_data_p((VALUE)err)
#define | MEMO_CAST(m) ((struct MEMO *)(m))
#define | MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
#define | MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
#define | NEW_MEMO_FOR(type, value) ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
#define | NEW_PARTIAL_MEMO_FOR(type, value, member)
#define | IMEMO_TYPE_P(v, t) imemo_type_p((VALUE)v, t)

## Typedefs
typedef struct rb_imemo_tmpbuf_struct | rb_imemo_tmpbuf_t

## Enumerations
enum | imemo_type { imemo_env = 0 , imemo_cref = 1 , imemo_svar = 2 , imemo_throw_data = 3 , imemo_ifunc = 4 , imemo_memo = 5 , imemo_ment = 6 , imemo_iseq = 7 , imemo_tmpbuf = 8 , imemo_ast = 9 , imemo_parser_strterm = 10 , imemo_callinfo = 11 , imemo_callcache = 12 , imemo_constcache = 13 }

## Functions
VALUE | rb_imemo_new (enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
rb_imemo_tmpbuf_t * | rb_imemo_tmpbuf_parser_heap (void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt)
struct vm_ifunc * | rb_vm_ifunc_new (rb_block_call_func_t func, const void *data, int min_argc, int max_argc)
void | rb_strterm_mark (VALUE obj)
const char * | rb_imemo_name (enum imemo_type type)

## Detailed Description

IMEMO: Internal memo object.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Definition in file imemo.h.

## Macro Definition Documentation

## ◆ IMEMO_DEBUG

#define IMEMO_DEBUG 0

Definition at line 20 of file imemo.h.

## ◆ IMEMO_FL_USER0

#define IMEMO_FL_USER0 FL_USER4

Definition at line 27 of file imemo.h.

## ◆ IMEMO_FL_USER1

#define IMEMO_FL_USER1 FL_USER5

Definition at line 28 of file imemo.h.

## ◆ IMEMO_FL_USER2

#define IMEMO_FL_USER2 FL_USER6

Definition at line 29 of file imemo.h.

## ◆ IMEMO_FL_USER3

#define IMEMO_FL_USER3 FL_USER7

Definition at line 30 of file imemo.h.

## ◆ IMEMO_FL_USER4

#define IMEMO_FL_USER4 FL_USER8

Definition at line 31 of file imemo.h.

## ◆ IMEMO_FL_USER5

#define IMEMO_FL_USER5 FL_USER9

Definition at line 32 of file imemo.h.

## ◆ IMEMO_FL_USHIFT

#define IMEMO_FL_USHIFT (FL_USHIFT + 4)

Definition at line 26 of file imemo.h.

## ◆ IMEMO_MASK

#define IMEMO_MASK 0x0f

Definition at line 23 of file imemo.h.

## ◆ IMEMO_TYPE_P

#define IMEMO_TYPE_P | ( |  | v,
|  |  | t
| ) |  | imemo_type_p((VALUE)v, t)

Definition at line 178 of file imemo.h.

## ◆ MEMO_CAST

#define MEMO_CAST | ( |  | m | ) | ((struct MEMO *)(m))

Definition at line 121 of file imemo.h.

## ◆ MEMO_FOR

#define MEMO_FOR | ( |  | type,
|  |  | value
| ) |  | ((type *)RARRAY_PTR(value))

Definition at line 123 of file imemo.h.

## ◆ MEMO_NEW

#define MEMO_NEW | ( |  | a,
|  |  | b,
|  |  | c
| ) |  | ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))

Definition at line 122 of file imemo.h.

## ◆ NEW_MEMO_FOR

#define NEW_MEMO_FOR | ( |  | type,
|  |  | value
| ) |  | ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))

Definition at line 124 of file imemo.h.

## ◆ NEW_PARTIAL_MEMO_FOR

#define NEW_PARTIAL_MEMO_FOR | ( |  | type,
|  |  | value,
|  |  | member
| ) |  |

Value:
((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
MEMO_FOR(type, value))
offsetof
#define offsetof(p_type, field)
Definition: addrinfo.h:186
rb_ary_tmp_new_fill
VALUE rb_ary_tmp_new_fill(long capa)
Definition: array.c:854
rb_ary_set_len
void rb_ary_set_len(VALUE ary, long len)
Definition: array.c:2212
type_roomof
#define type_roomof(x, y)
Definition: internal.h:24
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:56
VALUE
unsigned long VALUE
Definition: value.h:38

Definition at line 126 of file imemo.h.

## ◆ THROW_DATA_CONSUMED

#define THROW_DATA_CONSUMED IMEMO_FL_USER0

Definition at line 71 of file imemo.h.

## ◆ THROW_DATA_P

#define THROW_DATA_P | ( |  | err | ) | imemo_throw_data_p((VALUE)err)

Definition at line 120 of file imemo.h.

## Typedef Documentation

## ◆ rb_imemo_tmpbuf_t

typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t

Definition at line 131 of file imemo.h.

## Enumeration Type Documentation

## ◆ imemo_type

enum imemo_type

Enumerator
imemo_env |
imemo_cref | class reference
imemo_svar | special variable
imemo_throw_data |
imemo_ifunc | iterator function
imemo_memo |
imemo_ment |
imemo_iseq |
imemo_tmpbuf |
imemo_ast |
imemo_parser_strterm |
imemo_callinfo |
imemo_callcache |
imemo_constcache |

Definition at line 34 of file imemo.h.

## Function Documentation

## ◆ rb_imemo_name()

const char * rb_imemo_name | ( | enum imemo_type | type | ) |

Definition at line 2385 of file gc.c.

References env, and IMEMO_NAME.

Referenced by rb_raw_obj_info().

## ◆ rb_imemo_new()

VALUE rb_imemo_new | ( | enum imemo_type | type,
|  | VALUE | v1,
|  | VALUE | v2,
|  | VALUE | v3,
|  | VALUE | v0
| ) |  |

Definition at line 2412 of file gc.c.

References FL_USHIFT, heap_page::flags, T_IMEMO, and TRUE.

Referenced by rb_ast_new(), and rb_vm_ifunc_new().

## ◆ rb_imemo_tmpbuf_parser_heap()

rb_imemo_tmpbuf_t * rb_imemo_tmpbuf_parser_heap | ( | void * | buf,
|  | rb_imemo_tmpbuf_t * | old_heap,
|  | size_t | cnt
| ) |  |

Definition at line 2432 of file gc.c.

References cnt.

## ◆ rb_strterm_mark()

void rb_strterm_mark | ( | VALUE | obj | ) |

Definition at line 828 of file ripper.c.

References rb_strterm_struct::heredoc, rb_strterm_heredoc_struct::lastline, rb_gc_mark(), RBASIC, STRTERM_HEREDOC, and rb_strterm_struct::u.

## ◆ rb_vm_ifunc_new()

struct vm_ifunc * rb_vm_ifunc_new | ( | rb_block_call_func_t | func,
|  | const void * | data,
|  | int | min_argc,
|  | int | max_argc
| ) |  |

Definition at line 705 of file proc.c.

References vm_ifunc::argc, CHAR_BIT, imemo_ifunc, rb_eRangeError, rb_imemo_new(), rb_raise(), SIZEOF_VALUE, and UNLIMITED_ARGUMENTS.

Referenced by rb_func_lambda_new(), and rb_lambda_call().