From 0346dee5b5d229762fe1a35c6f48a6573d47b683 Mon Sep 17 00:00:00 2001 From: memory-agape Date: Sat, 11 May 2019 15:23:39 +0900 Subject: [PATCH 1/2] Remove preload option --- README-ja.md | 1 - README.md | 1 - src/Core/JVM/Parameters/Runtime.php | 1 - src/Core/JavaArchive.php | 17 +++-------------- 4 files changed, 3 insertions(+), 17 deletions(-) diff --git a/README-ja.md b/README-ja.md index 495d1aa8..fbfcf5a0 100644 --- a/README-ja.md +++ b/README-ja.md @@ -301,7 +301,6 @@ $javaClass = new JavaClass( | max_stack_exceeded | integer | 9999 | オペレーションを最大何回実行できるかを指定します。 | JavaClass | | max_execution_time | integer | 30 | 最大実行時間を指定します。 | JavaClass | | strict | boolean | true | このオプションが `true` の場合、 PHPJava はメソッド、変数などを厳格に評価し実行します。 `false` の場合は、曖昧に評価して実行します。. | Both | -| preload | boolean | false | このオプションが `true` の場合、 Jar 実行時に定義されている JavaClass を予めメモリ上にマッピング(プリロード)させることにより、処理速度が向上させます。ただし、この機能が有効である場合、 Jar が巨大であると メモリを多く消費します。また、それ以外の場合は、必要に応じてクラスを遅延ロードします。 | JavaArchive | | validation.method.arguments_count_only | boolean | false | このオプションが `true` の場合、 クラス解決をして、メソッドを呼び出す際に、引数の数のみを比較します。 | JavaClass | | operations.enable_trace | boolean | false | このオプションが `true` の場合、 PHPJava はオペレーションの実行ログを記録します。 | JavaClass | | operations.temporary_code_stream | string | php://memory | 実行用のバイトコードの一時保存先を指定します。 | JavaClass | diff --git a/README.md b/README.md index 047c4779..8a98db1c 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,6 @@ $javaClass = new JavaClass( | max_stack_exceeded | integer | 9999 | Execute more than the specified number of times be stopped the operation. | JavaClass | | max_execution_time | integer | 30 | Maximum execution time. | JavaClass | | strict | boolean | true | When `true`, PHPJava calls a method, variables, and so on strictly; otherwise, it calls them ambiguously. | Both | -| preload | boolean | false | When `true`, PHPJava pre-reads JavaClasses when emulating JAR. This may consume larger size of memory depending on the size of the JAR file; otherwise, JavaArchive defers loading. | JavaArchive | | validation.method.arguments_count_only | boolean | false | When `true`, ClassResolver validates arguments by their number only. | JavaClass | | operations.enable_trace | boolean | false | When `true`, PHPJava stores the operation history. | JavaClass | | operations.temporary_code_stream | string | php://memory | Operation code will be output to temporary stream. Change this if your code is heavy so you'll be happy. | JavaClass | diff --git a/src/Core/JVM/Parameters/Runtime.php b/src/Core/JVM/Parameters/Runtime.php index ccda5035..ba873092 100644 --- a/src/Core/JVM/Parameters/Runtime.php +++ b/src/Core/JVM/Parameters/Runtime.php @@ -10,7 +10,6 @@ final class Runtime const MAX_STACK_EXCEEDED = 9999; const MAX_EXECUTION_TIME = 5; const STRICT = true; - const PRELOAD = false; const DRY_RUN_ATTRIBUTE = false; const OPERATIONS_ENABLE_TRACE = false; diff --git a/src/Core/JavaArchive.php b/src/Core/JavaArchive.php index df845513..aec673da 100644 --- a/src/Core/JavaArchive.php +++ b/src/Core/JavaArchive.php @@ -102,20 +102,9 @@ function ($fileName) { continue; } $classPath = str_replace('/', '.', $className); - if (!($this->options['preload'] ?? GlobalOptions::get('preload') ?? Runtime::PRELOAD)) { - $this->classes[$classPath] = new JavaClassDeferredLoader( - InlineReader::class, - [$className, $code], - $this->options - ); - continue; - } - - $this->classes[$classPath] = new JavaClass( - new InlineReader( - $className, - $code - ), + $this->classes[$classPath] = new JavaClassDeferredLoader( + InlineReader::class, + [$className, $code], $this->options ); } From c0d55e16864c32e3e1a2bd936a74607398c4492f Mon Sep 17 00:00:00 2001 From: memory-agape Date: Sat, 11 May 2019 15:38:02 +0900 Subject: [PATCH 2/2] Fix syntax [ci skip] --- src/Core/JavaArchive.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Core/JavaArchive.php b/src/Core/JavaArchive.php index aec673da..14941e77 100644 --- a/src/Core/JavaArchive.php +++ b/src/Core/JavaArchive.php @@ -1,7 +1,6 @@