aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-04 19:52:51 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-04 20:25:22 +0200
commit4ee497d22e8872462ee1aad5aa96b68e27b4657e (patch)
tree019349c74acb1dfc4af1a580a9cba9ad31945358 /pkg
parent8c64b078d1c954972b9f0132a753cdcec1b80d9b (diff)
pkg/compiler: use correct arch ptr size
Diffstat (limited to 'pkg')
-rw-r--r--pkg/compiler/compiler.go4
-rw-r--r--pkg/compiler/compiler_test.go6
2 files changed, 5 insertions, 5 deletions
diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go
index fe3f28d77..f08a32987 100644
--- a/pkg/compiler/compiler.go
+++ b/pkg/compiler/compiler.go
@@ -43,14 +43,14 @@ type Prog struct {
}
// Compile compiles sys description.
-func Compile(desc *ast.Description, consts map[string]uint64, eh ast.ErrorHandler) *Prog {
+func Compile(desc *ast.Description, consts map[string]uint64, ptrSize uint64, eh ast.ErrorHandler) *Prog {
if eh == nil {
eh = ast.LoggingHandler
}
comp := &compiler{
desc: ast.Clone(desc),
eh: eh,
- ptrSize: 8, // TODO(dvyukov): must be provided by target
+ ptrSize: ptrSize,
unsupported: make(map[string]bool),
resources: make(map[string]*ast.Resource),
structs: make(map[string]*ast.Struct),
diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go
index 130c1fe5d..08fb9a9b9 100644
--- a/pkg/compiler/compiler_test.go
+++ b/pkg/compiler/compiler_test.go
@@ -24,7 +24,7 @@ func TestCompileAll(t *testing.T) {
if consts == nil {
t.Fatalf("reading consts failed")
}
- prog := Compile(desc, consts, eh)
+ prog := Compile(desc, consts, 8, eh)
if prog == nil {
t.Fatalf("compilation failed")
}
@@ -47,7 +47,7 @@ func TestErrors(t *testing.T) {
t.Fatalf("parsing failed")
}
ExtractConsts(desc, em.ErrorHandler)
- Compile(desc, consts, em.ErrorHandler)
+ Compile(desc, consts, 8, em.ErrorHandler)
em.Check(t)
})
}
@@ -67,7 +67,7 @@ func TestFuzz(t *testing.T) {
for _, data := range inputs {
desc := ast.Parse([]byte(data), "", eh)
if desc != nil {
- Compile(desc, consts, eh)
+ Compile(desc, consts, 8, eh)
}
}
}