comparison slides/2018/05/16/memo.txt @ 45:f5dac10540d7

auto-Update generated slides by script
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 29 May 2018 18:44:59 +0900
parents
children
comparison
equal deleted inserted replaced
44:8c7be076e6e6 45:f5dac10540d7
1 MVMSpeshFactsが主に使われている構造体
2
3 宣言元はfacts.h
4
5 ```c
6 struct MVMSpeshFacts {
7 /* Flags indicating things we know. */
8 MVMint32 flags;
9
10 /* The number of usages it has. */
11 MVMint32 usages;
12
13 /* Known type, if any. */
14 MVMObject *type;
15
16 /* Known type post-decontainerization, if any. */
17 MVMObject *decont_type;
18
19 /* Known value, if any. */
20 union {
21 MVMObject *o;
22 MVMint64 i;
23 MVMnum64 n;
24 MVMString *s;
25 } value;
26
27 /* The instruction that writes the register (noting we're in SSA form, so
28 * this is unique). */
29 MVMSpeshIns *writer;
30
31 /* The deoptimization index in effect at the point of declaration, or -1
32 * if none yet. */
33 MVMint32 deopt_idx;
34
35 /* The log guard the facts depend on, if any. */
36 MVMuint32 log_guard;
37
38 /* Has the instruction that wrote this value been deleted? */
39 MVMuint32 dead_writer;
40 };
41 ```
42
43 fact のflag一覧
44
45 ```c
46 /* Various fact flags. */
47 #define MVM_SPESH_FACT_KNOWN_TYPE 1 /* Has a known type. */
48 #define MVM_SPESH_FACT_KNOWN_VALUE 2 /* Has a known value. */
49 #define MVM_SPESH_FACT_DECONTED 4 /* Know it's decontainerized. */
50 #define MVM_SPESH_FACT_CONCRETE 8 /* Know it's a concrete object. */
51 #define MVM_SPESH_FACT_TYPEOBJ 16 /* Know it's a type object. */
52 #define MVM_SPESH_FACT_KNOWN_DECONT_TYPE 32 /* Has a known type after decont. */
53 #define MVM_SPESH_FACT_DECONT_CONCRETE 64 /* Is concrete after decont. */
54 #define MVM_SPESH_FACT_DECONT_TYPEOBJ 128 /* Is a type object after decont. */
55 #define MVM_SPESH_FACT_FROM_LOG_GUARD 256 /* Depends on a guard being met. */
56 #define MVM_SPESH_FACT_HASH_ITER 512 /* Is an iter over hashes. */
57 #define MVM_SPESH_FACT_ARRAY_ITER 1024 /* Is an iter over arrays
58 (mutually exclusive with HASH_ITER, but neither of them is nece ssarily set) */
59 #define MVM_SPESH_FACT_KNOWN_BOX_SRC 2048 /* We know what register this value was boxed from */
60 #define MVM_SPESH_FACT_MERGED_WITH_LOG_GUARD 4096 /* These facts were merged at a PHI node, but at least one of the incoming facts had a "from log guard" flag set, so we'll have to look for that fact and increment its uses if we u se this here fact. */
61 #define MVM_SPESH_FACT_RW_CONT 8192 /* Known to be an rw container */
62
63 void MVM_spesh_facts_discover(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshPlanned *p);
64 void MVM_spesh_facts_depend(MVMThreadContext *tc, MVMSpeshGraph *g,
65 MVMSpeshFacts *target, MVMSpeshFacts *source);
66
67 ```
68
69
70 `spesh/graph.h`の箇所
71
72 ```
73 /* An instruction in the spesh graph. */
74 struct MVMSpeshIns {
75 /* Instruction information. */
76 const MVMOpInfo *info;
77
78 /* Operand information. */
79 MVMSpeshOperand *operands;
80
81 /* Previous and next instructions, within a basic block boundary. */
82 MVMSpeshIns *prev;
83 MVMSpeshIns *next;
84
85 /* Any annotations on the instruction. */
86 MVMSpeshAnn *annotations;
87 };
88
89 ```
90
91 `core/interp.h`
92
93 ```
94 /* Information about an opcode. */
95 struct MVMOpInfo {
96 MVMuint16 opcode;
97 const char *name;
98 char mark[2];
99 MVMuint16 num_operands;
100 MVMuint8 pure;
101 MVMuint8 deopt_point;
102 MVMuint8 logged;
103 MVMuint8 no_inline;
104 MVMuint8 jittivity;
105 MVMuint8 uses_hll;
106 MVMuint8 operands[MVM_MAX_OPERANDS];
107 };
108
109
110 ```