Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
abc-interpreter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
abc-interpreter
Commits
70b8e92a
Verified
Commit
70b8e92a
authored
May 08, 2019
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ccall arguments to bytecode
parent
7f3fe2ca
Pipeline
#28908
failed with stages
in 1 minute and 44 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
src/abc_instructions.c
src/abc_instructions.c
+1
-1
src/bcgen_instructions.c
src/bcgen_instructions.c
+33
-3
No files found.
src/abc_instructions.c
View file @
70b8e92a
...
...
@@ -141,7 +141,7 @@ const char *instruction_type (BC_WORD i) {
case
Cbuild_u31
:
return
"l"
;
case
Cbuild_ua1
:
return
"nl"
;
case
CcatAC
:
return
""
;
case
Cccall
:
return
""
;
case
Cccall
:
return
"
ss
"
;
case
Ccentry
:
return
""
;
case
CcmpAC
:
return
""
;
case
CcosR
:
return
""
;
...
...
src/bcgen_instructions.c
View file @
70b8e92a
...
...
@@ -891,6 +891,15 @@ void add_instruction_internal_label(int16_t i,struct label *label) {
store_code_internal_label_value
(
label
,
0
);
}
void
add_instruction_internal_label_internal_label
(
int16_t
i
,
struct
label
*
label1
,
struct
label
*
label2
)
{
if
(
list_code
||
i
>
max_implemented_instruction_n
)
printf
(
"%d
\t
%s %d %d
\n
"
,
pgrm
.
code_size
,
instruction_name
(
i
),
label1
->
label_offset
,
label2
->
label_offset
);
store_code_elem
(
BYTEWIDTH_INSTRUCTION
,
i
);
store_code_internal_label_value
(
label1
,
0
);
store_code_internal_label_value
(
label2
,
0
);
}
void
add_instruction_w_internal_label_label
(
int16_t
i
,
int32_t
n1
,
struct
label
*
label
,
char
*
label_name
)
{
if
(
list_code
||
i
>
max_implemented_instruction_n
)
printf
(
"%d
\t
%s %d %d %s
\n
"
,
pgrm
.
code_size
,
instruction_name
(
i
),
n1
,
label
->
label_offset
,
label_name
);
...
...
@@ -3699,9 +3708,30 @@ void code_buildo2(char code_name[],int a_offset1,int a_offset2) {
add_instruction_w_w_label
(
Cbuildo2
,
-
a_offset1
,
-
a_offset2
,
code_name
);
}
void
code_ccall
(
char
*
c_function_name
,
char
*
s
,
int
length
)
{
unsupported_instruction_warning
(
Cccall
);
add_instruction
(
Cccall
);
void
code_ccall
(
char
*
c_function_name
,
char
*
type
,
int
type_length
)
{
fprintf
(
stderr
,
"Warning: ccall %s will not be packaged into the bytecode
\n
"
,
c_function_name
);
struct
label
*
function_label
;
function_label
=
new_internal_label
();
function_label
->
label_offset
=
(
pgrm
.
data_size
<<
2
)
+
1
;
store_string
(
c_function_name
,
strlen
(
c_function_name
),
0
);
struct
label
*
type_label
;
type_label
=
new_internal_label
();
type_label
->
label_offset
=
(
pgrm
.
data_size
<<
2
)
+
1
;
for
(
int
i
=
0
;
i
<
type_length
;
i
++
)
{
switch
(
type
[
i
])
{
case
'-'
:
type
[
i
]
=
':'
;
break
;
case
':'
:
break
;
case
'p'
:
type
[
i
]
=
'I'
;
break
;
case
'I'
:
break
;
default:
fprintf
(
stderr
,
"Warning: '%c' type in ccall for %s not supported by interpreter
\n
"
,
type
[
i
],
c_function_name
);
}
}
store_string
(
type
,
type_length
,
0
);
add_instruction_internal_label_internal_label
(
Cccall
,
function_label
,
type_label
);
}
void
code_centry
(
char
*
c_function_name
,
char
*
clean_function_label
,
char
*
s
,
int
length
)
{
...
...
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