Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: change AVM PC to byte indexed #9386

Closed
wants to merge 1 commit into from
Closed

Conversation

dbanks12
Copy link
Collaborator

No description provided.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @dbanks12 and the rest of your teammates on Graphite Graphite

Comment on lines 98 to +110
deserialize: (buf: BufferCursor | Buffer): Instruction => {
const res = deserialize(buf, wireFormat);
const args = res.slice(1); // Remove opcode.
return new this(...args);
const instance = new this(...args);
// Need to make sure that deserialized instances can getSize
return Object.defineProperties(instance, {
getSize: {
value: (): number => {
return getInstructionSize(wireFormat);
},
enumerable: false,
},
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ugly.... Is there some way I can get around needing to do this Object.defineProperties() INSIDE an Object.assign(). I'm having trouble thinking of better ways to handle this.

@@ -100,6 +100,25 @@ export enum OperandType {
type OperandNativeType = number | bigint;
type OperandWriter = (value: any) => void;

// Number of bytes that each operand takes up in an instruction
export const OPERAND_SIZE_BYTES = new Map<OperandType, number>([
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only realized now but these are the numbers in OPERAND_SPEC ;)

@dbanks12
Copy link
Collaborator Author

dbanks12 commented Nov 8, 2024

Resolved by #9582

@dbanks12 dbanks12 closed this Nov 8, 2024
@dbanks12 dbanks12 deleted the db/pc-byte-indexed branch November 21, 2024 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants