Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Namespace management using control frame #13454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

tagomoris
Copy link
Contributor

TODO: write later

Comment on lines +81 to +80
/*
static bool
namespace_ignore_builtin_primitive_methods_p(const rb_namespace_t *ns, rb_method_definition_t *def)
{
if (!NAMESPACE_BUILTIN_P(ns)) {
return false;
}
/* Primitive methods (just to call C methods) covers/hides the effective
/ Primitive methods (just to call C methods) covers/hides the effective
namespaces, so ignore the methods' namespaces to expose user code's
namespace to the implementation.
*/
/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can disable code contains comments by #if 0..#endif.

@tagomoris tagomoris force-pushed the namespace-using-control-frame branch from 9cb95e9 to b0193f3 Compare June 1, 2025 03:19
@tagomoris tagomoris force-pushed the namespace-using-control-frame branch from fd04acf to 88e1fad Compare June 14, 2025 04:52
Copy link

launchable-app bot commented Jun 15, 2025

Tests Failed

✖️19 tests failed ✔️61988 tests passed(1 flake)

22/154 test sessions failed

❌ Test session #4512207 failedos:macos-14 ![workflow:YJIT macOS Arm64](https://img.shields.io/badge/workflow-YJIT macOS Arm64-blue.svg) test_opts:--enable-yjit test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32583 tests passed

❌ Test session #4512211 failedos:macos-14 ![workflow:YJIT macOS Arm64](https://img.shields.io/badge/workflow-YJIT macOS Arm64-blue.svg) test_opts:--enable-yjit:dev test_task:checkdetails on CI
🔔 5 issues ✖️20 tests failed ✔️32582 tests passed

❌ Test session #4512218 failedos:macos-latest workflow:ModGC test_opts: test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️32575 tests passed

❌ Test session #4512219 failedos:macos-15 workflow:macOS test_opts: test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️32559 tests passed

❌ Test session #4512222 failedos:macos-14 workflow:macOS test_opts: test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️32584 tests passed

❌ Test session #4512223 failedos:macos-14 workflow:macOS test_opts: test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️32584 tests passed

❌ Test session #4512229 failedos:ubuntu-22.04 ![workflow:YJIT Ubuntu](https://img.shields.io/badge/workflow-YJIT Ubuntu-blue.svg) test_opts:--enable-yjit:dev test_task:checkdetails on CI
🔔 5 issues ✖️20 tests failed ✔️no tests passed

❌ Test session #4512230 failedos:macos-14 workflow:macOS test_opts: test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32584 tests passed

❌ Test session #4512235 failedos:ubuntu-22.04 ![workflow:YJIT Ubuntu](https://img.shields.io/badge/workflow-YJIT Ubuntu-blue.svg) test_opts:RUSTC:'rustc+1.58.0' test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️no tests passed

❌ Test session #4512237 failedos:ubuntu-22.04 workflow:Ubuntu test_opts:--enable-shared--enable-load-relative test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️32638 tests passed

❌ Test session #4512238 failedos:ubuntu-22.04 ![workflow:YJIT Ubuntu](https://img.shields.io/badge/workflow-YJIT Ubuntu-blue.svg) test_opts:--enable-yjit:dev test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️no tests passed

❌ Test session #4512243 failedos:macos-latest workflow:ModGC test_opts: test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32583 tests passed

❌ Test session #4512244 failedos:ubuntu-22.04 workflow:Ubuntu test_opts:cppflags:-DVM_CHECK_MODE test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32638 tests passed

❌ Test session #4512249 failedos:macos-14 workflow:macOS test_opts: test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️32584 tests passed

❌ Test session #4512250 failedos:ubuntu-latest workflow:ModGC test_opts: test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32637 tests passed

❌ Test session #4512257 failedos:ubuntu-22.04 workflow:Ubuntu test_opts: test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32625 tests passed

❌ Test session #4512258 failedos:ubuntu-24.04-arm workflow:Ubuntu test_opts: test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️32636 tests passed

❌ Test session #4512259 failedos:ubuntu-24.04 workflow:Ubuntu test_opts: test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32638 tests passed

❌ Test session #4512262 failedos:ubuntu-latest workflow:ModGC test_opts: test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32629 tests passed

❌ Test session #4512275 failedos:macos-13 workflow:macOS test_opts: test_task:checkdetails on CI
🔔 3 issues ✖️19 tests failed ✔️32583 tests passed

❌ Test session #4512278 failedos:ubuntu-22.04 workflow:Ubuntu test_opts:--disable-yjit test_task:checkdetails on CI
🔔 4 issues ✖️19 tests failed ✔️32638 tests passed

❌ Test session #4512303 failedos:windows-2022 workflow:MinGW test_opts:none test_task:checkdetails on CI
🔔 1 issue ✖️1 test failed ✔️24116 tests passed

Satoshi Tagomori added 7 commits June 24, 2025 21:31
…al contexts

to fix inconsistent and wrong current namespace detections.

This includes:
* Moving load_path and related things from rb_vm_t to rb_namespace_t to simplify
  accessing those values via namespace (instead of accessing either vm or ns)
* Initializing root_namespace earlier and consolidate builtin_namespace into root_namespace
* Adding VM_FRAME_FLAG_NS_REQUIRE for checkpoints to detect a namespace to load/require files
* Removing implicit refinements in the root namespace which was used to determine
  the namespace to be loaded (replaced by VM_FRAME_FLAG_NS_REQUIRE)
* Removing namespaces from rb_proc_t because its namespace can be identified by lexical context
* Starting to use ep[VM_ENV_DATA_INDEX_SPECVAL] to store the current namespace when
  the frame type is MAGIC_TOP or MAGIC_CLASS (block handlers don't exist in this case)
Calling rb_current_namespace() in rb_namespace_current() means to show
the definition namespace of Namespace.current itself (it's the root always)
but the users' expectation is to show the namespace of the place where
the Namespace.current is called.
* checking all control frames (instead of filtering by VM_FRAME_RUBYFRAME_P)
  because VM_FRAME_FLAG_NS_REQUIRE is set on non-rubyframe
* skip frames of CFUNC in the root namespace for Kernel#require (etc) to avoid
  detecting the root namespace of those frames wrongly
@tagomoris tagomoris force-pushed the namespace-using-control-frame branch from 0ac3835 to 1e43ad1 Compare June 29, 2025 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants