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

[Compiler] Support dynamically constructed bitfields #354

Merged
merged 2 commits into from
Apr 11, 2021

Conversation

water111
Copy link
Collaborator

The compiler will now accept bifield defintions like

(new 'static 'test-bf-type7 :f1 #x12 :f2 (+ #x10 3 #x100) :f3 12.3433 :f4 ((lambda () 1)))

It works just like GOAL and will combine all fields known at compile time, then or in the others:

  [0x10031] mov rax, 0x20A2BF14000012              mov-ic igpr-11, 9186140812738578
  [0x1003b] mov ecx, 0x10                          mov-ic igpr-13, 16
  [0x10040] mov edx, 0x03                          mov-ic igpr-14, 3
  [0x10045] add rcx, rdx                           addi igpr-12, igpr-14
  [0x10048] mov edx, 0x100                         mov-ic igpr-15, 256
  [0x1004d] add rcx, rdx                           addi igpr-12, igpr-15
  [0x10050] shl rcx, 0x39                          shl igpr-12, 57
  [0x10054] shr rcx, 0x29                          shr igpr-12, 41
  [0x10058] or rax, rcx                            or igpr-11, igpr-12
  [0x1005b] mov ecx, 0x01                          mov-ic igpr-16, 1
  [0x10060] shl rcx, 0x3F                          shl igpr-16, 63
  [0x10064] shr rcx, 0x08                          shr igpr-16, 8
  [0x10068] or rax, rcx                            or igpr-11, igpr-16

@coveralls
Copy link

Pull Request Test Coverage Report for Build 739254118

  • 49 of 56 (87.5%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 69.241%

Changes Missing Coverage Covered Lines Changed/Added Lines %
goalc/compiler/compilation/Type.cpp 1 2 50.0%
goalc/compiler/compilation/Static.cpp 46 52 88.46%
Totals Coverage Status
Change from base Build 738974521: 0.02%
Covered Lines: 33436
Relevant Lines: 48289

💛 - Coveralls

@water111 water111 merged commit a863542 into master Apr 11, 2021
@water111 water111 deleted the w/dynamic-bitfields-in-compiler branch April 11, 2021 23:21
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