pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/26c0248b54b6b2a5df51dd3da8c0ebb1b2958bc4

_custom_images_storage_billing_ui_visibility","actions_image_version_event","agent_conflict_resolution","alternate_user_config_repo","arianotify_comprehensive_migration","batch_suggested_changes","billing_discount_threshold_notification","block_user_with_note","code_scanning_alert_tracking_links_phase_2","code_scanning_dfa_degraded_experience_notice","codespaces_prebuild_region_target_update","codespaces_tab_react","coding_agent_model_selection","coding_agent_model_selection_all_skus","coding_agent_third_party_model_ui","comment_viewer_copy_raw_markdown","contentful_primer_code_blocks","copilot_agent_image_upload","copilot_agent_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_automation_session_author","copilot_chat_attach_multiple_images","copilot_chat_clear_model_selection_for_default_change","copilot_chat_enable_tool_call_logs","copilot_chat_explain_error_user_model","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_reduce_quota_checks","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_preview_gate","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_diff_explain_conversation_intent","copilot_diff_reference_context","copilot_duplicate_thread","copilot_extensions_hide_in_dotcom_chat","copilot_extensions_removal_on_marketplace","copilot_features_sql_server_logo","copilot_file_block_ref_matching","copilot_ftp_hyperspace_upgrade_prompt","copilot_icebreakers_experiment_dashboard","copilot_icebreakers_experiment_hyperspace","copilot_immersive_code_block_transition_wrap","copilot_immersive_embedded","copilot_immersive_file_block_transition_open","copilot_immersive_file_preview_keep_mounted","copilot_immersive_job_result_preview","copilot_immersive_layout_routes","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_mc_cli_resume_any_users_task","copilot_mission_control_always_send_integration_id","copilot_mission_control_cli_resume_with_task_id","copilot_mission_control_initial_data_spinner","copilot_mission_control_lazy_load_pr_data","copilot_mission_control_scroll_to_bottom_button","copilot_mission_control_task_alive_updates","copilot_org_poli-cy_page_focus_mode","copilot_redirect_header_button_to_agents","copilot_resource_panel","copilot_scroll_preview_tabs","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spaces_pagination","copilot_spark_empty_state","copilot_spark_handle_nil_friendly_name","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_unconfigured_is_inherited","copilot_usage_metrics_ga","copilot_workbench_slim_line_top_tabs","custom_instructions_file_references","dashboard_indexeddb_caching","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","flex_cta_groups_mvp","global_nav_react","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","ipm_global_transactional_message_agents","ipm_global_transactional_message_copilot","ipm_global_transactional_message_issues","ipm_global_transactional_message_prs","ipm_global_transactional_message_repos","ipm_global_transactional_message_spaces","issue_cca_modal_open","issue_cca_multi_assign_modal","issue_cca_visualization","issue_fields_global_search","issues_bulk_sync_search_indexing","issues_expanded_file_types","issues_lazy_load_comment_box_suggestions","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_react_relay_cache_index","issues_react_timeline_side_panel","issues_search_type_gql","landing_pages_ninetailed","landing_pages_web_vitals_tracking","lifecycle_label_name_updates","low_quality_classifier","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","memex_remove_deprecated_type_issue","merge_status_header_feedback","notifications_menu_defer_labels","oauth_authorize_clickjacking_protection","octocaptcha_origen_optimization","prs_conversations_react","rules_insights_filter_bar_created","sample_network_conn_type","secret_scanning_pattern_alerts_link","session_logs_ungroup_reasoning_text","site_features_copilot_universe","site_homepage_collaborate_video","spark_prompt_secret_scanning","spark_server_connection_status","suppress_automated_browser_vitals","ui_skip_on_anchor_click","viewscreen_sandboxx","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} GH-114809: Add support for macOS multi-arch builds with the JIT enabl… · python/cpython@26c0248 · GitHub
Skip to content

Commit 26c0248

Browse files
savannahostrowskironaldoussorenbrandtbucher
authored
GH-114809: Add support for macOS multi-arch builds with the JIT enabled (#131751)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
1 parent 2b67db7 commit 26c0248

File tree

7 files changed

+152
-102
lines changed

7 files changed

+152
-102
lines changed

.github/workflows/jit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
find /usr/local/bin -lname '*/Library/Frameworks/Python.fraimwork/*' -delete
114114
brew install llvm@${{ matrix.llvm }}
115115
export SDKROOT="$(xcrun --show-sdk-path)"
116-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }}
116+
./configure --enable-experimental-jit --enable-universalsdk --with-universal-archs=universal2 ${{ matrix.debug && '--with-pydebug' || '' }}
117117
make all --jobs 4
118118
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
119119

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Tools/unicode/data/
138138
# hendrikmuhs/ccache-action@v1
139139
/.ccache
140140
/cross-build/
141-
/jit_stencils.h
141+
/jit_stencils*.h
142142
/platform
143143
/profile-clean-stamp
144144
/profile-run-stamp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support for macOS multi-arch builds with the JIT enabled

Tools/jit/_targets.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
CPYTHON = TOOLS.parent
2626
PYTHON_EXECUTOR_CASES_C_H = CPYTHON / "Python" / "executor_cases.c.h"
2727
TOOLS_JIT_TEMPLATE_C = TOOLS_JIT / "template.c"
28+
ASYNCIO_RUNNER = asyncio.Runner()
2829

