Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reinier Maas
GHC
Commits
e5886de5
Commit
e5886de5
authored
1 year ago
by
Ben Gamari
Committed by
Marge Bot
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
rts/AdjustorPool: Use ExecPage abstraction
This is just a minor cleanup I found while reviewing the implementation.
parent
0f40d68f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rts/adjustor/AdjustorPool.c
+7
-6
7 additions, 6 deletions
rts/adjustor/AdjustorPool.c
with
7 additions
and
6 deletions
rts/adjustor/AdjustorPool.c
+
7
−
6
View file @
e5886de5
...
...
@@ -291,12 +291,13 @@ free_adjustor(void *adjustor, void *context) {
/* Must hold owner->lock */
static
struct
AdjustorChunk
*
alloc_adjustor_chunk
(
struct
AdjustorPool
*
owner
)
{
size_t
pg_sz
=
getPageSize
();
struct
AdjustorExecPage
*
exec_page
=
mmapAnonForLinker
(
pg_sz
);
ExecPage
*
exec_page
=
allocateExecPage
();
if
(
exec_page
==
NULL
)
{
barf
(
"alloc_adjustor_chunk: failed to allocate"
);
}
exec_page
->
magic
=
ADJUSTOR_EXEC_PAGE_MAGIC
;
struct
AdjustorExecPage
*
adj_page
=
(
struct
AdjustorExecPage
*
)
exec_page
;
adj_page
->
magic
=
ADJUSTOR_EXEC_PAGE_MAGIC
;
// N.B. pad bitmap to ensure that .contexts is aligned.
size_t
bitmap_sz
=
ROUND_UP
(
owner
->
chunk_slots
,
8
*
sizeof
(
void
*
))
/
8
;
...
...
@@ -307,7 +308,7 @@ alloc_adjustor_chunk(struct AdjustorPool *owner) {
chunk
->
first_free
=
0
;
chunk
->
contexts
=
(
struct
AdjustorContext
*
)
(
chunk
->
slot_bitmap
+
bitmap_sz
);
chunk
->
free_list_next
=
NULL
;
chunk
->
exec_page
=
exec
_page
;
chunk
->
exec_page
=
adj
_page
;
chunk
->
exec_page
->
owner
=
chunk
;
// initialize the slot bitmap
...
...
@@ -317,13 +318,13 @@ alloc_adjustor_chunk(struct AdjustorPool *owner) {
size_t
code_sz
=
owner
->
adjustor_code_size
;
for
(
size_t
i
=
0
;
i
<
owner
->
chunk_slots
;
i
++
)
{
owner
->
make_code
(
&
exec
_page
->
adjustor_code
[
i
*
code_sz
],
&
adj
_page
->
adjustor_code
[
i
*
code_sz
],
get_context
(
chunk
,
i
),
owner
->
user_data
);
}
// Remap the executable page as executable
mprotectForLinker
(
exec_page
,
pg_sz
,
MEM_READ_EXECUTE
);
freezeExecPage
(
exec_page
);
return
chunk
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment