Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Conversation

@AdamClements
Copy link

Move monitor-enter outside try block, if the monitor-enter fails to acquire the lock, we should not attempt to release it.

@alexander-yakushev
Copy link

Nice! Have you found out why this is a problem on ART?

@AdamClements
Copy link
Author

Yeah, the dex2oat compiler does additional static analysis and verification on the generated bytecode. JVM is fine with this, but ART is stricter and I think it is actually a clojure bug.

In debug mode it seems to do a few extra runtime checks too, it's thrown up a number of subtle type bugs in my own code that weren't an issue in dalvik and do actually run fine in release mode, but debug mode flags them up.

@alexander-yakushev
Copy link

OK, thanks for clarification! Merged.

I don't know if it's Clojure bug, to me putting monitor-enter call inside try seems reasonable (although I don't know if monitor-enter can throw an exception). Could you possibly submit an issue to JIRA?

alexander-yakushev added a commit that referenced this pull request Jul 24, 2014
Fix verification error on ART runtime
@alexander-yakushev alexander-yakushev merged commit cdca791 into clojure-android:android Jul 24, 2014
@AdamClements
Copy link
Author

Already done: http://dev.clojure.org/jira/browse/CLJ-1472

And it's standard practice when locking something and releasing it in a finally, not to include the lock in the try, or you'd be unlocking something you haven't yet locked if the initial locking fails, which is broken behaviour.

@alexander-yakushev
Copy link

Makes sense, let's see what they say on JIRA.

@Tirael90 Tirael90 mentioned this pull request Nov 19, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants