1414use PHPJava \Exceptions \RuntimeException ;
1515use PHPJava \Exceptions \UndefinedMethodException ;
1616use PHPJava \Exceptions \UndefinedOpCodeException ;
17+ use PHPJava \Kernel \Provider \DependencyInjectionProvider ;
1718use PHPJava \Packages \java \lang \NoSuchMethodException ;
1819use PHPJava \Kernel \Attributes \AttributeInfo ;
1920use PHPJava \Kernel \Attributes \AttributeInterface ;
@@ -149,7 +150,11 @@ function () use ($name, $arguments) {
149150 $ executionTime = microtime (true );
150151 $ maxExecutionTime = ($ this ->options ['max_execution_time ' ] ?? GlobalOptions::get ('max_execution_time ' ) ?? Runtime::MAX_EXECUTION_TIME );
151152
152- $ methodBeautified = Formatter::beatifyMethodFromConstantPool ($ method , $ currentConstantPool );
153+ $ methodBeautified = Formatter::beatifyMethodFromConstantPool (
154+ $ method ,
155+ $ currentConstantPool
156+ );
157+
153158 $ this ->debugTool ->getLogger ()->info ('Start operations: ' . $ methodBeautified );
154159
155160 $ localStorage = array_map (
@@ -159,17 +164,33 @@ function ($item) {
159164 $ localStorage
160165 );
161166
162- $ this ->debugTool ->getLogger ()->debug (
163- vsprintf (
164- 'Used Memory: %s, Used Memory Peak: %s ' ,
165- [
166- Metric::bytes (memory_get_usage ())->format (),
167- Metric::bytes (memory_get_peak_usage ())->format (),
168- ]
167+ $ dependencyInjectionProvider = (new DependencyInjectionProvider ())
168+ ->add (
169+ 'ConstantPool ' ,
170+ $ currentConstantPool
169171 )
170- );
172+ ->add (
173+ 'JavaClass ' ,
174+ $ this ->javaClassInvoker ->getJavaClass ()
175+ )
176+ ->add (
177+ 'JavaClassInvoker ' ,
178+ $ this ->javaClassInvoker
179+ )
180+ ->add (
181+ 'Attributes ' ,
182+ $ method ->getAttributes ()
183+ )
184+ ->add (
185+ 'Options ' ,
186+ $ this ->options
187+ );
171188
172189 while ($ reader ->getOffset () < $ codeAttribute ->getOpCodeLength ()) {
190+ $ dependencyInjectionProvider
191+ ->add ('OperandStacks ' , $ stacks )
192+ ->add ('LocalStorages ' , $ localStorage );
193+
173194 if (++$ executedCounter > ($ this ->options ['max_stack_exceeded ' ] ?? GlobalOptions::get ('max_stack_exceeded ' ) ?? Runtime::MAX_STACK_EXCEEDED )) {
174195 throw new RuntimeException (
175196 'Max stack exceeded. PHPJava has been stopped by safety guard. ' .
@@ -241,7 +262,8 @@ function () use ($fullName) {
241262 $ reader ,
242263 $ localStorage ,
243264 $ stacks ,
244- $ pointer
265+ $ pointer ,
266+ $ dependencyInjectionProvider
245267 )
246268 ->execute ();
247269
0 commit comments