looksee 4.2.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9accc508994e31a5c5ee5c3b07d0ac494a9d69635057f5a682e993a4ed3619d
4
- data.tar.gz: 8f1c98f73662fae5bf0dc552cade610e82f58d5399c65802813f4bcc9d5c9be9
3
+ metadata.gz: 600194bca92f1417cef56f15fb778bf97169424c779269d16dc87afde159013b
4
+ data.tar.gz: a9548afb11a7e6ebbe7fa43d7155d6258871530d135197f93ed79573d899432a
5
5
  SHA512:
6
- metadata.gz: 11161fbe1bfd1d630d59e5d1f1b3acf8f0564c7ca1cf971d35f12fb5e906118a782df27ca869f277205eb43bba3ffbdf6b59c8e96a9daa438cc54aa7865ffe08
7
- data.tar.gz: f899f2c10409413e1ef77d2d0d64636922b39837fe8c3f04969619e8da32bf8195fdaca6d44ae79524c11736764e6419f83a6ea59a57d0343c94463f0eb8f39c
6
+ metadata.gz: '08f3978dbed48efa7daaba8fe778b9dfdf3032748dc2cdfd9ac5d36667bfd2ea7eff4b3662d660f97784d99459d082c0228c188bd2b3261e3ed5935d06a45460'
7
+ data.tar.gz: ec4dbddc1ca894b843d0ad187ea4ce35a4a1c6890a920790479d01e35ccb81f19bf321dff7001060d5f3280dd312d27b7c74494a756fad02613ad30b96dcae86
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 4.4.0 2021-01-17
2
+
3
+ * Support for MRI 3.0. [Mathieu Jobin]
4
+
1
5
  == 4.2.0 2019-12-26
2
6
 
3
7
  * Support for MRI 2.7.
@@ -4,7 +4,9 @@ extension = ruby_engine == 'ruby' ? 'mri' : ruby_engine
4
4
  require 'mkmf'
5
5
  $CPPFLAGS << " -DRUBY_VERSION=#{RUBY_VERSION.tr('.', '')}"
6
6
  if extension == 'mri'
7
- if RUBY_VERSION >= '2.7.0'
7
+ if RUBY_VERSION >= '3.0.0'
8
+ $CPPFLAGS << " -Imri/3.0.0"
9
+ elsif RUBY_VERSION >= '2.7.0'
8
10
  $CPPFLAGS << " -Imri/2.7.0"
9
11
  elsif RUBY_VERSION >= '2.3.0'
10
12
  $CPPFLAGS << " -Imri/2.3.0"
