Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/msvc
diff options
context:
space:
mode:
authorAleksey Kliger (λgeek) <akliger@gmail.com>2018-02-07 21:01:19 +0300
committerGitHub <noreply@github.com>2018-02-07 21:01:19 +0300
commit766bf49afbebcb889cc8da96664186615c868260 (patch)
tree5056c553199b351f647b836aa4ae317c57082218 /msvc
parentc1fd4b064debd82fbf1e30d11acde181a9bb7fe2 (diff)
[metadata] Define getters for MonoClass fields (#6652)
* [configure.ac] Add --enable-checked-build=private_types option The idea is that when private_types is turned on, we will hide the definitions of various structs in Mono and only allow access via getter/setter methods. If private_types is off, those same getters would be static inline functions and also the struct definition would be visible (to allow for incremental conversion of existing code). * [metadata] Move _MonoClass definition to class-private-definition.h * [metadata] Define a getter for every MonoClass field in a checked build, the getters are just declared in class-internals.h and defined in class-accessors.h in a non-checked build, the getters are static inline functions in class-internals.h For a field foo of type FooType define FooType m_class_get_foo (MonoClass *klass) { return klass->foo; } The exceptions are fields that are embedded structs, e.g. MonoType byval_arg, for those we return a pointer to the field instead of a copy: MonoType * m_class_get_byval_arg (MonoClass *klass) { return &klass->byval_arg; } * [metadata] Rename MonoClass boolean getters to use is/has names instead of the string m_class_get_fieldname pattern - m_class_is_inited - m_class_is_size_inited - m_class_is_valuetype - m_class_is_enumtype - m_class_is_blittable - m_class_is_unicode - m_class_was_typebuilder - m_class_is_ghcimpl - m_class_has_finalize - m_class_is_delegate - m_class_is_gc_descr_inited - m_class_has_cctor - m_class_has_references - m_class_has_static_refs - m_class_has_no_special_static_fields - m_class_is_com_object - m_class_is_interfaces_inited - m_class_is_simd_type - m_class_is_has_finalize_inited - m_class_is_fields_inited - m_class_has_failure * [metadata] (class-internals.h) Use m_class_get_ getters * [metadata] (class-inlines.h) Use m_class_get_ getters * [metadata] (class-accessors.c) Use m_class_get_ getters; setters not done The setters are not converted. Ultimately, I think that will sort itself out - a few of them are only used from SRE and from MonoClass construction - we will eventually provide setters for just two places and hide them elsewhere.
Diffstat (limited to 'msvc')
-rw-r--r--msvc/libmonoruntime-common.targets2
-rw-r--r--msvc/libmonoruntime-common.targets.filters6
2 files changed, 8 insertions, 0 deletions
diff --git a/msvc/libmonoruntime-common.targets b/msvc/libmonoruntime-common.targets
index 82e809cc046..c52db52cb7e 100644
--- a/msvc/libmonoruntime-common.targets
+++ b/msvc/libmonoruntime-common.targets
@@ -13,11 +13,13 @@
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\attach.c" />
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\cil-coff.h" />
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\class.c" />
+ <ClInclude Include="$(MonoSourceLocation)\mono\metadata\class-getters.h" />
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\class-internals.h" />
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\class-inlines.h" />
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\class-init.c" />
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\class-init.h" />
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\class-accessors.c" />
+ <ClInclude Include="$(MonosourceLocation)\mono\metadata\class-private-definition.h" />
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\cominterop.c" />
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\cominterop.h" />
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\console-io.h" />
diff --git a/msvc/libmonoruntime-common.targets.filters b/msvc/libmonoruntime-common.targets.filters
index 6892b165a04..2d501392ae7 100644
--- a/msvc/libmonoruntime-common.targets.filters
+++ b/msvc/libmonoruntime-common.targets.filters
@@ -28,6 +28,9 @@
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\class.c">
<Filter>Source Files$(MonoRuntimeFilterSubFolder)\common</Filter>
</ClCompile>
+ <ClInclude Include="$(MonoSourceLocation)\mono\metadata\class-getters.h">
+ <Filter>Header Files$(MonoRuntimeFilterSubFolder)\common</Filter>
+ </ClInclude>
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\class-internals.h">
<Filter>Header Files$(MonoRuntimeFilterSubFolder)\common</Filter>
</ClInclude>
@@ -43,6 +46,9 @@
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\class-init.h">
<Filter>Header Files$(MonoRuntimeFilterSubFolder)\common</Filter>
</ClInclude>
+ <ClInclude Include="$(MonoSourceLocation)\mono\metadata\class-private-definition.h">
+ <Filter>Header Files$(MonoRuntimeFilterSubFolder)\common</Filter>
+ </ClInclude>
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\cominterop.c">
<Filter>Source Files$(MonoRuntimeFilterSubFolder)\common</Filter>
</ClCompile>