forked from mono/mono
-
Notifications
You must be signed in to change notification settings - Fork 3
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
[mjit] Initialize MonoVTable and MonoClass one level up #28
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4041,7 +4041,6 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, gi | |
MonoCompile *cfg; | ||
gpointer code = NULL; | ||
MonoJitInfo *jinfo, *info; | ||
MonoVTable *vtable; | ||
MonoException *ex = NULL; | ||
GTimer *jit_timer; | ||
MonoMethod *prof_method, *shared; | ||
|
@@ -4176,12 +4175,6 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, gi | |
return NULL; | ||
} | ||
|
||
vtable = mono_class_vtable_checked (target_domain, method->klass, error); | ||
if (!mono_error_ok (error)) { | ||
mono_destroy_compile (cfg); | ||
return NULL; | ||
} | ||
|
||
if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) { | ||
if (mono_marshal_method_from_wrapper (method)) { | ||
/* Native func wrappers have no method */ | ||
|
@@ -4193,24 +4186,12 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, gi | |
if (prof_method != method) | ||
MONO_PROFILER_RAISE (jit_done, (prof_method, jinfo)); | ||
|
||
if (!(method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE || | ||
method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK || | ||
method->wrapper_type == MONO_WRAPPER_XDOMAIN_INVOKE)) { | ||
if (!mono_runtime_class_init_full (vtable, error)) { | ||
mono_destroy_compile (cfg); | ||
return NULL; | ||
} | ||
} | ||
|
||
if (!code) { | ||
mono_destroy_compile (cfg); | ||
return NULL; | ||
} | ||
|
||
if (code_length) | ||
*code_length = cfg->code_len; | ||
|
||
mono_destroy_compile (cfg); | ||
|
||
g_assert (code); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
return code; | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused. is
bootstrapping
ever true?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when you are compiling the
ICompiler.CompileMethod
for example.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, it's still not obvious to me what happens here:
mjit_compile_method_inner
, let's say for methodFoo ()
->is_mjit_compiling = FALSE
bootstrapping = is_mjit_compiling = FALSE
!bootstrapping
, we setis_mjit_compiling = TRUE
bootstrapping
is stillFALSE
, so we are usingmono_runtime_invoke_checked ()
mjit_compile_method_inner
again, this time withbootstrapping = is_mjit_compiling = TRUE
, and therefore return a "fake compiled entry" ofMethodInfo.ctor()
/ICompiler.CompileMethod()
. By "fake compiled entry" I mean a function pointer that calls into the interpreter again, and executes said method.mjit_compile_method_inner
and compileFoo()
with the managed JIT (the managed JIT runs in the interpreter).!bootstrapping
is still the case we unsertis_mjit_compiling
when we are done forFoo()
.So either:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lewurm
mjit_compile_method_inner
, let's say for methodFoo ()
->is_mjit_compiling = FALSE
bootstrapping = is_mjit_compiling = FALSE
!bootstrapping
, we setis_mjit_compiling = TRUE
bootstrapping
is stillFALSE
, so we are usingmono_runtime_invoke_checked ()
to invokeMiniCompiler.CompileMethod(method = "Foo")
mjit_compile_method_inner
again, it means we are compilingMiniCompiler.CompileMethod
(withMiniCompiler
=> bootstrapping) -> we invoke with the Interpreter so we don't end up inmjit_compile_method_inner
again.mjit_compile_method_inner
and compileFoo()
with the managed JIT which runs as JITted code because we compiled it while running in the Interpreter.!bootstrapping
is still the case we unsertis_mjit_compiling
when we are done forFoo()
.Where this method needs improvement is in the case where we are trying to compile 1 of the method called in the call chain of
MiniCompiler.CompileMethod
, we will run the wholeMiniCompiler.CompileMethod
for that method in the Interpreter, even if we have some pieces already JITted. That's where your note on tiered compilation comes into play and it would make it work better, but that's not in the spectrum right now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh, missed that one bit. Thanks for being patient with me and taking time to explain it 🙂 very cool 👍