@@ -0,0 +1,36 @@
1
+ #ifndef RUBY_ID_TABLE_H
2
+ #define RUBY_ID_TABLE_H 1
3
+ #include "ruby/internal/config.h"
4
+ #include <stddef.h>
5
+ #include "ruby/ruby.h"
6
+
7
+ struct rb_id_table;
8
+
9
+ /* compatible with ST_* */
10
+ enum rb_id_table_iterator_result {
11
+ ID_TABLE_CONTINUE = ST_CONTINUE,
12
+ ID_TABLE_STOP = ST_STOP,
13
+ ID_TABLE_DELETE = ST_DELETE,
14
+ ID_TABLE_REPLACE = ST_REPLACE,
15
+ ID_TABLE_ITERATOR_RESULT_END
16
+ };
17
+
18
+ struct rb_id_table *rb_id_table_create(size_t size);
19
+ void rb_id_table_free(struct rb_id_table *tbl);
20
+ void rb_id_table_clear(struct rb_id_table *tbl);
21
+
22
+ size_t rb_id_table_size(const struct rb_id_table *tbl);
23
+ size_t rb_id_table_memsize(const struct rb_id_table *tbl);
24
+
25
+ int rb_id_table_insert(struct rb_id_table *tbl, ID id, VALUE val);
26
+ int rb_id_table_lookup(struct rb_id_table *tbl, ID id, VALUE *valp);
27
+ int rb_id_table_delete(struct rb_id_table *tbl, ID id);
28
+
29
+ typedef enum rb_id_table_iterator_result rb_id_table_update_callback_func_t(ID *id, VALUE *val, void *data, int existing);
30
+ typedef enum rb_id_table_iterator_result rb_id_table_foreach_func_t(ID id, VALUE val, void *data);
31
+ typedef enum rb_id_table_iterator_result rb_id_table_foreach_values_func_t(VALUE val, void *data);
32
+ void rb_id_table_foreach(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, void *data);
33
+ void rb_id_table_foreach_with_replace(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, rb_id_table_update_callback_func_t *replace, void *data);
34
+ void rb_id_table_foreach_values(struct rb_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data);
35
+
36
+ #endif /* RUBY_ID_TABLE_H */
@@ -0,0 +1,107 @@
1
+ #ifndef RUBY_INTERNAL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define RUBY_INTERNAL_H 1
3
+ /**
4
+ * @file
5
+ * @author $Author$
6
+ * @date Tue May 17 11:42:20 JST 2011
7
+ * @copyright Copyright (C) 2011 Yukihiro Matsumoto
8
+ * @copyright This file is a part of the programming language Ruby.
9
+ * Permission is hereby granted, to either redistribute and/or
10
+ * modify this file, provided that the conditions mentioned in the
11
+ * file COPYING are met. Consult the file for details.
12
+ */
13
+ #include "ruby/internal/config.h"
14
+
15
+ #ifdef __cplusplus
16
+ # error not for C++
17
+ #endif
18
+
19
+ #define LIKELY(x) RB_LIKELY(x)
20
+ #define UNLIKELY(x) RB_UNLIKELY(x)
21
+
22
+ #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
23
+ #define roomof(x, y) (((x) + (y) - 1) / (y))
24
+ #define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
25
+
26
+ /* Prevent compiler from reordering access */
27
+ #define ACCESS_ONCE(type,x) (*((volatile type *)&(x)))
28
+
29
+ #include "ruby/ruby.h"
30
+
31
+ /* Following macros were formerly defined in this header but moved to somewhere
32
+ * else. In order to detect them we undef here. */
33
+
34
+ /* internal/array.h */
35
+ #undef RARRAY_AREF
36
+
37
+ /* internal/class.h */
38
+ #undef RClass
39
+ #undef RCLASS_SUPER
40
+
41
+ /* internal/gc.h */
42
+ #undef NEWOBJ_OF
43
+ #undef RB_NEWOBJ_OF
44
+ #undef RB_OBJ_WRITE
45
+
46
+ /* internal/hash.h */
47
+ #undef RHASH_IFNONE
48
+ #undef RHASH_SIZE
49
+ #undef RHASH_TBL
50
+ #undef RHASH_EMPTY_P
51
+
52
+ /* internal/object.h */
53
+ #undef ROBJECT_IV_INDEX_TBL
54
+
55
+ /* internal/struct.h */
56
+ #undef RSTRUCT_LEN
57
+ #undef RSTRUCT_PTR
58
+ #undef RSTRUCT_SET
59
+ #undef RSTRUCT_GET
60
+
61
+ /* Also, we keep the following macros here. They are expected to be
62
+ * overridden in each headers. */
63
+
64
+ /* internal/array.h */
65
+ #define rb_ary_new_from_args(...) rb_nonexistent_symbol(__VA_ARGS__)
66
+
67
+ /* internal/io.h */
68
+ #define rb_io_fptr_finalize(...) rb_nonexistent_symbol(__VA_ARGS__)
69
+
70
+ /* internal/string.h */
71
+ #define rb_fstring_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
72
+
73
+ /* internal/symbol.h */
74
+ #define rb_sym_intern_ascii_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
75
+
76
+ /* internal/vm.h */
77
+ #define rb_funcallv(...) rb_nonexistent_symbol(__VA_ARGS__)
78
+ #define rb_method_basic_definition_p(...) rb_nonexistent_symbol(__VA_ARGS__)
79
+
80
+
81
+ /* MRI debug support */
82
+
83
+ /* gc.c */
84
+ void rb_obj_info_dump(VALUE obj);
85
+ void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func);
86
+
87
+ /* debug.c */
88
+
89
+ RUBY_SYMBOL_EXPORT_BEGIN
90
+ void ruby_debug_breakpoint(void);
91
+ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
92
+ RUBY_SYMBOL_EXPORT_END
93
+
94
+ // show obj data structure without any side-effect
95
+ #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
96
+
97
+ // same as rp, but add message header
98
+ #define rp_m(msg, obj) do { \
99
+ fprintf(stderr, "%s", (msg)); \
100
+ rb_obj_info_dump((VALUE)obj); \
101
+ } while (0)
102
+
103
+ // `ruby_debug_breakpoint()` does nothing,
104
+ // but breakpoint is set in run.gdb, so `make gdb` can stop here.
105
+ #define bp() ruby_debug_breakpoint()
106
+
107
+ #endif /* RUBY_INTERNAL_H */
@@ -0,0 +1,119 @@
1
+ #ifndef INTERNAL_ARRAY_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_ARRAY_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for Array.
11
+ */
12
+ #include "ruby/internal/config.h"
13
+ #include <stddef.h> /* for size_t */
14
+ #include "internal/static_assert.h" /* for STATIC_ASSERT */
15
+ #include "ruby/internal/stdbool.h" /* for bool */
16
+ #include "ruby/ruby.h" /* for RARRAY_LEN */
17
+
18
+ #ifndef ARRAY_DEBUG
19
+ # define ARRAY_DEBUG (0+RUBY_DEBUG)
20
+ #endif
21
+
22
+ #define RARRAY_PTR_IN_USE_FLAG FL_USER14
23
+
24
+ /* array.c */
25
+ VALUE rb_ary_last(int, const VALUE *, VALUE);
26
+ void rb_ary_set_len(VALUE, long);
27
+ void rb_ary_delete_same(VALUE, VALUE);
28
+ VALUE rb_ary_tmp_new_fill(long capa);
29
+ VALUE rb_ary_at(VALUE, VALUE);
30
+ size_t rb_ary_memsize(VALUE);
31
+ VALUE rb_to_array_type(VALUE obj);
32
+ void rb_ary_cancel_sharing(VALUE ary);
33
+
34
+ static inline VALUE rb_ary_entry_internal(VALUE ary, long offset);
35
+ static inline bool ARY_PTR_USING_P(VALUE ary);
36
+ static inline void RARY_TRANSIENT_SET(VALUE ary);
37
+ static inline void RARY_TRANSIENT_UNSET(VALUE ary);
38
+
39
+ RUBY_SYMBOL_EXPORT_BEGIN
40
+ /* array.c (export) */
41
+ void rb_ary_detransient(VALUE a);
42
+ VALUE *rb_ary_ptr_use_start(VALUE ary);
43
+ void rb_ary_ptr_use_end(VALUE ary);
44
+ RUBY_SYMBOL_EXPORT_END
45
+
46
+ MJIT_SYMBOL_EXPORT_BEGIN
47
+ VALUE rb_ary_tmp_new_from_values(VALUE, long, const VALUE *);
48
+ VALUE rb_check_to_array(VALUE ary);
49
+ VALUE rb_ary_behead(VALUE, long);
50
+ VALUE rb_ary_aref1(VALUE ary, VALUE i);
51
+
52
+ struct rb_execution_context_struct;
53
+ VALUE rb_ec_ary_new_from_values(struct rb_execution_context_struct *ec, long n, const VALUE *elts);
54
+ MJIT_SYMBOL_EXPORT_END
55
+
56
+ static inline VALUE
57
+ rb_ary_entry_internal(VALUE ary, long offset)
58
+ {
59
+ long len = RARRAY_LEN(ary);
60
+ const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
61
+ if (len == 0) return Qnil;
62
+ if (offset < 0) {
63
+ offset += len;
64
+ if (offset < 0) return Qnil;
65
+ }
66
+ else if (len <= offset) {
67
+ return Qnil;
68
+ }
69
+ return ptr[offset];
70
+ }
71
+
72
+ static inline bool
73
+ ARY_PTR_USING_P(VALUE ary)
74
+ {
75
+ return FL_TEST_RAW(ary, RARRAY_PTR_IN_USE_FLAG);
76
+ }
77
+
78
+ static inline void
79
+ RARY_TRANSIENT_SET(VALUE ary)
80
+ {
81
+ #if USE_TRANSIENT_HEAP
82
+ FL_SET_RAW(ary, RARRAY_TRANSIENT_FLAG);
83
+ #endif
84
+ }
85
+
86
+ static inline void
87
+ RARY_TRANSIENT_UNSET(VALUE ary)
88
+ {
89
+ #if USE_TRANSIENT_HEAP
90
+ FL_UNSET_RAW(ary, RARRAY_TRANSIENT_FLAG);
91
+ #endif
92
+ }
93
+
94
+ #undef rb_ary_new_from_args
95
+ #if RBIMPL_HAS_WARNING("-Wgnu-zero-variadic-macro-arguments")
96
+ # /* Skip it; clang -pedantic doesn't like the following */
97
+ #elif defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO)
98
+ #define rb_ary_new_from_args(n, ...) \
99
+ __extension__ ({ \
100
+ const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
101
+ if (__builtin_constant_p(n)) { \
102
+ STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
103
+ } \
104
+ rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
105
+ })
106
+ #endif
107
+
108
+ #undef RARRAY_AREF
109
+ RBIMPL_ATTR_PURE_UNLESS_DEBUG()
110
+ RBIMPL_ATTR_ARTIFICIAL()
111
+ static inline VALUE
112
+ RARRAY_AREF(VALUE ary, long i)
113
+ {
114
+ RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY);
115
+
116
+ return RARRAY_CONST_PTR_TRANSIENT(ary)[i];
117
+ }
118
+
119
+ #endif /* INTERNAL_ARRAY_H */
@@ -0,0 +1,174 @@
1
+ #ifndef INTERNAL_CLASS_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_CLASS_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for Class.
11
+ */
12
+ #include "id_table.h" /* for struct rb_id_table */
13
+ #include "internal/gc.h" /* for RB_OBJ_WRITE */
14
+ #include "internal/serial.h" /* for rb_serial_t */
15
+ #include "ruby/internal/stdbool.h" /* for bool */
16
+ #include "ruby/intern.h" /* for rb_alloc_func_t */
17
+ #include "ruby/ruby.h" /* for struct RBasic */
18
+
19
+ #ifdef RCLASS_SUPER
20
+ # undef RCLASS_SUPER
21
+ #endif
22
+
23
+ struct rb_subclass_entry {
24
+ VALUE klass;
25
+ struct rb_subclass_entry *next;
26
+ };
27
+
28
+ struct rb_iv_index_tbl_entry {
29
+ uint32_t index;
30
+ rb_serial_t class_serial;
31
+ VALUE class_value;
32
+ };
33
+
34
+ struct rb_classext_struct {
35
+ struct st_table *iv_index_tbl; // ID -> struct rb_iv_index_tbl_entry
36
+ struct st_table *iv_tbl;
37
+ #if SIZEOF_SERIAL_T == SIZEOF_VALUE /* otherwise m_tbl is in struct RClass */
38
+ struct rb_id_table *m_tbl;
39
+ #endif
40
+ struct rb_id_table *const_tbl;
41
+ struct rb_id_table *callable_m_tbl;
42
+ struct rb_id_table *cc_tbl; /* ID -> [[ci, cc1], cc2, ...] */
43
+ struct rb_subclass_entry *subclasses;
44
+ struct rb_subclass_entry **parent_subclasses;
45
+ /**
46
+ * In the case that this is an `ICLASS`, `module_subclasses` points to the link
47
+ * in the module's `subclasses` list that indicates that the klass has been
48
+ * included. Hopefully that makes sense.
49
+ */
50
+ struct rb_subclass_entry **module_subclasses;
51
+ #if SIZEOF_SERIAL_T != SIZEOF_VALUE /* otherwise class_serial is in struct RClass */
52
+ rb_serial_t class_serial;
53
+ #endif
54
+ const VALUE origin_;
55
+ const VALUE refined_class;
56
+ rb_alloc_func_t allocator;
57
+ const VALUE includer;
58
+ };
59
+
60
+ struct RClass {
61
+ struct RBasic basic;
62
+ VALUE super;
63
+ struct rb_classext_struct *ptr;
64
+ #if SIZEOF_SERIAL_T == SIZEOF_VALUE
65
+ /* Class serial is as wide as VALUE. Place it here. */
66
+ rb_serial_t class_serial;
67
+ #else
68
+ /* Class serial does not fit into struct RClass. Place m_tbl instead. */
69
+ struct rb_id_table *m_tbl;
70
+ #endif
71
+ };
72
+
73
+ typedef struct rb_subclass_entry rb_subclass_entry_t;
74
+ typedef struct rb_classext_struct rb_classext_t;
75
+
76
+ #define RCLASS_EXT(c) (RCLASS(c)->ptr)
77
+ #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
78
+ #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
79
+ #if SIZEOF_SERIAL_T == SIZEOF_VALUE
80
+ # define RCLASS_M_TBL(c) (RCLASS_EXT(c)->m_tbl)
81
+ #else
82
+ # define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
83
+ #endif
84
+ #define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl)
85
+ #define RCLASS_CC_TBL(c) (RCLASS_EXT(c)->cc_tbl)
86
+ #define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
87
+ #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_)
88
+ #define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
89
+ #if SIZEOF_SERIAL_T == SIZEOF_VALUE
90
+ # define RCLASS_SERIAL(c) (RCLASS(c)->class_serial)
91
+ #else
92
+ # define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
93
+ #endif
94
+ #define RCLASS_INCLUDER(c) (RCLASS_EXT(c)->includer)
95
+
96
+ #define RICLASS_IS_ORIGIN FL_USER5
97
+ #define RCLASS_CLONED FL_USER6
98
+ #define RICLASS_ORIGIN_SHARED_MTBL FL_USER8
99
+
100
+ /* class.c */
101
+ void rb_class_subclass_add(VALUE super, VALUE klass);
102
+ void rb_class_remove_from_super_subclasses(VALUE);
103
+ int rb_singleton_class_internal_p(VALUE sklass);
104
+ VALUE rb_class_boot(VALUE);
105
+ VALUE rb_make_metaclass(VALUE, VALUE);
106
+ VALUE rb_include_class_new(VALUE, VALUE);
107
+ void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
108
+ void rb_class_detach_subclasses(VALUE);
109
+ void rb_class_detach_module_subclasses(VALUE);
110
+ void rb_class_remove_from_module_subclasses(VALUE);
111
+ VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj);
112
+ VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj);
113
+ VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj);
114
+ VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj);
115
+ VALUE rb_special_singleton_class(VALUE);
116
+ VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
117
+ VALUE rb_singleton_class_get(VALUE obj);
118
+ int rb_class_has_methods(VALUE c);
119
+ void rb_undef_methods_from(VALUE klass, VALUE super);
120
+
121
+ static inline void RCLASS_SET_ORIGIN(VALUE klass, VALUE origin);
122
+ static inline void RICLASS_SET_ORIGIN_SHARED_MTBL(VALUE iclass);
123
+ static inline VALUE RCLASS_SUPER(VALUE klass);
124
+ static inline VALUE RCLASS_SET_SUPER(VALUE klass, VALUE super);
125
+ static inline void RCLASS_SET_INCLUDER(VALUE iclass, VALUE klass);
126
+
127
+ MJIT_SYMBOL_EXPORT_BEGIN
128
+ VALUE rb_class_inherited(VALUE, VALUE);
129
+ VALUE rb_keyword_error_new(const char *, VALUE);
130
+ MJIT_SYMBOL_EXPORT_END
131
+
132
+ static inline void
133
+ RCLASS_SET_ORIGIN(VALUE klass, VALUE origin)
134
+ {
135
+ RB_OBJ_WRITE(klass, &RCLASS_ORIGIN(klass), origin);
136
+ if (klass != origin) FL_SET(origin, RICLASS_IS_ORIGIN);
137
+ }
138
+
139
+ static inline void
140
+ RICLASS_SET_ORIGIN_SHARED_MTBL(VALUE iclass)
141
+ {
142
+ FL_SET(iclass, RICLASS_ORIGIN_SHARED_MTBL);
143
+ }
144
+
145
+ static inline bool
146
+ RICLASS_OWNS_M_TBL_P(VALUE iclass)
147
+ {
148
+ return FL_TEST_RAW(iclass, RICLASS_IS_ORIGIN | RICLASS_ORIGIN_SHARED_MTBL) == RICLASS_IS_ORIGIN;
149
+ }
150
+
151
+ static inline void
152
+ RCLASS_SET_INCLUDER(VALUE iclass, VALUE klass)
153
+ {
154
+ RB_OBJ_WRITE(iclass, &RCLASS_INCLUDER(iclass), klass);
155
+ }
156
+
157
+ static inline VALUE
158
+ RCLASS_SUPER(VALUE klass)
159
+ {
160
+ return RCLASS(klass)->super;
161
+ }
162
+
163
+ static inline VALUE
164
+ RCLASS_SET_SUPER(VALUE klass, VALUE super)
165
+ {
166
+ if (super) {
167
+ rb_class_remove_from_super_subclasses(klass);
168
+ rb_class_subclass_add(super, klass);
169
+ }
170
+ RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
171
+ return super;
172
+ }
173
+
174
+ #endif /* INTERNAL_CLASS_H */