Skip to content

Commit

Permalink
Cache binary encoding in ProcessorInstructionDeclaration
Browse files Browse the repository at this point in the history
This commit caches encoding bitvector in ProcessorInstructionDeclaration
instead of creating it on demand.

This change speeds up decoding of ~170 instructions from ~35secs to
~15 secs (which is still appalling).
  • Loading branch information
janvrany authored and shingarov committed Sep 4, 2024
1 parent 790dbe3 commit 5ec65b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/ArchC-Core/ProcessorInstruction.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ When the PDL spec is initially parsed, the ""instrictions"" Dictionary is filled
Class {
#name : #ProcessorInstruction,
#superclass : #ProcessorInstructionDeclaration,
#instVars : [
'binaryEncoding'
],
#category : #'ArchC-Core-Core'
}

Expand Down
8 changes: 6 additions & 2 deletions src/ArchC-Core/ProcessorInstructionDeclaration.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Class {
'format',
'internalBindings',
'syntax',
'isa'
'isa',
'binaryEncoding'
],
#classVars : [
'EmptyBindings'
Expand Down Expand Up @@ -132,7 +133,10 @@ ProcessorInstructionDeclaration >> assertInvariants [

{ #category : #accessing }
ProcessorInstructionDeclaration >> binaryEncoding [
^format binaryEncoding inEnvironment: internalBindings
binaryEncoding isNil ifTrue: [
binaryEncoding := format binaryEncoding inEnvironment: internalBindings.
].
^ binaryEncoding
]

{ #category : #accessing }
Expand Down

0 comments on commit 5ec65b7

Please sign in to comment.