@@ -43,6 +43,11 @@ class StackMapTable extends Attribute
4343 */
4444 protected $ localVariables ;
4545
46+ /**
47+ * @var FullFrame[]
48+ */
49+ protected $ entries = [];
50+
4651 public function setOperation (array $ operations ): self
4752 {
4853 $ this ->validateOperationArray ($ operations );
@@ -75,16 +80,8 @@ public function beginPreparation(): Attribute
7580 break ;
7681 }
7782 }
78- return parent ::beginPreparation ();
79- }
80-
81- public function getValue (): string
82- {
83- $ writer = new BinaryWriter (
84- fopen ('php://memory ' , 'r+ ' )
85- );
8683
87- $ entries = [];
84+ $ this -> entries = [];
8885
8986 $ programCounter = 0 ;
9087 $ effectiveProgramCounter = null ;
@@ -110,7 +107,7 @@ public function getValue(): string
110107 * @var AbstractOperationCode $mnemonic
111108 */
112109 $ mnemonic = Runtime::EMULATOR_MNEMONIC_NAMESPACE . '\\' . $ operation ->getMnemonic ();
113- $ executor = (new $ mnemonic ($ operation , $ emulatedAccumulator , $ programCounter ));
110+ $ executor = (new $ mnemonic ($ operation , $ emulatedAccumulator , $ programCounter ));
114111
115112 // Execute emulated operation.
116113 $ executor
@@ -119,7 +116,27 @@ public function getValue(): string
119116 ->execute ();
120117 }
121118
122- $ entries = $ emulatedAccumulator ->getFrames ();
119+ $ this ->entries = $ emulatedAccumulator ->getFrames ();
120+
121+ if (!empty ($ this ->entries )) {
122+ foreach ($ this ->getStore ()->getAll () as $ variableName => $ variable ) {
123+ [$ index , $ classType , $ dimensionsOfArray ] = $ variable ;
124+ $ classType = Formatter::buildSignature ($ classType , $ dimensionsOfArray );
125+ $ this ->getEnhancedConstantPool ()
126+ ->addClass ($ classType );
127+ }
128+ }
129+
130+ return parent ::beginPreparation ();
131+ }
132+
133+ public function getValue (): string
134+ {
135+ $ writer = new BinaryWriter (
136+ fopen ('php://memory ' , 'r+ ' )
137+ );
138+
139+ $ entries = $ this ->entries ;
123140
124141 // Set verified entries
125142 usort (
0 commit comments