-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[interpreter,spec] Convert
MTValue
into an alias of native types an…
…d `MutableValue`s. Instead of using wrapper classes for the primitive types of `TInteger`, `TFloat`, `TString`, and `TBoolean`, these values are now implemented directly as the underlying Crystal types: `Int64`, `Float64`, `String`, and `Bool` respectively. `TList` and `TMap` may also be converted over to use `Array` and `Hash` directly in the near future. `TNil` and `TSymbol` will remain non-native types. `TNil` will remain because it would conflict in many cases with Crystal's standard library returning `nil` in many cases (this is already enough of an issue with `false`). `TSymbol` needs to remain to be able to retain the name of the Symbol at run time. There are two main reasons for implementing this change: - **Performance improvements.** While not overly substantial (~0.1% speed-wise in a super-quick test benchmark), the interpreter no longer needs to allocate a whole object on the heap to represent integers, floats, or booleans (strings will still be allocated on the heap). In the long run, this will help with both speed and memory. - **Cleaner native library work.** Native library methods no longer need to wrap and unwrap values to work with them. Since these values are literally the Crystal objects themselves, they can be manipulated directly.
- Loading branch information
1 parent
2efe944
commit d2bcada
Showing
36 changed files
with
416 additions
and
608 deletions.
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
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
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
Oops, something went wrong.