Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

More efficient (fixed-format) serialization#19668

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ilevkivskyi merged 14 commits intopython:masterfromilevkivskyi:ff-cache
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
14 commits
Select commitHold shift + click to select a range
ac77da1
Add PoC implementation
ilevkivskyiAug 6, 2025
f3b37eb
Port ArgKind hack
ilevkivskyiAug 6, 2025
e3d9d41
Some more experiments
ilevkivskyiAug 11, 2025
08bec72
Clean-up/optimize some case reads
ilevkivskyiAug 11, 2025
ab6e6a6
Merge remote-tracking branch 'upstream/master' into ff-cache
ilevkivskyiAug 11, 2025
bfafc83
Some more experiments
ilevkivskyiAug 13, 2025
1865600
Add support for ints
ilevkivskyiAug 13, 2025
d6b3068
Move closer to the real deal
ilevkivskyiAug 14, 2025
d1bc106
Repurpose lib-rt/setup.py
ilevkivskyiAug 15, 2025
8e7cdcb
Some touches
ilevkivskyiAug 15, 2025
418fd1f
More touches
ilevkivskyiAug 15, 2025
705ffe4
Merge remote-tracking branch 'upstream/master' into ff-cache
ilevkivskyiAug 15, 2025
c9712ee
Remove string size limit; Fix Windows
ilevkivskyiAug 15, 2025
45d3ec4
Hide new cache flag for now
ilevkivskyiAug 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Some more experiments
  • Loading branch information
@ilevkivskyi
ilevkivskyi committedAug 13, 2025
commitbfafc8378a416f12c13c208148908d380b8b5db2
3 changes: 2 additions & 1 deletionmypyc/analysis/ircheck.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@
)
from mypyc.ir.pprint import format_func
from mypyc.ir.rtypes import (
KNOWN_NATIVE_TYPES,
RArray,
RInstance,
RPrimitive,
Expand DownExpand Up@@ -181,7 +182,7 @@ def check_op_sources_valid(fn: FuncIR) -> list[FnError]:
set_rprimitive.name,
tuple_rprimitive.name,
range_rprimitive.name,
}
} | set(KNOWN_NATIVE_TYPES.values())


def can_coerce_to(src: RType, dest: RType) -> bool:
Expand Down
7 changes: 7 additions & 0 deletionsmypyc/build.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -492,6 +492,7 @@ def mypycify(
strict_dunder_typing: bool = False,
group_name: str | None = None,
log_trace: bool = False,
include_native_lib: bool = False,
) -> list[Extension]:
"""Main entry point to building using mypyc.

Expand DownExpand Up@@ -652,5 +653,11 @@ def mypycify(
extensions.extend(
build_single_module(group_sources, cfilenames + shared_cfilenames, cflags)
)
if include_native_lib:
extensions.append(
get_extension()(
"native_buffer", sources=[os.path.join(include_dir(), "native_buffer_internal.c")]
)
)

return extensions
3 changes: 2 additions & 1 deletionmypyc/codegen/emit.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@
is_int64_rprimitive,
is_int_rprimitive,
is_list_rprimitive,
is_native_rprimitive,
is_none_rprimitive,
is_object_rprimitive,
is_optional_type,
Expand DownExpand Up@@ -704,7 +705,7 @@ def emit_cast(
self.emit_lines(f" {dest} = {src};", "else {")
self.emit_cast_error_handler(error, src, dest, typ, raise_exception)
self.emit_line("}")
elif is_object_rprimitive(typ):
elif is_object_rprimitive(typ) or is_native_rprimitive(typ):
if declare_dest:
self.emit_line(f"PyObject *{dest};")
self.emit_arg_check(src, dest, typ, "", optional)
Expand Down
1 change: 1 addition & 0 deletionsmypyc/common.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,7 @@
"misc_ops.c",
"generic_ops.c",
"pythonsupport.c",
"native_buffer_internal.c",
]

# Python 3.12 introduced immortal objects, specified via a special reference count
Expand Down
9 changes: 9 additions & 0 deletionsmypyc/ir/rtypes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -512,6 +512,15 @@ def __hash__(self) -> int:
# Python range object.
range_rprimitive: Final = RPrimitive("builtins.range", is_unboxed=False, is_refcounted=True)

KNOWN_NATIVE_TYPES: Final = {
name: RPrimitive(name, is_unboxed=False, is_refcounted=True)
for name in ["native_buffer.Buffer"]
}


def is_native_rprimitive(rtype: RType) -> bool:
return isinstance(rtype, RPrimitive) and rtype.name in KNOWN_NATIVE_TYPES


def is_tagged(rtype: RType) -> bool:
return rtype is int_rprimitive or rtype is short_int_rprimitive
Expand Down
3 changes: 3 additions & 0 deletionsmypyc/irbuild/mapper.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@
from mypyc.ir.class_ir import ClassIR
from mypyc.ir.func_ir import FuncDecl, FuncSignature, RuntimeArg
from mypyc.ir.rtypes import (
KNOWN_NATIVE_TYPES,
RInstance,
RTuple,
RType,
Expand DownExpand Up@@ -119,6 +120,8 @@ def type_to_rtype(self, typ: Type | None) -> RType:
return int16_rprimitive
elif typ.type.fullname == "mypy_extensions.u8":
return uint8_rprimitive
elif typ.type.fullname in KNOWN_NATIVE_TYPES:
return KNOWN_NATIVE_TYPES[typ.type.fullname]
else:
return object_rprimitive
elif isinstance(typ, TupleType):
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp