少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/**
 * \file
 */
 
#include <stdio.h>
 
#include "config.h"
#include <mono/metadata/abi-details.h>
 
#include <mono/metadata/class-internals.h>
#include <mono/metadata/object-internals.h>
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/monitor.h>
#include <mono/metadata/handle.h>
#ifdef HAVE_SGEN_GC
#include <mono/sgen/sgen-gc.h>
#endif
 
static int
dump_arch (void)
{
#if defined (TARGET_X86)
    g_print ("#ifdef TARGET_X86\n");
#elif defined (TARGET_AMD64)
    g_print ("#ifdef TARGET_AMD64\n");
#elif defined (TARGET_ARM)
    g_print ("#ifdef TARGET_ARM\n");
#elif defined (TARGET_ARM64)
    g_print ("#ifdef TARGET_ARM64\n");
#else
    return 0;
#endif
    return 1;
}
 
static int
dump_os (void)
{
#if defined (HOST_WIN32)
    g_print ("#ifdef TARGET_WIN32\n");
#elif defined (HOST_ANDROID)
    g_print ("#ifdef TARGET_ANDROID\n");
#elif defined (HOST_DARWIN)
    g_print ("#ifdef TARGET_OSX\n");
#elif defined (PLATFORM_IOS)
    g_print ("#ifdef TARGET_IOS\n");
#else
    return 0;
#endif
    return 1;
}
 
void
mono_dump_metadata_offsets (void);
 
void
mono_dump_metadata_offsets (void)
{
#ifdef USED_CROSS_COMPILER_OFFSETS
    g_print ("not using native offsets\n");
#else
    g_print ("#ifndef USED_CROSS_COMPILER_OFFSETS\n");
 
    if (!dump_arch ()) {
        g_print ("#error failed to figure out the current arch\n");
        return;
    }
 
    if (!dump_os ()) {
        g_print ("#error failed to figure out the current OS\n");
        return;
    }
 
#ifdef HAVE_SGEN_GC
    g_print ("#ifndef HAVE_BOEHM_GC\n");
#elif HAVE_BOEHM_GC
    g_print ("#ifndef HAVE_SGEN_GC\n");
#else
    g_print ("#error no gc conf not supported\n");
    return;
#endif
 
    g_print ("#define HAS_CROSS_COMPILER_OFFSETS\n");
    g_print ("#if defined (USE_CROSS_COMPILE_OFFSETS) || defined (MONO_CROSS_COMPILE)\n");
    g_print ("#if !defined (DISABLE_METADATA_OFFSETS)\n");
    g_print ("#define USED_CROSS_COMPILER_OFFSETS\n");
 
#define DISABLE_JIT_OFFSETS
#define DECL_OFFSET2(struct,field,offset) this_should_not_happen
#define DECL_ALIGN2(type,size) this_should_not_happen
 
#define DECL_OFFSET(struct,field) g_print ("DECL_OFFSET2(%s,%s,%d)\n", #struct, #field, (int)MONO_STRUCT_OFFSET (struct, field));
#define DECL_ALIGN(type) g_print ("DECL_ALIGN2(%s,%d)\n", #type, (int)MONO_ABI_ALIGNOF (type));
#define DECL_SIZE(type) g_print ("DECL_SIZE2(%s,%d)\n", #type, (int)MONO_ABI_SIZEOF (type));
#include <mono/metadata/object-offsets.h>
 
    g_print ("#endif //disable metadata check\n");
    g_print ("#endif //gc check\n");
#endif
}
 
void
mono_metadata_cross_helpers_run (void);
 
/*
 * mono_metadata_cross_helpers_run:
 *
 *   Check that the offsets given by object-offsets.h match the offsets
 * on the host. This only checks the metadata offsets.
 */
void
mono_metadata_cross_helpers_run (void)
{
#if defined (HAS_CROSS_COMPILER_OFFSETS) && !defined (MONO_CROSS_COMPILE)
    gboolean is_broken = FALSE;
 
#define DISABLE_JIT_OFFSETS
#define USE_CROSS_COMPILE_OFFSETS
#define DECL_OFFSET(struct,field) this_should_not_happen_for_cross_fields
#define DECL_OFFSET2(struct,field,offset) \
     if ((int)G_STRUCT_OFFSET (struct, field) != offset) { \
        g_print (#struct ":" #field " invalid struct offset %d (expected %d)\n",    \
            offset,    \
            (int)G_STRUCT_OFFSET (struct, field));    \
        is_broken = TRUE;    \
    }
#define DECL_ALIGN(type) this_should_not_happen_for_cross_align
#define DECL_ALIGN2(name,size) \
     if (MONO_ALIGN_ ## name != size) { \
        g_print (#name ": invalid alignment %d (expected %d)\n",    \
        size,    \
        MONO_ALIGN_ ## name);    \
        is_broken = TRUE;    \
    }
#define DECL_SIZE(type) this_should_not_happen_for_cross_size
#define DECL_SIZE2(name,size) \
     if (MONO_SIZEOF_ ## name != size) { \
        g_print (#name ": invalid size %d (expected %d)\n",    \
        size,    \
        MONO_SIZEOF_ ## name);    \
        is_broken = TRUE;    \
    }
 
#include <mono/metadata/object-offsets.h>
 
    g_assert (!is_broken);
#endif
}