Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs444
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xun Yang
cs444
Commits
8ba08dc8
Commit
8ba08dc8
authored
5 years ago
by
pycsham
Browse files
Options
Downloads
Patches
Plain Diff
fixed issue with method invocation. the J1_basicTest (static method invocation) now works
parent
de30d33c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CodeGenUtils.py
+4
-10
4 additions, 10 deletions
CodeGenUtils.py
Tests/A5/J1_basicTest.java
+4
-4
4 additions, 4 deletions
Tests/A5/J1_basicTest.java
with
8 additions
and
14 deletions
CodeGenUtils.py
+
4
−
10
View file @
8ba08dc8
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
# String, String, String/None, String/None
# String, String, String/None, String/None
def
p
(
instruction
,
arg1
,
arg2
=
""
,
comment
=
""
):
def
p
(
instruction
,
arg1
,
arg2
=
""
,
comment
=
""
):
result
=
"
"
+
instruction
+
"
"
+
str
(
arg1
)
result
=
"
"
+
instruction
+
"
"
+
str
(
arg1
)
if
arg2
:
if
arg2
or
arg2
==
0
:
result
+=
"
,
"
+
arg2
result
+=
"
,
"
+
str
(
arg2
)
if
comment
:
if
comment
:
result
+=
"
;
"
+
comment
result
+=
"
;
"
+
comment
return
result
+
"
\n
"
return
result
+
"
\n
"
...
@@ -65,14 +65,8 @@ def genProcedure(content, comment):
...
@@ -65,14 +65,8 @@ def genProcedure(content, comment):
# Adds method invoke prologue and eilogie around the content
# Adds method invoke prologue and eilogie around the content
def
genMethodInvoke
(
method
):
def
genMethodInvoke
(
method
):
pro
=
"
;Calling a method
"
+
method
+
"
\n
"
\
pro
=
"
;Calling a method
"
+
method
+
"
\n
"
\
+
p
(
instruction
=
"
push
"
,
arg1
=
"
eax
"
,
comment
=
"
saving caller-save register eax
"
)
\
+
p
(
instruction
=
"
push
"
,
arg1
=
"
ecx
"
,
comment
=
"
saving caller-save register ecx
"
)
\
epi
=
"
; End of method invocation
\n
"
+
p
(
instruction
=
"
push
"
,
arg1
=
"
edx
"
,
comment
=
"
saving caller-save register edx
"
)
epi
=
p
(
instruction
=
"
pop
"
,
arg1
=
"
edx
"
,
comment
=
"
restoring caller-save register edx
"
)
\
+
p
(
instruction
=
"
pop
"
,
arg1
=
"
ecx
"
,
comment
=
"
restoring caller-save register ecx
"
)
\
+
p
(
instruction
=
"
pop
"
,
arg1
=
"
eax
"
,
comment
=
"
restoring caller-save register eax
"
)
\
+
"
; End of method invocation
\n
"
return
(
pro
,
epi
)
return
(
pro
,
epi
)
...
...
This diff is collapsed.
Click to expand it.
Tests/A5/J1_basicTest.java
+
4
−
4
View file @
8ba08dc8
...
@@ -3,12 +3,12 @@ public class J1_basicTest {
...
@@ -3,12 +3,12 @@ public class J1_basicTest {
public
J1_basicTest
()
{}
public
J1_basicTest
()
{}
public
static
int
test
()
{
public
static
int
test
()
{
return
J1_basicTest
.
test2
();
}
public
static
int
test2
(){
if
(
true
)
if
(
true
)
return
123
;
return
123
;
return
7
;
return
7
;
}
}
public
static
void
test2
(){
J1_basicTest
.
test
();
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment