FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
daScript/src/simulate/standalone_ctx_utils.cpp at master · nolankramer/daScript · GitHub
nolankramer
/
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
/
src
/
simulate
/
standalone_ctx_utils.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (53 loc) · 2.26 KB
Breadcrumbs
daScript
/
src
/
simulate
/
standalone_ctx_utils.cpp
Copy path
File metadata and controls
57 lines (53 loc) · 2.26 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
#
include
<
daScript/simulate/standalone_ctx_utils.h
>
namespace
das
{
MangledNameHash
InitAotFunction
(
const
Context &ctx, SimFunction* gfun,
const
FunctionInfo &info) {
auto
MNH
=
hash_blockz64
((
uint8_t
*)info.
mangledName
.
c_str
());
gfun->
name
= ctx.
code
->
allocateName
(info.
name
);
gfun->
mangledName
= ctx.
code
->
allocateName
(info.
mangledName
);
gfun->
stackSize
=
uint32_t
(info.
stackSize
);
gfun->
mangledNameHash
=
MNH
;
gfun->
aotFunction
=
nullptr
;
gfun->
flags
=
0
;
gfun->
fastcall
= info.
fastCall
;
gfun->
unsafe
= info.
unsafeOperation
;
gfun->
cmres
= info.
res_ref
;
gfun->
builtin
= info.
builtin
&& !info.
promoted
;
gfun->
pinvoke
= info.
pinvoke
;
return
MNH
;
}
SizeDiff
InitGlobalVariable
(
const
Context &ctx, GlobalVariable* gvar,
const
GlobalVarInfo &info) {
gvar->
name
= ctx.
code
->
allocateName
(info.
name
);
gvar->
size
= info.
typeSize
;
const
auto
sizeDiff = (
uint64_t
(gvar->
size
) +
0xful
) & ~
0xfull
;
gvar->
flags
=
0
;
gvar->
mangledNameHash
= info.
mangledNameHash
;
gvar->
init
=
nullptr
;
if
( info.
globalShared
) {
gvar->
offset
= (
uint32_t
) ctx.
getSharedSize
();
gvar->
shared
=
true
;
return
{sizeDiff,
0
};
}
else
{
gvar->
offset
= (
uint32_t
) ctx.
getGlobalSize
();
return
{
0
, sizeDiff};
}
}
void
InitGlobalVar
(Context &ctx, GlobalVariable *gvar,
const
GlobalVarInfo &info) {
auto
sizeDiff =
InitGlobalVariable
(ctx, gvar, info);
ctx.
updateSharedGlobalSize
(sizeDiff.
sharedSizeDiff
, sizeDiff.
globalsSizeDiff
);
}
void
FillFunction
(Context &ctx,
const
AotLibrary &aotLib, vector<pair<
uint64_t
, SimFunction*>> &functions) {
for
(
auto
[semHash, fn]: functions) {
auto
it = aotLib.
find
(semHash);
if
( it != aotLib.
end
() ) {
fn->
code
= (it->
second
)(ctx);
fn->
aot
=
true
;
auto
fcb = (SimNode_CallBase *) fn->
code
;
fn->
aotFunction
= fcb->
aotFunction
;
(*ctx.
tabMnLookup
)[fn->
mangledNameHash
] = fn;
}
else
if
(!fn->
builtin
) {
//
Can't fill noAot functions.
DAS_ASSERT
(
false
);
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL