-
Notifications
You must be signed in to change notification settings - Fork 284
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
7af4694
to
f2fab02
Compare
f2fab02
to
4f59b42
Compare
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, | ||
}, | ||
}); |
There was a problem hiding this comment.
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>([ |
There was a problem hiding this comment.
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 ;)
Resolved by #9582 |
No description provided.