FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
daScript/include/daScript/simulate/debug_info.h at master · Xsankor/daScript · GitHub
Xsankor
/
daScript
Public
forked from
GaijinEntertainment/daScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
daScript
/
include
/
daScript
/
simulate
/
debug_info.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
407 lines (375 loc) · 14.4 KB
Breadcrumbs
daScript
/
include
/
daScript
/
simulate
/
debug_info.h
Copy path
File metadata and controls
407 lines (375 loc) · 14.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
#
pragma
once
namespace
das
{
#
ifndef
DAS_ENABLE_PROFILER
#
define
DAS_ENABLE_PROFILER
0
#
endif
enum
Type :
int32_t
{
none,
autoinfer,
alias,
fakeContext,
fakeLineInfo,
anyArgument,
tVoid,
tBool,
tInt8,
tUInt8,
tInt16,
tUInt16,
tInt64,
tUInt64,
tInt,
tInt2,
tInt3,
tInt4,
tUInt,
tUInt2,
tUInt3,
tUInt4,
tFloat,
tFloat2,
tFloat3,
tFloat4,
tDouble,
tRange,
tURange,
tString,
tStructure,
tHandle,
tEnumeration,
tEnumeration8,
tEnumeration16,
tBitfield,
tPointer,
tFunction,
tLambda,
tIterator,
tArray,
tTable,
tBlock,
tTuple,
tVariant
};
enum
class
RefMatters
{
no
, yes
};
enum
class
ConstMatters
{
no
, yes
};
enum
class
TemporaryMatters
{
no
, yes
};
enum
class
AllowSubstitute
{
no,
yes
};
template
<
typename
T>
struct
isCloneable
{
template
<
typename
U>
static
decltype
(declval<U&>() = declval<
const
U&>(), U (declval<
const
U&>()), true_type{}) func (
remove_reference_t
<U>*);
template
<
typename
U>
static
false_type
func
(...);
using
type =
decltype
(func<T>(
nullptr
));
static
constexpr
bool
value { type::value };
};
struct
StructInfo
;
struct
TypeAnnotation
;
struct
EnumInfo
;
struct
BasicAnnotation
: ptr_ref_count {
BasicAnnotation
(
const
string & n,
const
string & cpn =
"
"
) : name(n), cppName(cpn) {}
string name;
string cppName;
};
struct
FileInfo
{
public:
virtual
void
freeSourceData
() { }
virtual
~FileInfo
() {
freeSourceData
(); }
void
reserveProfileData
();
virtual
void
getSourceAndLength
(
const
char
* & src,
uint32_t
& len ) { src=
nullptr
; len=
0
; }
string name;
int32_t
tabSize =
4
;
#
if
DAS_ENABLE_PROFILER
public:
vector<
uint64_t
> profileData;
#
endif
};
typedef
unique_ptr<FileInfo> FileInfoPtr;
class
TextFileInfo
:
public
FileInfo
{
public:
TextFileInfo
(
const
char
* src,
uint32_t
len,
bool
own )
: source(src), sourceLength(len), owner(own) {}
virtual
~TextFileInfo
() {
if
( owner )
freeSourceData
(); }
virtual
void
freeSourceData
()
override
;
virtual
void
getSourceAndLength
(
const
char
* & src,
uint32_t
& len )
override
;
protected:
const
char
* source =
nullptr
;
uint32_t
sourceLength =
0
;
bool
owner =
true
;
};
struct
ModuleInfo
{
string moduleName;
string fileName;
string importName;
};
class
FileAccess
:
public
ptr_ref_count
{
public:
virtual
~FileAccess
() {}
void
reset
() { files.
clear
(); }
FileInfo *
setFileInfo
(
const
string & fileName, FileInfoPtr && info );
FileInfo *
getFileInfo
(
const
string & fileName );
virtual
bool
invalidateFileInfo
(
const
string & fileName );
virtual
string
getIncludeFileName
(
const
string & fileName,
const
string & incFileName )
const
;
void
freeSourceData
();
FileInfoPtr
letGoOfFileInfo
(
const
string & fileName );
virtual
ModuleInfo
getModuleInfo
(
const
string & req,
const
string & from )
const
;
virtual
bool
isModuleAllowed
(
const
string &,
const
string & )
const
{
return
true
; };
virtual
bool
addFsRoot
(
const
string & ,
const
string & ) {
return
false
; }
protected:
virtual
FileInfo *
getNewFileInfo
(
const
string & ) {
return
nullptr
; }
protected:
das_hash_map<string, FileInfoPtr> files;
};
typedef
smart_ptr<FileAccess> FileAccessPtr;
template
<>
struct
isCloneable
<FileAccess> : false_type {};
struct
SimFunction
;
class
Context
;
class
ModuleFileAccess
:
public
FileAccess
{
public:
ModuleFileAccess
();
ModuleFileAccess
(
const
string & pak,
const
FileAccessPtr & access );
virtual
~ModuleFileAccess
();
bool
failed
()
const
{
return
!context || !modGet; }
virtual
ModuleInfo
getModuleInfo
(
const
string & req,
const
string & from )
const
override
;
virtual
string
getIncludeFileName
(
const
string & fileName,
const
string & incFileName )
const
override
;
virtual
bool
isModuleAllowed
(
const
string &,
const
string & )
const
override
;
protected:
Context * context =
nullptr
;
SimFunction * modGet =
nullptr
;
SimFunction * includeGet =
nullptr
;
SimFunction * moduleAllowed =
nullptr
;
};
template
<>
struct
isCloneable
<ModuleFileAccess> : false_type {};
struct
LineInfo
{
LineInfo
() =
default
;
LineInfo
(FileInfo * fi,
int
c,
int
l,
int
lc,
int
ll)
: fileInfo(fi)
, column(
uint32_t
(c)), line(
uint32_t
(l))
, last_column(
uint32_t
(lc)), last_line(
uint32_t
(ll)) {}
bool
operator
< (
const
LineInfo & info )
const
;
bool
operator
== (
const
LineInfo & info )
const
;
bool
operator
!= (
const
LineInfo & info )
const
;
bool
inside
(
const
LineInfo & info )
const
;
bool
empty
()
const
;
string
describe
(
bool
fully =
false
)
const
;
FileInfo * fileInfo =
nullptr
;
uint32_t
column =
0
, line =
0
;
uint32_t
last_column =
0
, last_line =
0
;
static
LineInfo g_LineInfoNULL;
};
struct
LineInfoArg
: LineInfo {};
struct
TypeInfo
{
enum
{
flag_ref =
1
<<
0
,
flag_refType =
1
<<
1
,
flag_canCopy =
1
<<
2
,
flag_isPod =
1
<<
3
,
flag_isRawPod =
1
<<
4
,
flag_isConst =
1
<<
5
,
flag_isTemp =
1
<<
6
,
flag_isImplicit =
1
<<
7
,
flag_refValue =
1
<<
8
,
flag_hasInitValue =
1
<<
9
,
flag_isSmartPtr =
1
<<
10
,
flag_isSmartPtrNative =
1
<<
11
,
flag_isHandled =
1
<<
12
,
flag_heapGC =
1
<<
13
,
flag_stringHeapGC =
1
<<
14
,
flag_lockCheck =
1
<<
15
,
};
union
{
StructInfo * structType;
EnumInfo * enumType;
mutable
TypeAnnotation * annotation_or_name;
//
WARNING: unresolved. use 'getAnnotation'
};
TypeInfo * firstType;
//
map from, or array
TypeInfo * secondType;
//
map to
TypeInfo ** argTypes;
char
** argNames;
uint32_t
* dim;
uint64_t
hash;
Type type;
uint32_t
flags;
uint32_t
size;
uint32_t
argCount;
uint32_t
dimSize;
TypeInfo
() =
default
;
TypeInfo
( Type _type, StructInfo * _structType, EnumInfo * _enumType, TypeAnnotation * _annotation_or_name,
TypeInfo * _firstType, TypeInfo * _secondType, TypeInfo ** _argTypes,
char
** _argNames,
uint32_t
_argCount,
uint32_t
_dimSize,
uint32_t
* _dim,
uint32_t
_flags,
uint32_t
_size,
uint64_t
_hash ) {
type = _type;
if
( _structType ) { structType = _structType;
DAS_ASSERT
(!_enumType && !_annotation_or_name); }
else
if
( _enumType ) { enumType = _enumType;
DAS_ASSERT
(!_structType && !_annotation_or_name); }
else
{ annotation_or_name = _annotation_or_name;
DAS_ASSERT
(!_structType && !_enumType); }
firstType = _firstType;
secondType = _secondType;
argTypes = _argTypes;
argNames = _argNames;
argCount = _argCount;
dimSize = _dimSize;
dim = _dim;
flags = _flags;
size = _size;
hash = _hash;
}
__forceinline
bool
isRef
()
const
{
return
flags & flag_ref; }
__forceinline
bool
isRefType
()
const
{
return
flags & flag_refType; }
__forceinline
bool
isRefValue
()
const
{
return
flags & flag_refValue; }
__forceinline
bool
canCopy
()
const
{
return
flags & flag_canCopy; }
__forceinline
bool
isPod
()
const
{
return
flags & flag_isPod; }
__forceinline
bool
isRawPod
()
const
{
return
flags & flag_isRawPod; }
__forceinline
bool
isConst
()
const
{
return
flags & flag_isConst; }
__forceinline
bool
isTemp
()
const
{
return
flags & flag_isTemp; }
__forceinline
bool
isImplicit
()
const
{
return
flags & flag_isImplicit; }
__forceinline
bool
isSmartPtr
()
const
{
return
flags & flag_isSmartPtr; }
TypeAnnotation *
getAnnotation
()
const
;
};
struct
VarInfo
: TypeInfo {
union
{
vec4f value;
char
*
sValue
;
};
char
* name;
void
* annotation_arguments =
nullptr
;
uint32_t
offset;
VarInfo
() =
default
;
VarInfo
(Type _type, StructInfo * _structType, EnumInfo * _enumType, TypeAnnotation * _annotation_or_name,
TypeInfo * _firstType, TypeInfo * _secondType, TypeInfo ** _argTypes,
char
** _argNames,
uint32_t
_argCount,
uint32_t
_dimSize,
uint32_t
* _dim,
uint32_t
_flags,
uint32_t
_size,
uint64_t
_hash,
const
char
* _name,
uint32_t
_offset ) :
TypeInfo
(_type,_structType,_enumType,_annotation_or_name,
_firstType,_secondType,_argTypes,_argNames,_argCount,
_dimSize,_dim,_flags,_size,_hash) {
name = (
char
*) _name;
offset = _offset;
value =
v_zero
();
}
};
struct
StructInfo
{
enum
{
flag_class = (
1
<<
0
)
, flag_lambda = (
1
<<
1
)
, flag_heapGC = (
1
<<
2
)
, flag_stringHeapGC = (
1
<<
3
)
, flag_lockCheck = (
1
<<
4
)
};
char
* name;
char
* module_name;
VarInfo ** fields;
void
* annotation_list;
uint64_t
hash;
uint32_t
flags;
uint64_t
init_mnh;
uint32_t
count;
uint32_t
size;
StructInfo
() =
default
;
StructInfo
(
char
* _name,
char
* _module_name,
uint32_t
_flags, VarInfo ** _fields,
uint32_t
_count,
uint32_t
_size,
uint64_t
_init_mnh,
void
* _annotation_list,
uint64_t
_hash ) {
name = _name;
module_name = _module_name;
flags = _flags;
fields = _fields;
count = _count;
size = _size;
init_mnh = _init_mnh;
annotation_list = _annotation_list;
hash = _hash;
}
};
struct
EnumValueInfo
{
char
* name;
int64_t
value;
};
struct
EnumInfo
{
char
* name;
char
* module_name;
EnumValueInfo ** fields;
uint32_t
count;
uint64_t
hash;
};
struct
LocalVariableInfo
: TypeInfo {
LineInfo visibility;
char
* name;
uint32_t
stackTop;
union
{
struct
{
bool
cmres :
1
;
};
uint32_t
localFlags;
};
};
struct
FuncInfo
{
enum
{
flag_init = (
1
<<
0
)
, flag_builtin = (
1
<<
1
)
, flag_private = (
1
<<
2
)
, flag_shutdown = (
1
<<
3
)
};
char
* name;
char
* cppName;
VarInfo ** fields;
TypeInfo * result;
LocalVariableInfo ** locals;
uint64_t
hash;
uint32_t
flags;
uint32_t
count;
uint32_t
stackSize;
uint32_t
localCount;
FuncInfo
() =
default
;
FuncInfo
(
char
* _name,
char
* _cppName, VarInfo ** _fields,
uint32_t
_count,
uint32_t
_stackSize,
TypeInfo * _result, LocalVariableInfo ** _locals,
uint32_t
_localCount,
uint64_t
_hash,
uint32_t
_flags ) {
name = _name;
cppName = _cppName;
fields = _fields;
count = _count;
stackSize = _stackSize;
result = _result;
locals = _locals;
localCount = _localCount;
hash = _hash;
flags = _flags;
}
};
string
das_to_string
( Type t );
Type
nameToBasicType
(
const
string & name);
int
getTypeBaseSize
( Type type );
int
getTypeBaseAlign
( Type type );
int
getTypeBaseSize
( TypeInfo * info );
int
getDimSize
( TypeInfo * info );
int
getTypeSize
( TypeInfo * info );
int
getTypeAlign
( TypeInfo * info );
bool
isSameType
(
const
TypeInfo *
THIS
,
const
TypeInfo * decl, RefMatters refMatters, ConstMatters constMatters, TemporaryMatters temporaryMatters,
bool
topLevel );
bool
isCompatibleCast
(
const
StructInfo *
THIS
,
const
StructInfo * castS );
bool
isValidArgumentType
( TypeInfo * argType, TypeInfo * passType );
enum
class
PrintFlags
:
uint32_t
{
none =
0
, escapeString = (
1
<<
0
)
, namesAndDimensions = (
1
<<
1
)
, typeQualifiers = (
1
<<
2
)
, refAddresses = (
1
<<
3
)
, humanReadable = (
1
<<
4
)
, singleLine = (
1
<<
5
)
, fixedFloatingPoint = (
1
<<
6
)
, string_builder = PrintFlags::fixedFloatingPoint
, debugger = PrintFlags::escapeString | PrintFlags::namesAndDimensions
| PrintFlags::humanReadable | PrintFlags::typeQualifiers | PrintFlags::refAddresses | PrintFlags::fixedFloatingPoint
, stackwalker = PrintFlags::escapeString | PrintFlags::namesAndDimensions
| PrintFlags::typeQualifiers | PrintFlags::humanReadable | PrintFlags::fixedFloatingPoint
};
string
debug_type
(
const
TypeInfo * info );
string
getTypeInfoMangledName
( TypeInfo * info );
}
Back
|
FazBrowse Home
|
New Git URL