Fix unused local scope codegen#212
Open
gshaowei6 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #96.
BlockWriterpreviously threwCodeGenException: outOfScope...when javac emitted a store for an unused local at the end of a scope but omitted the corresponding LocalVariableTable entry. In that case the bytecode still contains the RHS expression, but there is no recoverable local name/type to declare in generated OpenCL.This patch preserves the RHS expression for any potential side effects and suppresses the unrecoverable local assignment instead of throwing. It also enables the ignored
ArbitraryScopeTestand updatesNonNullCheckTest, which is the same unused-local-at-end-of-scope pattern.Tests:
@IgnorefromArbitraryScopeTest,mvn "-Dtest=com.aparapi.codegen.test.ArbitraryScopeTest" testfailed withCodeGenException: outOfScope193 =before the fix.mvn "-Dtest=com.aparapi.codegen.test.ArbitraryScopeTest,com.aparapi.codegen.test.NonNullCheckTest,com.aparapi.codegen.test.NullCheckTest,com.aparapi.codegen.test.ArbitraryScopeSimpleTest,com.aparapi.codegen.test.ArbitraryScope2Test" test(10 tests, 0 failures)mvn "-Dtest=com.aparapi.codegen.test.*Test" testcompleted;target/surefire-reportscontains 434 tests, 0 failures, 0 errors, 2 skippedgit diff --check