Skip to content

Conversation

@janvrany
Copy link
Collaborator

@janvrany janvrany commented May 8, 2025

No description provided.

@janvrany janvrany force-pushed the pr/refactor-newUndefined branch 2 times, most recently from 27d0b9f to b8e245e Compare May 8, 2025 12:55
janvrany added 3 commits May 8, 2025 15:10
A Jib program may contain enums, structs and unions. These get
ultimately reduced to Z3 datatypes. For this reason, each program must
have its own Z3 context in which datatypes are defined. Also, this
context is the one to use when creating Z3 nodes representing "values".

This commit implements this by holding on a Z3 context from program's
environment and making sure semantic analysis and interpreter set this
context as current when analyzing and interpreting. This prompted

 1. creation of specialized `JibProgramEnvironment` that holds on such Z3
    context and
 2. basic "analysis" that fills in environment for program and
    defined `fn`s, `let`s and `register`s
This commit adds `#sort` method to type nodes, returning the Z3 sort
that corresponds to given (Jib) type. For now, it is implemented only
for "scalar" types (bitvectors, numbers, bool). Support for "user
defined" types (enums, structs, unions) will come later.
This commit refactor `#newUndefined`. The implementation was temporary
and completely bogus. This commits replaces the old implementation with
new one which simply return a fresh Z3 variable of corresponding sort,
prefixed with string "undefined" to make it easier to spot.

While at it, move the method to `Sail-Jib-Interpreter` package.
@janvrany janvrany force-pushed the pr/refactor-newUndefined branch from b8e245e to a54579f Compare May 8, 2025 14:10
@janvrany janvrany merged commit 5aa0060 into shingarov:master May 8, 2025
1 check passed
@janvrany janvrany deleted the pr/refactor-newUndefined branch May 8, 2025 14:12
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.

1 participant