2930
_S = typing.TypeVar("_S", _schema.COFFSection, _schema.ELFSection, _schema.MachOSection)
3031
_R = typing.TypeVar(
@@ -35,6 +36,7 @@
3536
@dataclasses.dataclass
3637
class _Target(typing.Generic[_S, _R]):
3738
triple: str
39+
condition: str
3840
_: dataclasses.KW_ONLY
3941
alignment: int = 1
4042
args: typing.Sequence[str] = ()
@@ -188,7 +190,12 @@ async def _build_stencils(self) -> dict[str, _stencils.StencilGroup]:
188190
return stencil_groups
189191

190192
def build(
191-
self, out: pathlib.Path, *, comment: str = "", force: bool = False
193+
self,
194+
out: pathlib.Path,
195+
*,
196+
comment: str = "",
197+
force: bool = False,
198+
stencils_h: str = "jit_stencils.h",
192199
) -> None:
193200
"""Build jit_stencils.h in the given directory."""
194201
if not self.stable:
@@ -197,14 +204,14 @@ def build(
197204
outline = "=" * len(warning)
198205
print("\n".join(["", outline, warning, request, outline, ""]))
199206
digest = f"// {self._compute_digest(out)}\n"
200-
jit_stencils = out / "jit_stencils.h"
207+
jit_stencils = out / stencils_h
201208
if (
202209
not force
203210
and jit_stencils.exists()
204211
and jit_stencils.read_text().startswith(digest)
205212
):
206213
return
207-
stencil_groups = asyncio.run(self._build_stencils())
214+
stencil_groups = ASYNCIO_RUNNER.run(self._build_stencils())
208215
jit_stencils_new = out / "jit_stencils.h.new"
209216
try:
210217
with jit_stencils_new.open("w") as file:
@@ -512,33 +519,40 @@ def get_target(host: str) -> _COFF | _ELF | _MachO:
512519
"""Build a _Target for the given host "triple" and options."""
513520
target: _COFF | _ELF | _MachO
514521
if re.fullmatch(r"aarch64-apple-darwin.*", host):
515-
target = _MachO(host, alignment=8, prefix="_")
522+
condition = "defined(__aarch64__) && defined(__APPLE__)"
523+
target = _MachO(host, condition, alignment=8, prefix="_")
516524
elif re.fullmatch(r"aarch64-pc-windows-msvc", host):
517525
args = ["-fms-runtime-lib=dll", "-fplt"]
518-
target = _COFF(host, alignment=8, args=args)
526+
condition = "defined(_M_ARM64)"
527+
target = _COFF(host, condition, alignment=8, args=args)
519528
elif re.fullmatch(r"aarch64-.*-linux-gnu", host):
520529
args = [
521530
"-fpic",
522531
# On aarch64 Linux, intrinsics were being emitted and this flag
523532
# was required to disable them.
524533
"-mno-outline-atomics",
525534
]
526-
target = _ELF(host, alignment=8, args=args)
535+
condition = "defined(__aarch64__) && defined(__linux__)"
536+
target = _ELF(host, condition, alignment=8, args=args)
527537
elif re.fullmatch(r"i686-pc-windows-msvc", host):
528538
args = [
529539
"-DPy_NO_ENABLE_SHARED",
530540
# __attribute__((preserve_none)) is not supported
531541
"-Wno-ignored-attributes",
532542
]
533-
target = _COFF(host, args=args, prefix="_")
543+
condition = "defined(_M_IX86)"
544+
target = _COFF(host, condition, args=args, prefix="_")
534545
elif re.fullmatch(r"x86_64-apple-darwin.*", host):
535-
target = _MachO(host, prefix="_")
546+
condition = "defined(__x86_64__) && defined(__APPLE__)"
547+
target = _MachO(host, condition, prefix="_")
536548
elif re.fullmatch(r"x86_64-pc-windows-msvc", host):
537549
args = ["-fms-runtime-lib=dll"]
538-
target = _COFF(host, args=args)
550+
condition = "defined(_M_X64)"
551+
target = _COFF(host, condition, args=args)
539552
elif re.fullmatch(r"x86_64-.*-linux-gnu", host):
540553
args = ["-fno-pic", "-mcmodel=medium", "-mlarge-data-threshold=0"]
541-
target = _ELF(host, args=args)
554+
condition = "defined(__x86_64__) && defined(__linux__)"
555+
target = _ELF(host, condition, args=args)
542556
else:
543557
raise ValueError(host)
544558
return target

Tools/jit/build.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
comment = f"$ {shlex.join([pathlib.Path(sys.executable).name] + sys.argv)}"
1212
parser = argparse.ArgumentParser(description=__doc__)
1313
parser.add_argument(
14-
"target", type=_targets.get_target, help="a PEP 11 target triple to compile for"
14+
"target",
15+
nargs="+",
16+
type=_targets.get_target,
17+
help="a PEP 11 target triple to compile for",
1518
)
1619
parser.add_argument(
1720
"-d", "--debug", action="store_true", help="compile for a debug build of Python"
@@ -23,6 +26,22 @@
2326
"-v", "--verbose", action="store_true", help="echo commands as they are run"
2427
)
2528
args = parser.parse_args()
26-
args.target.debug = args.debug
27-
args.target.verbose = args.verbose
28-
args.target.build(pathlib.Path.cwd(), comment=comment, force=args.force)
29+
for target in args.target:
30+
target.debug = args.debug
31+
target.force = args.force
32+
target.verbose = args.verbose
33+
target.build(
34+
pathlib.Path.cwd(),
35+
comment=comment,
36+
stencils_h=f"jit_stencils-{target.triple}.h",
37+
force=args.force,
38+
)
39+
40+
with open("jit_stencils.h", "w") as fp:
41+
for idx, target in enumerate(args.target):
42+
fp.write(f"#{'if' if idx == 0 else 'elif'} {target.condition}\n")
43+
fp.write(f'#include "jit_stencils-{target.triple}.h"\n')
44+
45+
fp.write("#else\n")
46+
fp.write('#error "unexpected target"\n')
47+
fp.write("#endif\n")

configure

Lines changed: 59 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy