Skip to content
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

43 constant pool vm #47

Merged
merged 15 commits into from
Oct 29, 2023
Merged

43 constant pool vm #47

merged 15 commits into from
Oct 29, 2023

Conversation

levBagryansky
Copy link
Member

@levBagryansky levBagryansky commented Oct 29, 2023

Introduced Constant pool for i64 and f64

@levBagryansky levBagryansky requested a review from c71n93 October 29, 2023 17:55
@levBagryansky levBagryansky requested a review from c71n93 October 29, 2023 19:45
src/ChaiVM/interpreter/code-manager.cpp Outdated Show resolved Hide resolved
src/ChaiVM/interpreter/code-manager.cpp Outdated Show resolved Hide resolved
throw std::invalid_argument(std::string{"Bad input stream"});
}
uint16_t constants = 0;
static_assert(sizeof constants == 2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it, please. it is better to check sizeof(constant) == sizeof(Immediate) but when you make constant of type Immediate it will be unnecessary.

Copy link
Member Author

@levBagryansky levBagryansky Oct 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c71n93 let's leave it. What if once we decide write number of constants to file in 4 bytes instead of 2, but immediate will still be 2 bytes. I leave this assert just for safety

src/ChaiVM/interpreter/executor.cpp Outdated Show resolved Hide resolved
include/ChaiVM/utils/chai-file.hpp Outdated Show resolved Hide resolved
include/ChaiVM/utils/chai-file.hpp Outdated Show resolved Hide resolved
@levBagryansky levBagryansky requested a review from c71n93 October 29, 2023 20:31
@levBagryansky levBagryansky merged commit a3d8a67 into master Oct 29, 2023
@levBagryansky levBagryansky deleted the 43_constant_pool_vm branch October 29, 2023 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants