Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
3022-gen-Trick-compiler-into-optimizing-gen-sen...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3022-gen-Trick-compiler-into-optimizing-gen-send_request-.patch of Package erlang
From 39511add6a822fe217dff3a54fa7c3bf17477741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Thu, 26 Jan 2023 19:08:29 +0100 Subject: [PATCH 2/2] gen: Trick compiler into optimizing gen:send_request/3 et al Now that we support returning receive markers from functions, we can trick the compiler into enabling receive optimizations in gen:send_request/3, gen:wait_response/2, and gen:receive_response/2. --- lib/stdlib/src/gen.erl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/stdlib/src/gen.erl b/lib/stdlib/src/gen.erl index 363094fb15..d167aee9da 100644 --- a/lib/stdlib/src/gen.erl +++ b/lib/stdlib/src/gen.erl @@ -40,6 +40,8 @@ -export([format_status_header/2, format_status/4]). +-export(['@wait_response_recv_opt'/3]). + -define(MAX_INT_TIMEOUT, 4294967295). -define(default_timeout, 5000). @@ -313,6 +315,17 @@ do_send_request(Process, Tag, Request) -> _ = erlang:send(Process, {Tag, {self(), [alias|ReqId]}, Request}, [noconnect]), ReqId. +-spec '@wait_response_recv_opt'(term(), term(), term()) -> ok. +'@wait_response_recv_opt'(Process, Tag, Request) -> + %% Enables reference optimization in wait_response/2 and + %% receive_response/2 + %% + %% This never actually runs and is only used to trigger the optimization, + %% see the module comment in beam_ssa_recv for details. + _ = wait_response(send_request(Process, Tag, Request), infinity), + _ = receive_response(send_request(Process, Tag, Request), infinity), + ok. + %% %% Wait for a reply to the client. %% Note: if timeout is returned monitors are kept. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor