Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
sapl-interpreter
Commits
6a42ac1c
Commit
6a42ac1c
authored
Dec 28, 2015
by
Laszlo Domoszlai
Browse files
clean up
parent
5bf5b0ce
Changes
5
Hide whitespace changes
Inline
Side-by-side
interpreter/code.c
View file @
6a42ac1c
...
...
@@ -95,10 +95,17 @@ struct Thunk* create_thunk_var_unboxed(Code* expr, int frame_ptr)
{
Thunk
*
arg
=
local
(
frame_ptr
,
((
VarEntry
*
)
expr
)
->
index
);
// TODO: check if its on heap
Thunk
*
target
=
(
Thunk
*
)
alloc_heap
(
sizeof
(
Thunk
));
memcpy
(
target
,
arg
,
sizeof
(
Thunk
));
return
target
;
if
(
instackb
(
arg
))
{
// The likely case
Thunk
*
target
=
(
Thunk
*
)
alloc_heap
(
sizeof
(
Thunk
));
memcpy
(
target
,
arg
,
sizeof
(
Thunk
));
return
target
;
}
else
{
return
arg
;
}
}
struct
Thunk
*
create_thunk_thunk
(
Code
*
expr
,
int
frame_ptr
)
...
...
@@ -320,7 +327,7 @@ void exec(Code* expr, int frame_ptr, int root_frame_ptr)
thunk
=
(
Thunk
*
)
alloc_heap
(
newsize
);
set_return
(
root_frame_ptr
,
thunk
);
}
else
if
(
newsize
<
sizeof
(
Thunk
)
||
thunk
->
desc
->
thunk_size
<
newsize
)
{
else
if
(
thunk
->
desc
->
thunk_size
<
newsize
)
{
Thunk
*
target
=
thunk
;
thunk
=
(
Thunk
*
)
alloc_heap
(
newsize
);
target
->
desc
=
(
Desc
*
)
__FORWARD_PTR__
;
...
...
interpreter/desc.c
View file @
6a42ac1c
...
...
@@ -108,11 +108,7 @@ void init_desc() {
__REAL_SHARED__
=
alloc_prim
(
"REAL"
,
0
);
__STRING__
=
alloc_prim
(
"STRING"
,
0
);
__ARRAY__
=
alloc_prim
(
"ARRAY"
,
0
);
// Avoid to be overwritten by updateF
__STACK_PLACEHOLDER__
=
alloc_prim
(
"PLACEHOLDER"
,
0
);
__STACK_PLACEHOLDER__
->
base
.
thunk_size
=
0
;
__ARRAY__
=
alloc_prim
(
"ARRAY"
,
0
);
}
struct
FunEntry
*
__INT__
;
...
...
@@ -128,5 +124,4 @@ struct FunEntry* __STRING__;
struct
FunEntry
*
__ARRAY__
;
struct
FunEntry
*
__FORWARD_PTR__
;
struct
FunEntry
*
__STACK_PLACEHOLDER__
;
interpreter/desc.h
View file @
6a42ac1c
...
...
@@ -84,6 +84,5 @@ extern struct FunEntry* __STRING__;
extern
struct
FunEntry
*
__ARRAY__
;
extern
struct
FunEntry
*
__FORWARD_PTR__
;
extern
struct
FunEntry
*
__STACK_PLACEHOLDER__
;
#endif // __DESC_H
\ No newline at end of file
interpreter/main.c
View file @
6a42ac1c
...
...
@@ -85,7 +85,7 @@ int main ( int argc, char *argv[] )
#endif
Thunk
*
res
=
alloc_b
();
res
->
desc
=
(
Desc
*
)
__
STACK_PLACEHOLDER__
;
res
->
desc
=
(
Desc
*
)
__
INT__
;
// does not matter, but should be a proper descriptor
push_a
(
res
);
exec
(
expr
,
stack_top_a
,
stack_top_a
);
...
...
interpreter/thunk.c
View file @
6a42ac1c
...
...
@@ -59,8 +59,6 @@ void print(bool force) {
}
}
else
if
((
FunEntry
*
)
thunk
->
desc
==
__CHAR__
||
(
FunEntry
*
)
thunk
->
desc
==
__CHAR_SHARED__
)
{
printf
(
"%c"
,
thunk
->
_char
);
}
else
if
((
FunEntry
*
)
thunk
->
desc
==
__STACK_PLACEHOLDER__
)
{
printf
(
"STACKPLACEHOLDER"
);
}
else
{
printf
(
"print: unhandled BOXED LIT
\n
"
);
printDesc
(
thunk
->
desc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment