Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't print assembly code when running benchmarks on Aarch64 #20

Closed
20152101001 opened this issue Jul 2, 2020 · 4 comments
Closed

Can't print assembly code when running benchmarks on Aarch64 #20

20152101001 opened this issue Jul 2, 2020 · 4 comments

Comments

@20152101001
Copy link

When using Maxine vm on Aarch64,I ran some benchmark such as scimark and Dacapo. When I tried to run the benchmark with using option C1X:+PrintAssembly or -C1X:+PrintCFGToFile, it will show error:

FatalError: stack reset position two
Compilation of java.io.UnixFileSystem.checkAccess(File, int) by T1X failed (final attempt)

The detailed error log is upload as an attached file.
error message.txt

@kotselidis
Copy link
Member

Thank you for reporting this issue, @gigiblender can you please check if we can replicate this behaviour?

@gigiblender
Copy link
Member

@kotselidis yes, I will have a look in the following days

@gigiblender
Copy link
Member

gigiblender commented Jul 25, 2020

The problem is replicable on Aarch64. The issue is generated by a compilation failure of UnixFileSystem::checkAccess caused by an NPE in C1X. T1X is expected to fail because it cannot compile methods annotated with FOLD.

C1X fails with the stack trace below. C1X calls the ObjdumpDisassembler::disassemble method which uses a temporary file to get the output of objdump. In order to create the temporary file, the class initializer of java.io.File$TempDirectory.<clinit> is called, which in turn will initialize an instance of SecureRandom. The initialization of SecureRandom will trigger inside the current compilation another compilation of UnixFileSystem::checkAccess. The second compilation is successful, but when it tries to disassemble, it tries to create another temporary file and accesses the random field of java.io.File$TempDirectory.<clinit> still in the context of the SecureRandom.<init> (which is not yet initialized).

main[id=1]: C1X: Failed java.io.UnixFileSystem.checkAccess(File, int)
main[id=1]: Compilation of java.io.UnixFileSystem.checkAccess(File, int) by C1X failed with:
com.sun.cri.ci.CiBailout: Exception while compiling: java.io.UnixFileSystem.checkAccess(File, int)
	at com.sun.c1x.C1XCompilation.compile(C1XCompilation.java:229)
	at com.sun.c1x.C1XCompiler.compileMethod(C1XCompiler.java:108)
	at com.oracle.max.vm.ext.c1x.C1X.compile(C1X.java:257)
	at com.sun.max.vm.compiler.target.Compilation.compile(Compilation.java:295)
	at com.sun.max.vm.compiler.CompilationBroker.compile(CompilationBroker.java:490)
	at com.sun.max.vm.compiler.CompilationBroker.compile(CompilationBroker.java:432) --> trigger another compilation of UnixFileSystem.checkAccess
	at com.sun.max.vm.actor.member.ClassMethodActor.makeTargetMethod(ClassMethodActor.java:462)
	at com.sun.max.vm.actor.member.ClassMethodActor.makeTargetMethod(ClassMethodActor.java:442)
	at com.sun.max.vm.compiler.target.Stubs.resolveVirtualCall(Stubs.java:379)
	at java.io.File.canRead(File.java:768) --> lookup UnixFileSystem.checkAccess
	at sun.security.provider.NativePRNG$1.run(NativePRNG.java:151)
	at sun.security.provider.NativePRNG$1.run(NativePRNG.java:130)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.security.provider.NativePRNG.initIO(NativePRNG.java:129)
	at sun.security.provider.NativePRNG.<clinit>(NativePRNG.java:93)
	at com.sun.max.vm.actor.member.MethodActor.invoke(MethodActor.java:491)
	at com.sun.max.vm.actor.holder.ClassActor.callInitializer(ClassActor.java:1638)
	at com.sun.max.vm.actor.holder.ClassActor.makeInitialized(ClassActor.java:1742)
	at sun.security.provider.SunEntries.putEntries(SunEntries.java:101)
	at sun.security.provider.Sun.<init>(Sun.java:56)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:221)
	at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:206)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:206)
	at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:187)
	at sun.security.jca.ProviderList.getProvider(ProviderList.java:233)
	at sun.security.jca.ProviderList$3.get(ProviderList.java:148)
	at sun.security.jca.ProviderList$3.get(ProviderList.java:143)
	at java.util.AbstractList$Itr.next(AbstractList.java:358)
	at java.security.SecureRandom.getPrngAlgorithm(SecureRandom.java:558)
	at java.security.SecureRandom.getDefaultPRNG(SecureRandom.java:194)
	at java.security.SecureRandom.<init>(SecureRandom.java:162) --> initialize the `random` field of `File$TempDirectory`
	at java.io.File$TempDirectory.<clinit>(File.java:1901) --> class initializer for File$TempDirectory
	at com.sun.max.vm.actor.member.MethodActor.invoke(MethodActor.java:491)
	at com.sun.max.vm.actor.holder.ClassActor.callInitializer(ClassActor.java:1638)
	at com.sun.max.vm.actor.holder.ClassActor.makeInitialized(ClassActor.java:1742)
	at com.sun.max.vm.runtime.Snippets.makeClassInitialized(Snippets.java:446)
	at com.oracle.max.vm.ext.maxri.MaxXirGenerator$RuntimeCalls.resolveStaticTuple(MaxXirGenerator.java:2119)
	at java.io.File.createTempFile(File.java:2006)
	at java.io.File.createTempFile(File.java:2070)  ---> try to create the output file for `objdump`
	at com.oracle.max.vm.ext.maxri.ObjdumpDisassembler.disassemble(ObjdumpDisassembler.java:52) ---> call to disassembler
	at com.oracle.max.vm.ext.maxri.MaxRuntime.disassemble(MaxRuntime.java:228)
	at com.oracle.max.vm.ext.maxri.MaxRuntime.disassemble(MaxRuntime.java:221)
	at com.sun.c1x.asm.TargetMethodAssembler.finishTargetMethod(TargetMethodAssembler.java:130)
	at com.sun.c1x.C1XCompilation.emitCode(C1XCompilation.java:293)
	at com.sun.c1x.C1XCompilation.compile(C1XCompilation.java:221)
	at com.sun.c1x.C1XCompiler.compileMethod(C1XCompiler.java:108)   ---> first compilation of `UnixFileSystem.checkAccess`
	at com.oracle.max.vm.ext.c1x.C1X.compile(C1X.java:257)
	at com.sun.max.vm.compiler.target.Compilation.compile(Compilation.java:295)
	at com.sun.max.vm.compiler.CompilationBroker.compile(CompilationBroker.java:490)
	at com.sun.max.vm.compiler.CompilationBroker.compile(CompilationBroker.java:432)
	at com.sun.max.vm.actor.member.ClassMethodActor.makeTargetMethod(ClassMethodActor.java:462)
	at com.sun.max.vm.actor.member.ClassMethodActor.makeTargetMethod(ClassMethodActor.java:442)
	at com.sun.max.vm.compiler.target.Stubs.patchStaticTrampolineCallSiteAarch64(Stubs.java:917)
	at java.lang.invoke.DirectMethodHandle.shouldBeInitialized(DirectMethodHandle.java:319)
	at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(DirectMethodHandle.java:178)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:89)
	at java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:1660)
	at java.lang.invoke.MethodHandles$Lookup.getDirectMethod(MethodHandles.java:1605)
	at java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:781)
	at java.lang.invoke.BoundMethodHandle$Factory.makeCbmhCtor(BoundMethodHandle.java:818)
	at java.lang.invoke.BoundMethodHandle$Factory.makeCtors(BoundMethodHandle.java:763)
	at java.lang.invoke.BoundMethodHandle$SpeciesData.initForBootstrap(BoundMethodHandle.java:361)
	at java.lang.invoke.BoundMethodHandle$SpeciesData.<clinit>(BoundMethodHandle.java:426)
	at com.sun.max.vm.actor.member.MethodActor.invoke(MethodActor.java:491)
	at com.sun.max.vm.actor.holder.ClassActor.callInitializer(ClassActor.java:1638)
	at com.sun.max.vm.actor.holder.ClassActor.makeInitialized(ClassActor.java:1742)
	at com.sun.max.vm.runtime.Snippets.makeClassInitialized(Snippets.java:446)
	at com.sun.max.vm.runtime.Snippets.makeHolderInitialized(Snippets.java:435)
	at com.oracle.max.vm.ext.t1x.T1XTemplateSource.resolveAndGetStaticReference(T1XTemplateSource.java:1763)
	at java.lang.invoke.BoundMethodHandle.<clinit>(BoundMethodHandle.java:830)
	at com.sun.max.vm.actor.member.MethodActor.invoke(MethodActor.java:491)
	at com.sun.max.vm.actor.holder.ClassActor.callInitializer(ClassActor.java:1638)
	at com.sun.max.vm.actor.holder.ClassActor.makeInitialized(ClassActor.java:1742)
	at com.sun.max.vm.actor.holder.ClassActor.makeInitialized(ClassActor.java:1735)
	at java.lang.invoke.LambdaForm.createIdentityForms(LambdaForm.java:1778)
	at java.lang.invoke.LambdaForm.<clinit>(LambdaForm.java:1833)
	at com.sun.max.vm.actor.member.MethodActor.invoke(MethodActor.java:491)
	at com.sun.max.vm.actor.holder.ClassActor.callInitializer(ClassActor.java:1638)
	at com.sun.max.vm.run.java.JavaRunScheme.initialize(JavaRunScheme.java:239)
	at com.sun.max.vm.VMConfiguration.initializeSchemes(VMConfiguration.java:254)
	at com.sun.max.vm.run.java.JavaRunScheme.initializeBasicFeatures(JavaRunScheme.java:296)
	at com.sun.max.vm.run.java.JavaRunScheme.run(JavaRunScheme.java:322)
	at com.sun.max.vm.thread.VmThread.executeRunnable(VmThread.java:505)
	at com.sun.max.vm.thread.VmThread.run(VmThread.java:684)
Caused by: java.lang.NullPointerException
	at java.io.File$TempDirectory.generateFile(File.java:1905) --> we are still in the class initializer of File$TempDirectory and get a  NPE
	at java.io.File.createTempFile(File.java:2010)
	at java.io.File.createTempFile(File.java:2070) --> try to create a second temporary file
	at com.oracle.max.vm.ext.maxri.ObjdumpDisassembler.disassemble(ObjdumpDisassembler.java:52)
	at com.oracle.max.vm.ext.maxri.MaxRuntime.disassemble(MaxRuntime.java:228)
	at com.oracle.max.vm.ext.maxri.MaxRuntime.disassemble(MaxRuntime.java:221) --> call a second time the disassembler 
	at com.sun.c1x.asm.TargetMethodAssembler.finishTargetMethod(TargetMethodAssembler.java:130) --> second compilation of UnixFileSystem.checkAccess finishes
	at com.sun.c1x.C1XCompilation.emitCode(C1XCompilation.java:293)
	at com.sun.c1x.C1XCompilation.compile(C1XCompilation.java:221)
	... 86 more

The reason the issue is not present on x86 is that for this architecture we use the built-in Maxine disassembler

@gigiblender
Copy link
Member

@20152101001, regarding this issue, I do not think Maxine ever supported at runtime the options C1X:+PrintAssembly or -C1X:+PrintCFGToFile for targets other than x86.

However, you should be able to generate T1X/C1X CFGs and aarch64 assembly with offline compilation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants