Implement TBAA-based load/store optimization in standalone Python IR#5
Draft
Implement TBAA-based load/store optimization in standalone Python IR#5
Conversation
Don't abort the entire compilation. Fix Shopify#700
Owner
|
Don't do this in HIR. Just make a small Ruby implementation of a sample IR like the blog post |
Co-authored-by: tekknolagi <401167+tekknolagi@users.noreply.github.com>
Co-authored-by: tekknolagi <401167+tekknolagi@users.noreply.github.com>
Co-authored-by: tekknolagi <401167+tekknolagi@users.noreply.github.com>
Co-authored-by: tekknolagi <401167+tekknolagi@users.noreply.github.com>
Co-authored-by: tekknolagi <401167+tekknolagi@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add advanced alias classes with TBAA implementation
Implement TBAA-based load/store optimization in standalone Python IR
Feb 1, 2026
tekknolagi
pushed a commit
that referenced
this pull request
Feb 3, 2026
* OpenSSL::PKCS12.create calling the PKCS12_create() has the argument mac_iter which uses a MAC key using PKCS12KDF which is not FIPS-approved. * OpenSSL::PKCS12.new with base64-encoded example calling PKCS12_parse() verifies the MAC key using PKCS12KDF which is not FIPS-approved. * PBE-SHA1-3DES uses PKCS12KDF which is not FIPS-approved according to the RFC 7292 PKCS#12. https://datatracker.ietf.org/doc/html/rfc7292#appendix-C > The PBES1 encryption scheme defined in PKCS #5 provides a number of > algorithm identifiers for deriving keys and IVs; here, we specify a > few more, all of which use the procedure detailed in Appendices B.2 > and B.3 to construct keys (and IVs, where needed). As is implied by > their names, all of the object identifiers below use the hash > function SHA-1. > ... > pbeWithSHAAnd3-KeyTripleDES-CBC OBJECT IDENTIFIER ::= {pkcs-12PbeIds 3} Note that the pbeWithSHAAnd3-KeyTripleDES-CBC (pkcs12-pbeids 3) in the RFC 7292 PKCS#12 means PBE-SHA1-3DES in OpenSSL. PKCS12KDF is used in PKCS#12. https://oidref.com/1.2.840.113549.1.12.1.3 https://github.com/openssl/openssl/blob/ed57d1e06dca28689190e00d9893e0fd7ecc67c1/crypto/objects/objects.txt#L385 ruby/openssl@2aa6d97a54
tekknolagi
pushed a commit
that referenced
this pull request
Apr 6, 2026
pm_parse_process initializes the index_lookup_table but nothing seems to
use it after it has been allocated. However, pm_compile_scope_node will
overwrite the index_lookup_table and cause it to leak memory. This can
be seen during bootup with the following memory leaks reported by ASAN:
#0 0x60dba31b7af3 in malloc
#1 0x60dba32e0718 in rb_gc_impl_malloc gc/default/default.c:8287:5
#2 0x60dba32c7aa7 in ruby_xmalloc_body gc.c:5373:12
#3 0x60dba32c4a54 in ruby_xmalloc gc.c:5355:34
#4 0x60dba3260314 in pm_index_lookup_table_init_heap prism_compile.h:89:29
#5 0x60dba3209388 in pm_parse_process prism_compile.c:11366:5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the toy load/store optimizer from https://github.com/tekknolagi/tekknolagi.github.com/blob/main/loadstore.py with Type-Based Alias Analysis to distinguish memory operations on different Ruby object types.
Changes
Core TBAA implementation (
loadstore.py)alloc_array(),alloc_hash(),alloc_string(), etc.may_alias(obj1, obj2, offset1, offset2): returns false for different types, enabling cross-type optimizationoptimize_load_store_tbaa(): eliminates loads invalidated only by same-type storesKey insight: Stores to different object types cannot alias, even at the same offset. This allows load elimination across type boundaries that would otherwise require conservative invalidation.
Example optimization:
Without TBAA, the hash store would conservatively invalidate the array load.
Documentation
LOADSTORE_README.md: Technical details, aliasing rules, limitationsQUICKSTART.md: Getting started guidedemo_loadstore.py: 6 concrete optimization scenariosTest coverage: 11 tests covering basic load/store elimination and TBAA-specific scenarios (same type conservative, different types aggressive, unknown types safe).
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
bernsteinbear.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.