Skip to content

Make instruction.next mutable in Mach#629

Closed
mshinwell wants to merge 1 commit intoocaml:trunkfrom
mshinwell:mach_mutable
Closed

Make instruction.next mutable in Mach#629
mshinwell wants to merge 1 commit intoocaml:trunkfrom
mshinwell:mach_mutable

Conversation

@mshinwell
Copy link
Copy Markdown
Contributor

Insertion of instrumentation code on Mach is complicated by the use of singly-linked lists, in reverse order, with no means of obtaining a reference to the "next" field (since it is a mutable field in a record).

I propose to make the next field in Mach.instruction mutable, which makes this task significantly easier.

@damiendoligez
Copy link
Copy Markdown
Member

Looks good. Does any back-end expert have an opinion?

@xavierleroy
Copy link
Copy Markdown
Contributor

I could have an opinion if I saw some of the instrumentation code in question. Why is it problematic to rebuild a new immutable list with the instrumentation code inserted in the right places? In-place mutation is always more error-prone, so I'm not encouraging anyone to go down this path.

@mshinwell
Copy link
Copy Markdown
Contributor Author

@mshinwell
Copy link
Copy Markdown
Contributor Author

I've figured out another way of doing this, I think, which doesn't require making it mutable. I will re-open this if it fails.

@mshinwell mshinwell closed this Jul 4, 2016
EduardoRFS pushed a commit to esy-ocaml/ocaml that referenced this pull request Dec 17, 2021
stedolan pushed a commit to stedolan/ocaml that referenced this pull request May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants