(
self, value: str, obj: str, rtype: RType, cl: ClassIR, attr: str, clear: bool
)
| 462 | self._emit_attr_bitmap_update("", obj, rtype, cl, attr, clear=True) |
| 463 | |
| 464 | def _emit_attr_bitmap_update( |
| 465 | self, value: str, obj: str, rtype: RType, cl: ClassIR, attr: str, clear: bool |
| 466 | ) -> None: |
| 467 | if value: |
| 468 | check = self.error_value_check(rtype, value, "==") |
| 469 | self.emit_line(f"if (unlikely({check})) {{") |
| 470 | index = cl.bitmap_attrs.index(attr) |
| 471 | mask = 1 << (index & (BITMAP_BITS - 1)) |
| 472 | bitmap = self.attr_bitmap_expr(obj, cl, index) |
| 473 | if clear: |
| 474 | self.emit_line(f"{bitmap} &= ~{mask};") |
| 475 | else: |
| 476 | self.emit_line(f"{bitmap} |= {mask};") |
| 477 | if value: |
| 478 | self.emit_line("}") |
| 479 | |
| 480 | def emit_undefined_attr_check( |
| 481 | self, |
no test coverage detected