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
8f32698a
Commit
8f32698a
authored
May 12, 2016
by
Kunshan Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to disable sourceInfo
parent
092104b2
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
49 deletions
+93
-49
pythonbinding/libmu.py
pythonbinding/libmu.py
+4
-2
src/main/scala/uvm/ir/textinput/UIRTextReader.scala
src/main/scala/uvm/ir/textinput/UIRTextReader.scala
+72
-39
src/main/scala/uvm/refimpl/MicroVM.scala
src/main/scala/uvm/refimpl/MicroVM.scala
+2
-2
src/main/scala/uvm/refimpl/VMConf.scala
src/main/scala/uvm/refimpl/VMConf.scala
+5
-2
src/main/scala/uvm/refimpl/hail/HailScriptLoader.scala
src/main/scala/uvm/refimpl/hail/HailScriptLoader.scala
+4
-3
src/main/scala/uvm/utils/AntlrHelpers.scala
src/main/scala/uvm/utils/AntlrHelpers.scala
+6
-1
No files found.
pythonbinding/libmu.py
View file @
8f32698a
...
...
@@ -42,6 +42,7 @@ or::
globalSize = 4*1024*1024,
stackSize = 63*1024,
staticCheck = False,
sourceInfo = False,
gcLog = "WARN",
vmLog = "INFO",
)
...
...
@@ -1150,8 +1151,9 @@ class MuRefImpl2StartDLL(object):
losSize: large object space size (bytes, must be 4096-byte aligned)
globalSize: global space size (bytes, must be 4096-byte aligned)
stackSize: stack size (bytes)
staticCheck: enable or disable static checks ("true" or "false".
Python boolean values are also accepted.)
staticCheck: enable or disable static checks (bool)
sourceInfo: enable or disable source information (bool). Disable
this if the program is big.
vmLog: log level for the micro VM
gcLog: log level fof the garbage collector
...
...
src/main/scala/uvm/ir/textinput/UIRTextReader.scala
View file @
8f32698a
This diff is collapsed.
Click to expand it.
src/main/scala/uvm/refimpl/MicroVM.scala
View file @
8f32698a
...
...
@@ -48,8 +48,8 @@ class MicroVM(vmConf: VMConf) {
val
trapManager
=
new
TrapManager
()
val
contexts
=
new
HashSet
[
MuCtx
]()
val
irReader
=
new
UIRTextReader
(
new
IDFactory
(
MicroVM
.
FIRST_CLIENT_USABLE_ID
))
val
hailScriptLoader
=
new
HailScriptLoader
()
val
irReader
=
new
UIRTextReader
(
new
IDFactory
(
MicroVM
.
FIRST_CLIENT_USABLE_ID
)
,
recordSourceInfo
=
vmConf
.
sourceInfo
)
val
hailScriptLoader
=
new
HailScriptLoader
(
recordSourceInfo
=
vmConf
.
sourceInfo
)
val
staticAnalyzer
=
new
StaticAnalyzer
()
{
...
...
src/main/scala/uvm/refimpl/VMConf.scala
View file @
8f32698a
...
...
@@ -20,6 +20,7 @@ object VMConf {
var
globalSize
=
DEFAULT_CONF
.
globalSize
var
stackSize
=
DEFAULT_CONF
.
stackSize
var
staticCheck
=
DEFAULT_CONF
.
staticCheck
var
sourceInfo
=
DEFAULT_CONF
.
sourceInfo
confStr
.
lines
foreach
{
case
ReComment
()
=>
case
ReBlank
()
=>
...
...
@@ -30,13 +31,14 @@ object VMConf {
case
"globalSize"
=>
globalSize
=
value
.
toLong
case
"stackSize"
=>
stackSize
=
value
.
toLong
case
"staticCheck"
=>
staticCheck
=
value
.
toLowerCase
().
toBoolean
case
"sourceInfo"
=>
sourceInfo
=
value
.
toLowerCase
().
toBoolean
case
"vmLog"
=>
setLog
(
"uvm"
,
value
)
case
"gcLog"
=>
setLog
(
"uvm.refimpl.mem"
,
value
)
case
_
=>
throw
new
UvmRefImplException
(
"Unrecognized option %s"
.
format
(
key
))
}
}
}
new
VMConf
(
sosSize
,
losSize
,
globalSize
,
stackSize
,
staticCheck
)
new
VMConf
(
sosSize
,
losSize
,
globalSize
,
stackSize
,
staticCheck
,
sourceInfo
)
}
def
setLog
(
name
:
String
,
levelStr
:
String
)
:
Unit
=
{
...
...
@@ -56,5 +58,6 @@ class VMConf(
val
losSize
:
Word
=
MicroVM
.
DEFAULT_LOS_SIZE
,
val
globalSize
:
Word
=
MicroVM
.
DEFAULT_GLOBAL_SIZE
,
val
stackSize
:
Word
=
MicroVM
.
DEFAULT_STACK_SIZE
,
val
staticCheck
:
Boolean
=
true
)
val
staticCheck
:
Boolean
=
true
,
val
sourceInfo
:
Boolean
=
true
)
src/main/scala/uvm/refimpl/hail/HailScriptLoader.scala
View file @
8f32698a
...
...
@@ -27,7 +27,7 @@ object HailScriptLoader {
val
logger
=
Logger
(
LoggerFactory
.
getLogger
(
getClass
.
getName
))
}
class
HailScriptLoader
(
implicit
microVM
:
MicroVM
,
memorySupport
:
MemorySupport
)
{
class
HailScriptLoader
(
recordSourceInfo
:
Boolean
=
true
)(
implicit
microVM
:
MicroVM
,
memorySupport
:
MemorySupport
)
{
import
HailScriptLoader._
def
loadHail
(
hailScript
:
Reader
)
:
Unit
=
{
...
...
@@ -51,7 +51,7 @@ class HailScriptLoader(implicit microVM: MicroVM, memorySupport: MemorySupport)
}
val
mc
=
microVM
.
newContext
()
val
ihsl
=
new
InstanceHailScriptLoader
(
microVM
,
memorySupport
,
mc
,
hailScript
)
val
ihsl
=
new
InstanceHailScriptLoader
(
microVM
,
memorySupport
,
mc
,
hailScript
,
recordSourceInfo
)
try
{
ihsl
.
loadTopLevel
(
ast
)
}
finally
{
...
...
@@ -61,7 +61,8 @@ class HailScriptLoader(implicit microVM: MicroVM, memorySupport: MemorySupport)
}
}
class
InstanceHailScriptLoader
(
microVM
:
MicroVM
,
memorySupport
:
MemorySupport
,
mc
:
MuCtx
,
source
:
String
)
extends
AdvancedAntlrHelper
{
class
InstanceHailScriptLoader
(
microVM
:
MicroVM
,
memorySupport
:
MemorySupport
,
mc
:
MuCtx
,
source
:
String
,
val
recordSourceInfo
:
Boolean
)
extends
AdvancedAntlrHelper
{
import
HailScriptLoader._
val
sourceLines
=
source
.
lines
.
toIndexedSeq
...
...
src/main/scala/uvm/utils/AntlrHelpers.scala
View file @
8f32698a
...
...
@@ -8,6 +8,8 @@ import org.antlr.v4.runtime.tree.TerminalNode
import
org.antlr.v4.runtime.ParserRuleContext
import
org.antlr.v4.runtime.Token
import
uvm.TextSourceInfo
import
uvm.NoSourceInfo
import
uvm.SourceInfo
object
AntlrHelpers
{
class
AccumulativeAntlrErrorListener
(
source
:
String
)
extends
BaseErrorListener
{
...
...
@@ -30,8 +32,9 @@ object AntlrHelpers {
trait
AdvancedAntlrHelper
{
def
sourceLines
:
IndexedSeq
[
String
]
def
recordSourceInfo
:
Boolean
def
toSourceInfo
(
ctx
:
ParserRuleContext
)
:
TextSourceInfo
=
{
def
toSourceInfo
(
ctx
:
ParserRuleContext
)
:
SourceInfo
=
if
(
recordSourceInfo
)
{
val
tok1
=
ctx
.
getStart
val
tok2
=
ctx
.
getStop
val
line
=
tok1
.
getLine
()
-
1
...
...
@@ -44,6 +47,8 @@ trait AdvancedAntlrHelper {
val
near
=
tok1
.
getText
()
new
TextSourceInfo
(
line
,
column
,
end
,
near
,
theLine
)
}
else
{
NoSourceInfo
}
def
inCtx
(
ctx
:
ParserRuleContext
,
s
:
String
)
:
String
=
{
...
...
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