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

Skip to content

Conversation

@lambdageek
Copy link
Member

@lambdageek lambdageek commented Mar 27, 2018

FOR REFERENCE ONLY

Please comment on the RFC and design discussion

We already have the idea of a MonoClass being partially initialized.

With this commit, we explicitly introduce the idea of a /readiness level/.
With mono_class_init_ready (k, r) we can ask that k be prepared to readiness
level r.

The readiness levels range between MONO_CLASS_READY_MIN (aka
MONO_CLASS_READY_BAREBONES) which is the state in which a MonoClass* is first
created (that is, mono_class_init_ready (k, MONO_CLASS_READY_BAREBONES) does no
additional initialization), to MONO_CLASS_READY_MAX (aka
MONO_CLASS_READY_INSTANTIATE) which means that the class is fully loaded and we
can create per-domain vtables for the class and ultimately MonoObjects
instances of the class.

In this PR we just re-implement mono_class_init (k) in terms of
mono_class_init_ready (k, MONO_CLASS_READY_MAX) but not any of the callers of
mono_class_init().
…_CLASS_READY_MAX)

Mark mono_class_init external only.

Each of these call sites should be revisited to see if it is possible to lower
the readiness level based on which portion of the MonoClass the call site is
going to use.
case MONO_CLASS_READY_INSTANTIATE:
break; /* continue with initialization */
default:
g_assert_not_reached ();
Copy link
Contributor

Choose a reason for hiding this comment

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

a g_error with the value passed would help debugging.

@kumpera
Copy link
Contributor

kumpera commented Mar 28, 2018

LGTM, should this cover the many lazy init steps in the setup functions?

One thing, I believe the comment in MONO_CLASS_READY_INSTANTIATE is incorrect as mono_class_init AFAICT doesn't do vtable setup.

@lambdageek
Copy link
Member Author

@kumpera 1. yes this should eventually take over from the _setup_ functions. 2. thanks - looks like mono_class_init only sets up the vtable for generic instances. I'll rename. 3. We have the overall design discussion over at #7856

@steveisok
Copy link
Contributor

Since this is older, I'm closing. Please see the old pull request policy for more info.

@steveisok steveisok closed this Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants