Skip to content

Compile functions to IL when adaptive compilation is off - #2139

Merged
slozier merged 1 commit into
IronLanguages:mainfrom
BCSharp:no-adaptive
Nov 4, 2026
Merged

slozier merged 1 commit into
IronLanguages:mainfrom
BCSharp:no-adaptive

Conversation

@BCSharp

@BCSharp BCSharp commented Nov 3, 2026

Copy link
Copy Markdown
Member

This resolves issue 1 from #2126. As an effect, it makes -X NoAdaptiveCompilation work (meaning "compile always"). With this option, the code newer gets light-compiled to interpreter instructions, but straight to IL. (-X CompilationThreshold=0 does both light-compile and compile to IL on the very first call).

Note that -X NoAdaptiveCompilation covers the __main__ module (the initial script) and _frozen_importlib, which IronPython loads itself at startup. Modules imported by the script are still compiled adaptively, and so is code run through exec, eval or compile(). That covers StdLib as well as user modules.

@slozier slozier left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Looks good to me!

I guess this resolves #2126 ?

@slozier
slozier merged commit d0e97cf into IronLanguages:main Nov 4, 2026
35 checks passed
@BCSharp

BCSharp commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

I guess this resolves #2126 ?

Not quite. There is still the open question whether -X NoAdaptiveCompilation should only apply to __main__ (like now) or to all modules. In the first case, the help printed on -h needs to be updated. In the second case, the code, and there are several ways of doing it.

I lean towards the latter; it will make this option work like other compilation options (in scope).

@BCSharp
BCSharp deleted the no-adaptive branch November 4, 2026 04:13
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