Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,24 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
builder.EmitZeros(classConstructorContextStorageSize - GetClassConstructorContextSize(_type.Context.Target));

// Emit the actual StaticClassConstructionContext
MethodDesc cctorMethod = _type.GetStaticConstructor();
builder.EmitPointerReloc(factory.ExactCallableAddress(cctorMethod));

// If we're emitting the cctor context, but the type is actually preinitialized, emit the
// cctor context as already executed.
if (!HasLazyStaticConstructor)
{
// Pointer to the cctor: we don't care - emit as zero
builder.EmitZeroPointer();

// Constructor executed
// TODO-NICE: introduce a named constant and also use it in the runner in CoreLib
builder.EmitInt(1);
}
else
{
// Emit pointer to the cctor
MethodDesc cctorMethod = _type.GetStaticConstructor();
builder.EmitPointerReloc(factory.ExactCallableAddress(cctorMethod));

// Constructor didn't execute
builder.EmitInt(0);
}
Expand Down