-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic mathematical stdlib functionality #61
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
655d991
begin register allocator
3e56e38
begin reg alloc
a7f469e
mutable virtual registers; basic allocation algorithm skeleton
5c50072
mutable registers in allocation
e407757
pull in fuel-asm official ops
f99b127
switching laptops
af1c112
begin work on virtual registers and ops
8d6f088
daily checkpoint
f44b7fd
add AllocatedOp abstraction
61705b9
template for parsing ops
8d21ff5
allocation algorithm progress
cfa3e4a
change op parsing logic
483c46d
WIP parsing inline asm to new ops
fb5d61a
more op parsing
1723aca
finish parsing virtual ops from asm
e961af7
start registers method
f61845b
register allocation method
c36dbb5
convert virtual registers to allocated ones
d35f6bf
switch back to organizational labels for jumps
3a973af
realized ops
d8c0b83
fully allocate registers and resolve labels
ea91252
print allocated registers
b822630
merge from master; fix reg alloc algo
8347dc3
fill in todo!() errors in asm parsing
d2b6b37
resolve all todosudo apt-get install vlc in core_lang
60c0b1c
switch to ssh for fuel-asm
2156b67
resolve warnings
2c126bf
fix git url
3598dd8
rustfmt
f3ea12e
Merge branch 'master' of github.com:FuelLabs/fuel-vm-hll into allocation
8344df4
small self-code-review
cd6dbb5
resolve module
4315bc2
map the virtual opcodes to fuel_asm ops
a2a3ee7
code review feedback
a2551fb
Merge branch 'allocation' of github.com:FuelLabs/fuel-vm-hll into act…
7b87ee0
factor finalized asm out into its own file
f3dd962
merge from master
31e9f29
realize data section and instructions to bits
c39141a
data section offset label
5c21259
initial bytecode generation
11e6a17
add forc --asm command
e3c1d1a
print out the loading of the data section op
db009fb
resolve warnings
f23350d
fix register allocater bug
1b74664
cleanup
980e9c7
fix bad error message
88217bd
code review feedback
fafb111
Merge branch 'master' of github.com:fuellabs/fuel-vm-hll into actual_…
0babc0b
fix doctest
01af3d0
fix typo
3cea222
reference fuel_core for register constants
3f47eb6
add stdlib stuff
448536c
allow use of interface surface functions in the methods section of tr…
9a41e2a
comment
f6f7bea
basic math stdlib
84cd2a9
merge from master
e9f3cc1
formatting
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,28 +171,42 @@ impl<'sc> TypedAstNode<'sc> { | |
}) => { | ||
let mut methods_buf = Vec::new(); | ||
let interface_surface = interface_surface | ||
.into_iter() | ||
.map(|TraitFn { | ||
name, | ||
parameters, | ||
return_type, | ||
return_type_span | ||
}| TypedTraitFn { | ||
name, | ||
return_type_span, | ||
parameters: parameters | ||
.into_iter() | ||
.map(|FunctionParameter { name, r#type, type_span }| | ||
TypedFunctionParameter { | ||
name, | ||
r#type: namespace.resolve_type(&r#type, | ||
&MaybeResolvedType::Partial(PartiallyResolvedType::SelfType)), | ||
type_span } | ||
).collect(), | ||
return_type: namespace.resolve_type(&return_type, | ||
&MaybeResolvedType::Partial(PartiallyResolvedType::SelfType) | ||
) | ||
}).collect::<Vec<_>>(); | ||
.into_iter() | ||
.map(|TraitFn { | ||
name, | ||
parameters, | ||
return_type, | ||
return_type_span | ||
}| TypedTraitFn { | ||
name, | ||
return_type_span, | ||
parameters: parameters | ||
.into_iter() | ||
.map(|FunctionParameter { name, r#type, type_span }| | ||
TypedFunctionParameter { | ||
name, | ||
r#type: namespace.resolve_type(&r#type, | ||
&MaybeResolvedType::Partial(PartiallyResolvedType::SelfType)), | ||
type_span } | ||
).collect(), | ||
return_type: namespace.resolve_type(&return_type, | ||
&MaybeResolvedType::Partial(PartiallyResolvedType::SelfType) | ||
) | ||
}).collect::<Vec<_>>(); | ||
let mut l_namespace = namespace.clone(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where the real change begins -- mutating the local namespace to include trait interface surface methods |
||
// insert placeholder functions representing the interface surface | ||
// to allow methods to use those functions | ||
l_namespace.insert_trait_implementation( | ||
CallPath { | ||
prefixes: vec![], | ||
suffix: name.clone(), | ||
}, | ||
MaybeResolvedType::Partial(PartiallyResolvedType::SelfType), | ||
interface_surface | ||
.iter() | ||
.map(|x| x.to_dummy_func()) | ||
.collect(), | ||
); | ||
for FunctionDeclaration { | ||
body, | ||
name: fn_name, | ||
|
@@ -204,7 +218,7 @@ impl<'sc> TypedAstNode<'sc> { | |
.. | ||
} in methods | ||
{ | ||
let mut namespace = namespace.clone(); | ||
let mut namespace = l_namespace.clone(); | ||
parameters.clone().into_iter().for_each( | ||
|FunctionParameter { name, r#type, .. }| { | ||
let r#type = namespace.resolve_type( | ||
|
@@ -298,6 +312,7 @@ impl<'sc> TypedAstNode<'sc> { | |
}, | ||
) | ||
.collect::<Vec<_>>(); | ||
|
||
// TODO check code block implicit return | ||
let return_type = namespace.resolve_type(&return_type, self_type); | ||
let (body, _code_block_implicit_return) = type_check!( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a whitespace change