From a4bc1f823316f4ac7f92552faec70ced3f310620 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 31 May 2023 13:20:09 +0200 Subject: [PATCH] TODOs --- .../org/truffleruby/language/constants/GetConstantNode.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/truffleruby/language/constants/GetConstantNode.java b/src/main/java/org/truffleruby/language/constants/GetConstantNode.java index d409fae353c9..0d0c3adfc63c 100644 --- a/src/main/java/org/truffleruby/language/constants/GetConstantNode.java +++ b/src/main/java/org/truffleruby/language/constants/GetConstantNode.java @@ -125,13 +125,14 @@ protected Object autoloadConstant( // Mark the autoload constant as loading already here and not in RequireNode so that recursive lookups act as "being loaded" autoloadConstantStart(getContext(), constant, this); + // TODO return early for other threads if the constant has been set try { try { callRequireNode.call(coreLibrary().mainObject, "require", feature); } finally { if (autoloadConstant.shouldPublish()) { autoloadConstant.publish(getContext(), constant); - } + } // TODO else remove the constant } // This needs to run while the autoload is marked as isAutoloading(), to avoid infinite recursion @@ -149,6 +150,7 @@ public static void autoloadConstantStart(RubyContext context, RubyConstant autol // We need to notify cached lookup that we are autoloading the constant, as constant // lookup changes based on whether an autoload constant is loading or not (constant // lookup ignores being-autoloaded constants). + // TODO skip if already has unpublishedValue autoloadConstant.getDeclaringModule().fields.newConstantVersion(autoloadConstant.getName()); }