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

Bitcode fixes and improvements #1469

Merged
merged 3 commits into from Jan 2, 2023
Merged

Conversation

housel
Copy link
Member

@housel housel commented Dec 29, 2022

No description provided.

Previously, most bitcode records were written using the write-record
function, which iterates through its #rest arguments and calls
write-vbr on each. This means that the compiler cannot determine which
write-vbr method will be applicable, increasing the dispatch
overhead. This change uses a write-record* macro to make significanly
more of the arguments in write-vbr calls visible to the compiler's
typing mechanism.

* sources/lib/llvm/bitcode.dylan
  (write-record): Factor out the record header writing into
   write-record-head.
  (write-record-head): New method for writing out the three VBRs at
   the beginning of unabbreviated records.
  (write-record*): New macro for writing unabbreviated records.
  (%count-operands): New macro for counting write-record* operands.
  (%write-operands): New macro for writing write-record* operands by
   expanding into calls to write-vbr.

* sources/lib/llvm/llvm-bitcode.dylan: Replace calls to write-record
  with invocations of write-record* wherever possible.
  (write-type-record on <llvm-primitive-type>,
   write-type-record on <llvm-integer-type>,
* sources/lib/llvm/llvm-bitcode.dylan
  (encode-attribute-list): The proper attribute list encoding for function
   attributes (AttributeList::FunctionIndex) is #xFFFF_FFFF. The
   previous encoding ($maximum-unsigned-machine-word on 64-bit
   platforms) was recognized in some instances but not by the
   bitcode compatibility upgrade code.
* sources/common-dylan/darwin-common-extensions-helper.c: Add an
  include of <string.h> to prevent compilation errors due to calls to
  undeclared strlen().
Copy link
Member

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

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

Looks like a great change. The function attribute thing failing in some scenarios must have been fun.


// Output the total number of arguments
let operand-count
let operand-count :: <integer>
Copy link
Member

Choose a reason for hiding this comment

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

It didn’t recognize this was an integer?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't recall if this was needed, or if it was just for documentation purposes.

@housel housel merged commit d2685b1 into dylan-lang:master Jan 2, 2023
@housel housel deleted the bitcode-2022 branch January 2, 2023 07:14
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.

None yet

2 participants