Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-ref2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
mu
mu-impl-ref2
Commits
55fdbd3c
Commit
55fdbd3c
authored
Apr 15, 2016
by
Kunshan Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run static analyzer by default.
Now MicroVM runs the static analyzer when adding any bundles.
parent
f31651a4
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
19 additions
and
33 deletions
+19
-33
src/main/scala/uvm/comminsts/comminsts.scala
src/main/scala/uvm/comminsts/comminsts.scala
+4
-4
src/main/scala/uvm/refimpl/MicroVM.scala
src/main/scala/uvm/refimpl/MicroVM.scala
+4
-0
src/main/scala/uvm/ssavariables/ssavariables.scala
src/main/scala/uvm/ssavariables/ssavariables.scala
+6
-2
src/main/scala/uvm/staticanalysis/StaticAnalyzer.scala
src/main/scala/uvm/staticanalysis/StaticAnalyzer.scala
+1
-7
src/test/scala/uvm/staticanalysis/StaticAnalysisTest.scala
src/test/scala/uvm/staticanalysis/StaticAnalysisTest.scala
+0
-16
tests/uvm-refimpl-test/futex-tests.uir
tests/uvm-refimpl-test/futex-tests.uir
+1
-1
tests/uvm-refimpl-test/osr-tests.uir
tests/uvm-refimpl-test/osr-tests.uir
+1
-1
tests/uvm-refimpl-test/primitives.uir
tests/uvm-refimpl-test/primitives.uir
+1
-1
tests/uvm-refimpl-test/simple-sum.uir
tests/uvm-refimpl-test/simple-sum.uir
+1
-1
No files found.
src/main/scala/uvm/comminsts/comminsts.scala
View file @
55fdbd3c
...
...
@@ -2,18 +2,18 @@ package uvm.comminsts
import
uvm._
case
class
CommInst
(
val
id
:
Int
,
val
name
:
Option
[
String
])
extends
Identified
case
class
CommInst
(
val
id
:
Int
,
val
name
:
Option
[
String
]
,
val
isTerminator
:
Boolean
)
extends
Identified
object
CommInsts
extends
SimpleNamespace
[
CommInst
]
{
private
def
commInst
(
id
:
Int
,
name
:
String
)
{
val
ci
=
CommInst
(
id
,
Some
(
name
))
private
def
commInst
(
id
:
Int
,
name
:
String
,
isTerminator
:
Boolean
=
false
)
{
val
ci
=
CommInst
(
id
,
Some
(
name
)
,
isTerminator
)
add
(
ci
)
}
commInst
(
0x201
,
"@uvm.new_stack"
)
commInst
(
0x202
,
"@uvm.kill_stack"
)
commInst
(
0x203
,
"@uvm.thread_exit"
)
commInst
(
0x203
,
"@uvm.thread_exit"
,
isTerminator
=
true
)
commInst
(
0x204
,
"@uvm.current_stack"
)
commInst
(
0x211
,
"@uvm.tr64.is_fp"
)
...
...
src/main/scala/uvm/refimpl/MicroVM.scala
View file @
55fdbd3c
...
...
@@ -10,6 +10,7 @@ import uvm.refimpl.itpr._
import
uvm.refimpl.mem._
import
uvm.refimpl.mem.TypeSizes.Word
import
uvm.refimpl.nat.NativeCallHelper
import
uvm.staticanalysis.StaticAnalyzer
object
MicroVM
{
val
DEFAULT_HEAP_SIZE
:
Word
=
4L
*
1024L
*
1024L
;
// 4MiB
...
...
@@ -41,6 +42,7 @@ class MicroVM(heapSize: Word = MicroVM.DEFAULT_HEAP_SIZE,
val
irReader
=
new
UIRTextReader
(
new
IDFactory
(
MicroVM
.
FIRST_CLIENT_USABLE_ID
))
val
hailScriptLoader
=
new
HailScriptLoader
()
val
staticAnalyzer
=
new
StaticAnalyzer
()
{
// VOID, BYTE, BYTE_ARRAY: The micro VM allocates stacks on the heap in the large object space.
...
...
@@ -66,6 +68,8 @@ class MicroVM(heapSize: Word = MicroVM.DEFAULT_HEAP_SIZE,
* Add things from a bundle to the Micro VM.
*/
def
addBundle
(
bundle
:
TrantientBundle
)
{
staticAnalyzer
.
checkBundle
(
bundle
,
Some
(
globalBundle
))
globalBundle
.
merge
(
bundle
);
for
(
gc
<-
bundle
.
globalCellNs
.
all
)
{
...
...
src/main/scala/uvm/ssavariables/ssavariables.scala
View file @
55fdbd3c
...
...
@@ -255,8 +255,12 @@ case class InstCCall(var callConv: Flag, var funcTy: Type, var sig: FuncSig, var
case
class
InstNewThread
(
var
stack
:
SSAVariable
,
var
newStackAction
:
NewStackAction
,
var
excClause
:
Option
[
ExcClause
])
extends
Instruction
with
HasExcClause
case
class
InstSwapStack
(
var
swappee
:
SSAVariable
,
var
curStackAction
:
CurStackAction
,
var
newStackAction
:
NewStackAction
,
var
excClause
:
Option
[
ExcClause
],
var
keepAlives
:
Seq
[
LocalVariable
])
extends
HasExcClause
with
HasKeepAliveClause
with
OSRPoint
var
excClause
:
Option
[
ExcClause
],
var
keepAlives
:
Seq
[
LocalVariable
])
extends
HasExcClause
with
HasKeepAliveClause
with
OSRPoint
{
override
def
canTerminate
:
Boolean
=
curStackAction
==
KillOld
()
||
excClause
.
isDefined
}
case
class
InstCommInst
(
var
inst
:
CommInst
,
var
flagList
:
Seq
[
Flag
],
var
typeList
:
Seq
[
Type
],
var
funcSigList
:
Seq
[
FuncSig
],
var
argList
:
Seq
[
SSAVariable
],
var
excClause
:
Option
[
ExcClause
],
var
keepAlives
:
Seq
[
LocalVariable
])
extends
HasTypeList
with
HasArgList
with
HasExcClause
with
HasKeepAliveClause
extends
HasTypeList
with
HasArgList
with
HasExcClause
with
HasKeepAliveClause
{
override
def
canTerminate
:
Boolean
=
excClause
.
isDefined
||
inst
.
isTerminator
}
src/main/scala/uvm/staticanalysis/StaticAnalyzer.scala
View file @
55fdbd3c
...
...
@@ -245,6 +245,7 @@ class StaticAnalyzer {
pretty
=
Seq
(
g
,
ty
))
case
ty
:
TypeHybrid
=>
throw
error
(
"Global cell %s: Global cell cannot have hybrid type."
.
format
(
g
.
repr
),
pretty
=
Seq
(
g
,
ty
))
case
_
=>
}
}
}
...
...
@@ -328,13 +329,6 @@ class StaticAnalyzer {
.
format
(
fv
.
repr
,
bb
.
repr
,
lastInst
.
repr
,
destBB
.
repr
,
dest
),
pretty
=
Seq
(
lastInst
,
destBB
))
}
}
else
{
if
(!
destBB
.
excParam
.
isDefined
)
{
throw
error
((
"FuncVer %s BB %s Inst %s: Exceptional destination %s must have exceptional parameter.\n"
+
"DestClause: %s"
)
.
format
(
fv
.
repr
,
bb
.
repr
,
lastInst
.
repr
,
destBB
.
repr
,
dest
),
pretty
=
Seq
(
lastInst
,
destBB
))
}
}
}
}
...
...
src/test/scala/uvm/staticanalysis/StaticAnalysisTest.scala
View file @
55fdbd3c
...
...
@@ -255,22 +255,6 @@ class StaticAnalysisTest extends FlatSpec with Matchers {
"""
)
}
it
should
"complain if an exceptional dest does not have exc param"
in
{
catchExceptionWhenAnalyzing
(
"""
.typedef @i32 = int<32>
.const @1 <@i32> = 1
.funcsig @sig = () -> ()
.funcdef @f VERSION %v1 <@sig> {
%entry():
CALL <@sig> @f () EXC(%b1() %b2())
%b1():
RET ()
%b2():
RET ()
}
"""
)
}
it
should
"complain if a normal dest has exc param"
in
{
catchExceptionWhenAnalyzing
(
"""
.typedef @i32 = int<32>
...
...
tests/uvm-refimpl-test/futex-tests.uir
View file @
55fdbd3c
...
...
@@ -81,7 +81,7 @@
%wait_body(<@thread> %nt <@thread> %nt2):
%rv = [%trap_wait] TRAP <@i32> KEEPALIVE (%nt %nt2)
%is_1 = EQ <@i32> %rv @I32_1
BRANCH2 %is_1 %wait_exit() %wait_body()
BRANCH2 %is_1 %wait_exit() %wait_body(
%nt %nt2
)
%wait_exit():
%nwakes = COMMINST @uvm.futex.cmp_requeue <@i32> (@the_futex @the_other_futex @I32_0 @I32_1)
...
...
tests/uvm-refimpl-test/osr-tests.uir
View file @
55fdbd3c
...
...
@@ -68,7 +68,7 @@
.const @I64_42 <@i64> = 42
.funcdef @forty_two_returner VERSION %v1 <@v_
i
> {
.funcdef @forty_two_returner VERSION %v1 <@v_
v
> {
%entry():
RET @I64_42
}
...
...
tests/uvm-refimpl-test/primitives.uir
View file @
55fdbd3c
...
...
@@ -143,7 +143,7 @@
.const @D_40 <@double> = 40.0d
.const @D_50 <@double> = 50.0d
.const @D_100 <@double> = 100.0d
.const @D_NAN <@
float
> = nand
.const @D_NAN <@
double
> = nand
.const @4xI32_V1 <@4xi32> = {@I32_0 @I32_1 @I32_2 @I32_3}
.const @4xI32_V2 <@4xi32> = {@I32_4 @I32_5 @I32_6 @I32_7}
...
...
tests/uvm-refimpl-test/simple-sum.uir
View file @
55fdbd3c
// require "primitives.uir"
.funcsig @simplesum_sig = (@i64 @i64) -> (
@void
)
.funcsig @simplesum_sig = (@i64 @i64) -> ()
.funcdef @simplesum VERSION @simplesum_v1 <@simplesum_sig> {
%entry (<@i64> %from <@i64> %to):
[%starttrap] TRAP <>
...
...
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