234 Commits

Author SHA1 Message Date
Hans Svensson
4b0837dc59 Leave state/event blank if not present 2019-05-28 13:07:24 +02:00
Hans Svensson
0ded431df8 Fix interface and use atoms instead of binaries 2019-05-28 11:18:21 +02:00
Hans Svensson
e7419b79fd Put state and event types at the top level 2019-05-28 11:08:36 +02:00
Hans Svensson
c60999edf0 Refactor aeso_aci with dont_unfold, etc. 2019-05-28 11:08:36 +02:00
Hans Svensson
ea17dae93e Silence compiler warning 2019-05-28 11:08:36 +02:00
Hans Svensson
8a16bd4fa1 Add dont_unfold option to type inference function 2019-05-28 11:08:36 +02:00
Hans Svensson
1ed40f1cca Pretty print state variables 'a instead of '1 2019-05-28 11:08:36 +02:00
Hans Svensson
5c98317a5a Make 'indexed' keyword optional 2019-05-28 11:08:36 +02:00
Hans Svensson
33dbeeefad Consider namespaces when collecting used_types 2019-05-28 11:08:36 +02:00
Tobias Lindahl
098dac65e2
Merge pull request #73 from aeternity/PT-162805991-fate-state
The state is always live to prevent bad optimizations
2019-05-28 09:59:22 +02:00
Tobias Lindahl
9cf8733f77 The state is always live to prevent bad optimizations 2019-05-28 09:52:50 +02:00
Ulf Norell
98f349f67c
Merge pull request #72 from aeternity/bad-record-compiler-crash
Bad record compiler crash
2019-05-27 12:18:24 +02:00
Ulf Norell
96547ea2ec Test for record field parse error 2019-05-27 12:04:38 +02:00
Ulf Norell
ee03442ddf Return parse error instead of crashing the type checker 2019-05-27 11:58:18 +02:00
Tobias Lindahl
0fa09467f6
Pt 166148534 refactor fate code (#71)
* Change of module names aeb_fate_code -> aeb_fate_ops

* Add missing call instructions

* Use new adt for fate code

* Add default init function if not present and keep init function if present

* Fix BLOCKHASH function for fate

* Rewrite for clarity and Dialyzer
2019-05-23 14:01:41 +02:00
Hans Svensson
dcae96ed21
Merge pull request #70 from aeternity/PT-166147620-prepare_v3
PT-166147620 Prepare for v3.0.0
v3.0.0
2019-05-21 10:37:41 +02:00
Hans Svensson
94689dd0e9 Prepare for v3.0.0 2019-05-21 09:55:17 +02:00
Hans Svensson
be7c0e1bd4 Remove escript aesophia 2019-05-21 09:54:42 +02:00
Ulf Norell
8eaafa736c
Merge pull request #69 from aeternity/PT-162578475-stateful
Check stateful annotations
2019-05-15 15:44:37 +02:00
Ulf Norell
cf5a8aeb5f changelog 2019-05-14 10:10:53 +02:00
Ulf Norell
9e555a3121 Fix type definition 2019-05-14 09:42:27 +02:00
Ulf Norell
d051fa6c89 Remove bad code 2019-05-14 09:42:17 +02:00
Tobias Lindahl
d4238c0bdc
Merge pull request #68 from aeternity/PT-165964555-make-remote-calls-to-contract-objects
Keep the contract type in fate code
2019-05-14 09:41:31 +02:00
Ulf Norell
389072fb12 Add stateful to __call 2019-05-14 09:32:52 +02:00
Tobias Lindahl
1760593170 Keep the contract type in fate code 2019-05-14 09:29:52 +02:00
Ulf Norell
d8dd6b900f Remove unused test contract 2019-05-13 17:51:56 +02:00
Ulf Norell
74d4048d9f Check that init doesn't read or write the state 2019-05-13 17:51:47 +02:00
Ulf Norell
6bd2b7c483 Remember source location when computing used names 2019-05-13 17:50:34 +02:00
Ulf Norell
5aed8b3ef5 Check stateful annotations
Functions must be annotated as `stateful` in order to
- Update the contract state (using `put`)
- Call `Chain.spend` or other primitive functions that cost tokens
- Call an Oracle or AENS function that requires a signature
- Make a remote call with a non-zero value
- Construct a lambda calling a stateful function

It does not need to be stateful to
- Read the contract state
- Call another contract with value=0, even when the remote function is stateful
2019-05-13 13:39:17 +02:00
Ulf Norell
e1a798aef4 Check for repeated argument names to functions
(PT-159592825)
2019-05-10 15:51:42 +02:00
Ulf Norell
23cc8e1132
Letrec and letfun (#65)
* Type check and compile letfuns

* Minor code simplification

* Remove let rec from Sophia
2019-05-10 13:27:57 +02:00
Tobias Lindahl
691ae72fbb
Merge pull request #66 from aeternity/PT-165857097-add-call-value-instruction
Add call value instruction in fate
2019-05-10 13:15:22 +02:00
Tobias Lindahl
8830095c7e Add call value instruction in fate 2019-05-10 12:38:58 +02:00
Tobias Lindahl
251b876495
Add value and gas to remote calls (#64)
* Add value and gas to remote calls
2019-05-10 09:00:36 +02:00
Hans Svensson
f8ee8f7129
Merge pull request #63 from aeternity/PT-165440601-165713319-sophia_addons
Add Contract.creator and address checking primitives
2019-05-09 10:34:45 +02:00
Hans Svensson
192ec207a7 Add Contract.creator and address checking primitives 2019-05-09 09:54:04 +02:00
Ulf Norell
0aa1c89556
Fate compiler (#62)
* Update to changes in icode format

* Start on new intermediate code for FATE

* Compile `let` to FATE

* Fix and improve broken bytecode optimisations

* Basic tuple patterns

* Compile shallow matching on tuples

* Liveness analysis for local variables

* Fix minor bug

* Use RETURNR when possible

* Nicer debug printing

* Refactor optimization rules

* Compile tuple construction

* Improve instruction analysis and generalize some optimizations

* Compile nested pattern matching to case trees

(Only tuple and variable patterns so far)

* Reannotate and repeat optimization pass once it done

Could try hard to keep annotations more precise, but would be more error prone

* Get rid of unnecessary STORE instructions

* Keep better track of liveness annotations when swapping instructions

* Limit the number of iterations for the optimization loop

Should finish in one iteration, but we shouldn't loop if there are bugs
or corner cases where it doesn't.

* Pattern matching on booleans

* wip: rewrite case tree compiler to handle catch-alls

still with debug printing, and can't compile it yet

* Add missing case in renaming

* Compile case trees all the way to Fate assembly

* Simplify variables bindings in environment

* Shortcut let x = y in ...

* compile list literals

* Fix various bugs in pattern match compilation

* Pretty printer for fcode

* Fix renaming bug

* Another renaming bug

* Handle switch_body in optimizations

* Remove optimization for if-then-else

* Tag instructions in annotated scode

* Remove 'if' from fcode

* Fix dialyzer things

* Remove unused argument

* Compile pattern matching on integer literals

* Compile list patterns

* Use op_view in more places

* allow leaving out fields from record patterns

* compile records (patterns and construction)

* Compile record update

* Use SETELEMENT instruction

* Compile variants

* Remove incorrect push for tuple switches

* Optimize matching on single constructors datatypes

* Use the fact that SWITCH and JUMPIF can use args and vars

* string literals and pattern matching on the same

* Compile character literals

* Minor refactoring of op instruction handling

* compile address literals

* Get rid of unit in AST

* Unary operators

* Compile function calls

(to fully saturated top-level functions only)

* fix breakage after unary operators

* variables are now lists of names in fcode

* pretty printing for function calls

* use STORE ?a instead of PUSH during optimizations

* no-op fcode optimization pass

* some constant propagation optimizations

* Case on constructor optimization

* fix minor bugs

* Compile all the operators

* Compile maps

* Simplify JUMPIF on true/false

* Fixed left-over reference to STR_EQ

* Add compile-time evaluation for more operators

* Distinguish local vars and top-level names already in fcode

* Compile builtins

* Compile bytes(N)

Compile to FATE strings for now

* Improve inlining of PUSH

* Fix name resolution bug

* Change map_get/set to operators in fcode

* Compile lambdas and higher-order functions

* Optimize single variable closure envs

* Handle unapplied builtins and top-level functions

* Missing case in fcode pretty printer

* Fix variable binding bug in fcode compiler

* Compiler side of state updates

No support in FATE yet though

* Compile statements

* Compile events

But no FATE support for events yet

* Compile remote calls

* Clearer distinction between applied and unapplied top-level things (def/builtin) in fcode

* Tag for literals in fcode to make code cleaner

* We now have block hash at height in FATE

* Update aebytecode commit

* Get rid of catchall todos

* Jump some hoops to please Dialyzer
2019-05-07 15:48:47 +02:00
Ulf Norell
71b97cba62
Merge pull request #61 from aeternity/PT-165597438-equality-on-bytes
Support equality on bytes(N)
2019-04-26 08:47:14 +02:00
Ulf Norell
8a381e5ef1 Support equality on bytes(N) 2019-04-25 16:06:50 +02:00
Hans Svensson
386419f112
Merge pull request #60 from aeternity/PT-164629541-generic_hash_and_signature
Revert bytes(N) from icode/vm-types
2019-04-24 08:58:43 +02:00
Hans Svensson
45a62f0807 Simplify ast_typerep 2019-04-24 08:44:05 +02:00
Hans Svensson
3255c62e0e Revert bytes(N) from icode/vm-types 2019-04-23 17:47:50 +02:00
Hans Svensson
51b63f9559
Merge pull request #59 from aeternity/PT-164629541-generic_hash_and_signature
Add bytes(int), add address_literalsm add ecverify_secp256k1
2019-04-23 11:23:32 +02:00
Hans Svensson
5e6af18c7b Address review comment 2019-04-23 11:10:56 +02:00
Hans Svensson
4324bfd49e Add bytes(int), add address_literalsm add ecverify_secp25k1
hash -> bytes(32)
signature -> bytes(64)
address literals
2019-04-23 10:40:02 +02:00
Erik Stenman
faa0ef9772
Merge pull request #57 from aeternity/PT-165312102-setelement
Point to latest aebytecode with setelement instruction.
2019-04-15 10:57:10 +02:00
Erik Stenman
f07954f62c Point to latest aebytecode with setelement instruction. 2019-04-15 08:54:02 +02:00
Hans Svensson
ef761a4c57
Merge pull request #56 from aeternity/prepare_2.1.0
Preparing v2.1.0
v2.1.0
2019-04-11 14:22:54 +02:00
Hans Svensson
330d8929fd Preparing v2.1.0 2019-04-11 13:42:41 +02:00
Thomas Arts
491b1211d1
Merge pull request #55 from aeternity/PT-165246396-prepare-remove-dependency
Update commit hash aebytecode
2019-04-11 10:30:41 +02:00