summaryrefslogtreecommitdiff
path: root/namespace.c
AgeCommit message (Collapse)Author
5 daysFix class instance variable inside namespacesJean Boussier
Now that classes fields are delegated to an object with its own shape_id, we no longer need to mark all classes as TOO_COMPLEX. Notes: Merged: https://github.com/ruby/ruby/pull/13595
10 daysDelete useless Namespace#current_detailsSatoshi Tagomori
The implementation of Namespace#current_details shows warning about use of snprintf directive arguments (only in gcc environments?). This method will be useless when the current namespace management will be updated. Notes: Merged: https://github.com/ruby/ruby/pull/13554
2025-05-25Use RB_VM_LOCKINGNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13439
2025-05-19Fix typos: misspell -w -error -source=text namespace.cHiroshi SHIBATA
2025-05-13Fix a typoKazuhiro NISHIYAMA
2025-05-13Prevent namespace inspected strings from GCNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13307
2025-05-11Fix -Wmaybe-uninitializedTakashi Kokubun
../namespace.c: In function ‘current_namespace’: ../namespace.c:221:48: warning: ‘proc_ns’ may be used uninitialized [-Wmaybe-uninitialized] 221 | if (permit_calling_builtin || (proc_ns && NAMESPACE_USER_P(proc_ns))) | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../namespace.c:204:31: note: ‘proc_ns’ was declared here 204 | const rb_namespace_t *proc_ns; | ^~~~~~~ In function ‘copy_ext_file’, inlined from ‘rb_namespace_local_extension’ at ../namespace.c:855:18: ../namespace.c:768:21: warning: ‘written’ may be used uninitialized [-Wmaybe-uninitialized] 768 | wrote = fwrite(buffer+written, 1, read-written, dst); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../namespace.c: In function ‘rb_namespace_local_extension’: ../namespace.c:748:25: note: ‘written’ was declared here 748 | size_t read, wrote, written; | ^~~~~~~ In function ‘copy_ext_file’, inlined from ‘rb_namespace_local_extension’ at ../namespace.c:855:18: ../namespace.c:768:21: warning: ‘read’ may be used uninitialized [-Wmaybe-uninitialized] 768 | wrote = fwrite(buffer+written, 1, read-written, dst); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../namespace.c: In function ‘rb_namespace_local_extension’: ../namespace.c:748:12: note: ‘read’ was declared here 748 | size_t read, wrote, written; | ^~~~
2025-05-11Fix `Namespace#inspect` to display its internal idJean Boussier
2025-05-11RUBY_TYPED_WB_PROTECTED should be specified with write barrier protection on ↵Satoshi Tagomori
this object. https://github.com/tagomoris/ruby/pull/7 RUBY_TYPED_FREE_IMMEDIATELY can be added because namespace_entry_free does no IO nor things to block.
2025-05-11Fix `namespace_initialize` to not crash on bootJean Boussier
``` /opt/rubies/head-namespaces/bin/ruby(sigsegv+0x84) [0x104e897e8] /usr/lib/system/libsystem_platform.dylib(_sigtramp+0x38) [0x18de56de4] /opt/rubies/head-namespaces/bin/ruby(object_id+0x80) [0x104d7d420] /opt/rubies/head-namespaces/bin/ruby(object_id+0x80) [0x104d7d420] /opt/rubies/head-namespaces/bin/ruby(rb_initialize_main_namespace+0xe4) [0x104ddaa20] /opt/rubies/head-namespaces/bin/ruby(ruby_opt_init+0x120) [0x104e7f524] /opt/rubies/head-namespaces/bin/ruby(ruby_process_options+0x1370) [0x104e7e31c] /opt/rubies/head-namespaces/bin/ruby(ruby_options+0xb0) [0x104d69844] /opt/rubies/head-namespaces/bin/ruby(main+0x64) [0x104ca8d54] ``` I'm not too sure why `rb_obj_id` crashes, but I suspect it's called too early. Either way I don't think generating an object_id for namespaces is a good idea. If all we need is a unique number we can do that for much cheaper.
2025-05-11Show experimental warning when namespace is enabledSatoshi Tagomori
2025-05-11Namespace::Entry is long living objectSatoshi Tagomori
2025-05-11Follow the code style about elseSatoshi Tagomori
2025-05-11Compact prime classext readable/writable flagsSatoshi Tagomori
To make RClass size smaller, move flags of prime classext readable/writable to: readable - use ns_classext_tbl is NULL or not (if NULL, it's readable) writable - use FL_USER2 of RBasic flags
2025-05-11Fix function pointer type mismatch with `rb_define_private_method`Yusuke Endoh
`rb_define_private_method` performs strict type checking on the function pointer. As a result, we cannot pass the function a generic signature. ``` /github/workspace/src/namespace.c:1097:72: note: expected 'VALUE (*)(void)' {aka 'long unsigned int (*)(void)'} but argument is of type 'VALUE (*)(int, VALUE *, VALUE)' {aka 'long unsigned int (*)(int, long unsigned int *, long unsigned int)'} 1097 | namespace_define_loader_method(VALUE module, const char *name, VALUE (*func)(ANYARGS), int argc) | ~~~~~~~~^~~~~~~~~~~~~~ ``` This commit defines the method directly to avoid the mismatch error.
2025-05-11Fix "old-style function definition"Yusuke Endoh
``` namespace.c: In function ‘rb_namespace_available’: namespace.c:55:1: warning: old-style function definition [-Wold-style-definition] 55 | rb_namespace_available() | ^~~~~~~~~~~~~~~~~~~~~~ ```
2025-05-11namespace on readSatoshi Tagomori