13 Commits
Author SHA1 Message Date
Kevin Newton e80cd771b3 [ruby/prism] Define PRISM_OOM
So we have a centralized place to handle out of memory errors.

https://github.com/ruby/prism/commit/14969912cc
2026-10-28 05:56:30 +00:00
Kevin Newton ae6ef1bfb5 [ruby/prism] Add checksum
CRuby is now hashing the contents of a file and attaching that to
iseqs in order to properly determine if a file has changed since
it was compiled. This is used in a couple places, but namely it is
used for error_highlight to make sure it isn't highlighting stale
locations.

The hashing algorithm doesn't actually matter since it's just used
to compare across parses, so as long as it is consistent it's okay.
I wanted something fast and standard, so this commit implements the
XXH3_64 algorithm from the spec. Noteably it uses the default
secret and a seed of 0 to make things even simpler. With NEON and
SSE2 implementations, this thing flies quite a bit faster than the
upstream FNV-1a implementation.

I figured this could be useful for other consumers as well, in
particular for tools that generate some kind of metadata around
files (type checkers, linters, etc). Eventually a nice extension
may be to hash a minimal version of the contents (i.e., with
context-insensitive whitespace removed) so that changes to docs or
indentation do not change the hash value.

If you're using the C API, you are only charged for this function
if you actually call it since it is computed lazily. For everyone
else it is automatically called, but truthfully it is so fast that
the difference is completely negligible.

https://github.com/ruby/prism/commit/6b7c5773eb
2026-10-19 17:30:05 -04:00
Kevin Newton 55e03ec0cf [ruby/prism] Fix buffer length append check 0
https://github.com/ruby/prism/commit/812fd04263
2026-10-12 20:40:55 +00:00
Kevin Newton 37e77e5ab5 [ruby/prism] Make buffer an opaque pointer
https://github.com/ruby/prism/commit/1b594e10da
2026-03-20 09:37:43 -04:00
Kevin Newton a352fdc8a7 [ruby/prism] pm_buffer_free -> pm_buffer_cleanup
https://github.com/ruby/prism/commit/2b5298128e
2026-03-20 09:37:43 -04:00
Kevin Newton 096b3e032d [ruby/prism] Move allocator to internal headers
https://github.com/ruby/prism/commit/1e3ec12adc
2026-03-20 09:37:43 -04:00
Kevin Newton 75bfc14a8f [ruby/prism] Move compiler detection stuff into include/prism/compiler
https://github.com/ruby/prism/commit/01d575aa2f
2026-03-20 09:37:43 -04:00
Kevin Newton 773d6bb9a4 [ruby/prism] Put inline in its own header
https://github.com/ruby/prism/commit/cc93903d08
2026-03-20 09:37:43 -04:00
Kevin Newton d3c03dadd3 [ruby/prism] Move char to internal headers
https://github.com/ruby/prism/commit/895b395b99
2026-03-20 09:37:43 -04:00
Kevin Newton 1962b690a2 [ruby/prism] Split up line offset list into public and internal
https://github.com/ruby/prism/commit/58586902b1
2026-03-20 09:37:43 -04:00
Kevin Newton c24a19eb75 [ruby/prism] Only include what is necessary for buffer
https://github.com/ruby/prism/commit/1039dff6ca
2026-03-20 09:37:43 -04:00
Kevin Newton c1f0acda00 [ruby/prism] Split up buffer headers between internal and external
https://github.com/ruby/prism/commit/bda0f889b5
2026-03-20 09:37:43 -04:00
Kevin Newton c46d2168b6 [ruby/prism] Move buffer out of utils
https://github.com/ruby/prism/commit/429672ea58
2026-03-20 09:37:43 -04:00