Skip to content

Commit

Permalink
Merge #722
Browse files Browse the repository at this point in the history
722: perf(compiler): Copy elements directly into arena r=Marwes a=Marwes

bors r+

Co-authored-by: Markus Westerlind <[email protected]>
  • Loading branch information
bors[bot] and Marwes committed Apr 30, 2019
2 parents 59d9d86 + a1373b0 commit ca8528c
Show file tree
Hide file tree
Showing 16 changed files with 296 additions and 143 deletions.
45 changes: 24 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ collect-mac = "0.1.0"
either = "1.0.0"
itertools = "0.8"
futures = "0.1.11"
codespan = "0.2"
codespan-reporting = "0.2"
codespan = "0.3"
codespan-reporting = "0.3"

serde = { version = "1.0.0", optional = true }
serde_state = { version = "0.4.0", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ collect-mac = "0.1.0"
anymap = "0.12.0"
itertools = "0.8"
ordered-float = "1"
codespan = "0.2"
codespan-reporting = "0.2"
codespan = "0.3"
codespan-reporting = "0.3"
either = "1"
stable_deref_trait = "1"
vec_map = "0.8"
Expand Down
4 changes: 2 additions & 2 deletions check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ rpds = "0.5"
stable_deref_trait = "1"
quick-error = "1"

codespan = "0.2"
codespan-reporting = "0.2"
codespan = "0.3"
codespan-reporting = "0.3"

strsim = "0.8.0"

Expand Down
12 changes: 12 additions & 0 deletions check/tests/fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,10 @@ Types do not match:
Expected: Int -> a
Found: ()
- <test>:2:4
|
2 | () 1
| ^
|
- Attempted to call a non-function value
"#
);
Expand All @@ -429,8 +431,10 @@ Row labels do not match.
Expected: A
Found: B
- <test>:5:11
|
5 | eq (A 0) (B 0.0)
| ^^^^^
|
"#
);
}
Expand All @@ -454,8 +458,10 @@ Found: { x : Int }
1 errors were found during unification:
The type `()` lacks the following fields: x
- <test>:4:7
|
4 | f { } { x = 1 }
| ^^^^^^^^^
|
"#
);
}
Expand All @@ -482,8 +488,10 @@ f (Test (Test 1))
&*format!("{}", result.unwrap_err()).replace("\t", " "),
r#"error: Implicit parameter with type `test.Eq Int` could not be resolved.
- <test>:11:3
|
11 | f (Test (Test 1))
| ^^^^^^^^^^^^^^^
|
- Required because of an implicit parameter of `[test.Eq Int] -> test.Eq (test.Test Int)`
- Required because of an implicit parameter of `[test.Eq (test.Test Int)] -> test.Eq (test.Test (test.Test Int))`
"#,
Expand Down Expand Up @@ -704,8 +712,10 @@ Types do not match:
Expected: Int -> Float -> a
Found: String
- <test>:3:7
|
3 | id "" 1 1.0
| ^^^^^
|
- Attempted to call function with 3 arguments but its type only has 1
"#
);
Expand Down Expand Up @@ -738,8 +748,10 @@ Types do not match:
Expected: Int -> Int -> a
Found: test.Eff [| | r |] Int
- <test>:10:3
|
10 | f x 1
| ^
|
"#
);
}
Expand Down
2 changes: 1 addition & 1 deletion completion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ documentation = "https://docs.rs/gluon"
either = "1.0.0"
itertools = "0.8"
walkdir = "2"
codespan = "0.2"
codespan = "0.3"

gluon_base = { path = "../base", version = "0.11.2" } # GLUON

Expand Down
2 changes: 1 addition & 1 deletion format/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ documentation = "https://docs.rs/gluon"
log = "0.4"
pretty = "0.5"
itertools = "0.8"
codespan = "0.2"
codespan = "0.3"

gluon_base = { path = "../base", version = "0.11.2" } # GLUON

Expand Down
4 changes: 2 additions & 2 deletions parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ log = "0.4"
pretty = "0.5"
gluon_base = { path = "../base", version = "0.11.2" } # GLUON
ordered-float = "1"
codespan = "0.2"
codespan-reporting = "0.2"
codespan = "0.3"
codespan-reporting = "0.3"

[dev-dependencies]
env_logger = "0.6"
Expand Down
4 changes: 2 additions & 2 deletions repl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ env_logger = { version = "0.6", optional = true }
lazy_static = "0.2.0"
rustyline = "1.0.0"
walkdir = "2"
codespan = "0.2"
codespan-reporting = "0.2"
codespan = "0.3"
codespan-reporting = "0.3"


serde = "1"
Expand Down
2 changes: 2 additions & 0 deletions tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ fn macro_error_with_line_column_info() {
.unwrap(),
r#"error: Could not find module 'undefined'. Searched `.`.
- <test>:1:9
|
1 | import! undefined
| ^^^^^^^^^
|
"#
);
}
15 changes: 8 additions & 7 deletions vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ documentation = "https://docs.rs/gluon"
build = "build.rs"

[dependencies]
bitflags = "1.0.0"
codespan = "0.3"
collect-mac = "0.1.0"
frunk_core = "0.2"
futures = "0.1.0"
itertools = "0.8"
log = "0.4"
quick-error = "1.1.0"
mopa = "0.2.2"
collect-mac = "0.1.0"
ordered-float = "1"
pretty = "0.5"
bitflags = "1.0.0"
itertools = "0.8"
futures = "0.1.0"
typed-arena = "1.2.0"
quick-error = "1.1.0"
smallvec = "0.6"
codespan = "0.2"
typed-arena = "1.2.0"

serde = { version = "1.0.0", optional = true }
serde_json = { version = "1.0.0", optional = true }
Expand Down
14 changes: 7 additions & 7 deletions vm/src/compiler.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::ops::{Deref, DerefMut};

use crate::base::{
ast::{self, DisplayEnv, Literal, Typed, TypedIdent},
ast::{DisplayEnv, Typed, TypedIdent},
kind::{ArcKind, KindEnv},
pos::Line,
resolve,
Expand All @@ -12,7 +12,7 @@ use crate::base::{
};

use crate::{
core::{self, CExpr, Expr, Pattern},
core::{self, CExpr, Expr, Literal, Pattern},
interner::InternedStr,
source_map::{LocalMap, SourceMap},
types::*,
Expand Down Expand Up @@ -815,27 +815,27 @@ impl<'a> Compiler<'a> {
Pattern::Literal(ref l) => {
let lhs_i = function.stack_size() - 1;
match *l {
ast::Literal::Byte(b) => {
Literal::Byte(b) => {
function.emit(Push(lhs_i));
function.emit(PushByte(b));
function.emit(ByteEQ);
}
ast::Literal::Int(i) => {
Literal::Int(i) => {
function.emit(Push(lhs_i));
function.emit(PushInt(i));
function.emit(IntEQ);
}
ast::Literal::Char(ch) => {
Literal::Char(ch) => {
function.emit(Push(lhs_i));
function.emit(PushInt(u32::from(ch).into()));
function.emit(IntEQ);
}
ast::Literal::Float(f) => {
Literal::Float(f) => {
function.emit(Push(lhs_i));
function.emit(PushFloat(f.into_inner()));
function.emit(FloatEQ);
}
ast::Literal::String(ref s) => {
Literal::String(ref s) => {
self.load_identifier(&Symbol::from("@string_eq"), function)?;
let lhs_i = function.stack_size() - 2;
function.emit(Push(lhs_i));
Expand Down
Loading

0 comments on commit ca8528c

Please sign in to comment.