Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created June 20, 2018 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/bbc4158b7ef905f743efe33d95fcbfce to your computer and use it in GitHub Desktop.
Save zoffixznet/bbc4158b7ef905f743efe33d95fcbfce to your computer and use it in GitHub Desktop.
2018.05.43 zoffix@VirtualBox~/R/rakudo (master)$ gd
diff --git a/src/core/stubs.pm6 b/src/core/stubs.pm6
index 7388a84a7..b2b3d6022 100644
--- a/src/core/stubs.pm6
+++ b/src/core/stubs.pm6
@@ -30,32 +30,35 @@ my class MixHash { ... }
my class Lock is repr('ReentrantMutex') { ... }
my class Lock::Async { ... }
-sub DYNAMIC(\name) is raw {
- nqp::ifnull(
- nqp::getlexdyn(name),
- nqp::stmts(
- nqp::unless(
- nqp::isnull(my $prom := nqp::getlexdyn('$*PROMISE')),
- (my Mu $x := nqp::getlexreldyn(
- nqp::getattr($prom,Promise,'$!dynamic_context'),name)
- )
- ),
- nqp::ifnull(
- $x,
- nqp::stmts(
- (my str $pkgname = nqp::replace(name,1,1,'')),
+sub DYNAMIC-SLOW-PATH(\name) is raw {
+ nqp::stmts(
+ nqp::unless(
+ nqp::isnull(my $prom := nqp::getlexdyn('$*PROMISE')),
+ (my Mu $x := nqp::getlexreldyn(
+ nqp::getattr($prom,Promise,'$!dynamic_context'),name)
+ )
+ ),
+ nqp::ifnull(
+ $x,
+ nqp::stmts(
+ (my str $pkgname = nqp::replace(name,1,1,'')),
+ nqp::ifnull(
+ nqp::atkey(GLOBAL.WHO,$pkgname),
nqp::ifnull(
- nqp::atkey(GLOBAL.WHO,$pkgname),
- nqp::ifnull(
- nqp::atkey(PROCESS.WHO,$pkgname),
- Rakudo::Internals.INITIALIZE-DYNAMIC(name)
- )
+ nqp::atkey(PROCESS.WHO,$pkgname),
+ Rakudo::Internals.INITIALIZE-DYNAMIC(name)
)
)
)
)
)
}
+sub DYNAMIC(\name) is raw {
+ # keeping this sub small enough to be inlined by MoarVM's spesh
+ nqp::ifnull(
+ nqp::getlexdyn(name),
+ DYNAMIC-SLOW-PATH name)
+}
# Set up ClassHOW's auto-gen proto (nested scope so it won't
# actually appear in the setting).
2018.05.43 zoffix@VirtualBox~/R/rakudo (master)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment