You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Pavel Pervov <pm...@gmail.com> on 2006/12/18 16:30:28 UTC
[drlvm][jit] VM-JIT interface extension
All,
Originally DLRVM had design peculiarity that it cached class LOADING
exceptions. It contradicted the specification which only requires to cache
RESOLUTION errors.
I've removed this design issue as the fix for HARMONY-2083, but there seem
to show one (BIG) obstacle on this way.
I asked for that some time ago but was answered that JITs never directly
call to class loading to load classes of methods' arguments and return types
while compiling invoke* instructions.
Now it shows up (see HARMONY-2775, comment from MIkhail Fursov), that at
least Jitrino.OPT does call to class loading. This leads to assertion on the
next attempt to load any class.
As I understand OPT pipeline, it was NOT originally designed to return
compilation error from within its internals. But now I see it being a
requirement.
Complains?
--
Pavel Pervov,
Intel Enterprise Solutions Software Division
Re: [drlvm][jit] VM-JIT interface extension
Posted by Alexey Varlamov <al...@gmail.com>.
Today Eclipse 3.2 started on release Jitrino.OPT, but failed to open
editor window of existing older project during workspace
initialization, due to NoClassDefFoundError. Neverthless editor could
be normally opened by hand later.
I guess this is related to this topic. The log message is:
!ENTRY org.eclipse.ui 4 0 2006-12-19 11:52:32.904
!MESSAGE Unable to create editor ID
org.eclipse.jdt.ui.CompilationUnitEditor: Editor could not be
initialized.
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
at org.eclipse.core.internal.preferences.legacy.InitLegacyPreferences.init(InitLegacyPreferences.java:43)
at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.applyRuntimeDefaults(PreferenceServiceRegistryHelper.java)
at org.eclipse.core.internal.preferences.PreferencesService.applyRuntimeDefaults(PreferencesService.java)
at org.eclipse.core.internal.preferences.DefaultPreferences.applyRuntimeDefaults(DefaultPreferences.java)
at org.eclipse.core.internal.preferences.DefaultPreferences.loadDefaults(DefaultPreferences.java:231)
at org.eclipse.core.internal.preferences.DefaultPreferences.load(DefaultPreferences.java:227)
at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java)
at org.eclipse.core.internal.preferences.EclipsePreferences.internalNode(EclipsePreferences.java)
at org.eclipse.core.internal.preferences.EclipsePreferences.node(EclipsePreferences.java)
at org.eclipse.core.internal.preferences.PreferencesService.getNodes(PreferencesService.java)
at org.eclipse.core.internal.preferences.PreferencesService.getString(PreferencesService.java:635)
at org.eclipse.core.internal.filebuffers.TextFileBufferManager.getLineDelimiterPreference(TextFileBufferManager.java)
at org.eclipse.core.internal.filebuffers.TextFileBufferManager.createEmptyDocument(TextFileBufferManager.java:300)
at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.initializeFileBufferContent(ResourceTextFileBuffer.java)
at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.create(ResourceFileBuffer.java)
at org.eclipse.core.internal.filebuffers.TextFileBufferManager.connect(TextFileBufferManager.java)
at org.eclipse.ui.editors.text.TextFileDocumentProvider.createFileInfo(TextFileDocumentProvider.java)
at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createFileInfo(CompilationUnitDocumentProvider.java:909)
at org.eclipse.ui.editors.text.TextFileDocumentProvider.connect(TextFileDocumentProvider.java)
at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.connect(CompilationUnitDocumentProvider.java:1069)
at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java)
at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:173)
at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1512)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.internalDoSetInput(JavaEditor.java:2371)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput(JavaEditor.java:2344)
at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput(CompilationUnitEditor.java:1428)
at org.eclipse.ui.texteditor.AbstractTextEditor$17.run(AbstractTextEditor.java)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:764)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java)
at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:760)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2283)
at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java)
at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:2441)
at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:372)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java)
at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(EditorAreaHelper.java)
at org.eclipse.ui.internal.EditorManager.setVisibleEditor(EditorManager.java)
at org.eclipse.ui.internal.EditorManager$5.run(EditorManager.java)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java)
at org.eclipse.core.runtime.Platform.run(Platform.java)
at org.eclipse.ui.internal.EditorManager.restoreState(EditorManager.java:1001)
at org.eclipse.ui.internal.WorkbenchPage.restoreState(WorkbenchPage.java)
at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:1936)
at org.eclipse.ui.internal.Workbench.doRestoreState(Workbench.java)
at org.eclipse.ui.internal.Workbench.access$14(Workbench.java)
at org.eclipse.ui.internal.Workbench$19.run(Workbench.java:1681)
at org.eclipse.ui.internal.Workbench.runStartupWithProgress(Workbench.java)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1679)
at org.eclipse.ui.internal.Workbench.access$12(Workbench.java)
at org.eclipse.ui.internal.Workbench$17.run(Workbench.java:1529)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1473)
at org.eclipse.ui.internal.WorkbenchConfigurer.restoreState(WorkbenchConfigurer.java:183)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java)
at org.eclipse.ui.internal.Workbench.init(Workbench.java)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1847)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
at java.lang.reflect.Method.invoke(Method.java:381)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java)
at org.eclipse.core.launcher.Main.main(Main.java:952)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
at java.lang.reflect.Method.invoke(Method.java:381)
at org.apache.harmony.vm.JarRunner.main(JarRunner.java:80)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java)
at java.lang.ClassLoader.loadClass(ClassLoader.java)
at org.eclipse.core.internal.preferences.legacy.InitLegacyPreferences.init(InitLegacyPreferences.java:43)
... 76 more
2006/12/18, Pavel Pervov <pm...@gmail.com>:
> Resolution - the process of dynamically determining concrete values from
> symbolic references in the runtime constant pool. I'm afraid it has nothing
> in common with what is going on in this stack.
>
> JIT explicitly asks VM type_info_get_class, i.e. return class for type
> information of methods return type. VM has to load the class if it is not
> available yet. The loading can fail with exception.
>
> On 12/18/06, Mikhail Fursov <mi...@gmail.com> wrote:
> > BTW, sorry if I miss something here, but why do vm.classloader loads "a
> > class" when JIT asks about type information only (Method_Desc,
> > Class_Handle)? Is resolution not enough here?
> >
> > --
> > Mikhail Fursov
> >
> >
>
>
>
> --
> Pavel Pervov,
> Intel Enterprise Solutions Software Division
>
>
Re: [drlvm][jit] VM-JIT interface extension
Posted by Pavel Pervov <pm...@gmail.com>.
Resolution - the process of dynamically determining concrete values from
symbolic references in the runtime constant pool. I'm afraid it has nothing
in common with what is going on in this stack.
JIT explicitly asks VM type_info_get_class, i.e. return class for type
information of methods return type. VM has to load the class if it is not
available yet. The loading can fail with exception.
On 12/18/06, Mikhail Fursov <mi...@gmail.com> wrote:
> BTW, sorry if I miss something here, but why do vm.classloader loads "a
> class" when JIT asks about type information only (Method_Desc,
> Class_Handle)? Is resolution not enough here?
>
> --
> Mikhail Fursov
>
>
--
Pavel Pervov,
Intel Enterprise Solutions Software Division
Re: [drlvm][jit] VM-JIT interface extension
Posted by Mikhail Fursov <mi...@gmail.com>.
BTW, sorry if I miss something here, but why do vm.classloader loads "a
class" when JIT asks about type information only (Method_Desc,
Class_Handle)? Is resolution not enough here?
--
Mikhail Fursov
Re: [drlvm][jit] VM-JIT interface extension
Posted by Pavel Pervov <pm...@gmail.com>.
On 12/18/06, Mikhail Fursov <mi...@gmail.com> wrote:
>
> On 12/18/06, Pavel Pervov <pm...@gmail.com> wrote:
> >
> > As I understand OPT pipeline, it was NOT originally designed to return
> > compilation error from within its internals. But now I see it being a
> > requirement.
> >
>
> This is not true. OPT pipeline is designed to return JIT_Failure if
> something broken. But it's true that we can have a bug here :)
AFAIK, it is not easy in some places to return JIT_FAILURE, as it requires
breaking compilation pipeline and (possibly) cleanup for failed method.
> Are you proposing to reject compilation here if some VM flag (exception
> flag) is set?
Something like this. Alternatively, we can tweak type_info_get_class to
cleanup any exceptions it produces, but I'm not sure it is along its
original interface contract and won't break something on different execution
path.
--
Mikhail Fursov
--
Pavel Pervov,
Intel Enterprise Solutions Software Division
Re: [drlvm][jit] VM-JIT interface extension
Posted by Mikhail Fursov <mi...@gmail.com>.
On 12/18/06, Pavel Pervov <pm...@gmail.com> wrote:
>
> As I understand OPT pipeline, it was NOT originally designed to return
> compilation error from within its internals. But now I see it being a
> requirement.
>
This is not true. OPT pipeline is designed to return JIT_Failure if
something broken. But it's true that we can have a bug here :)
In the example in JIRA we have this stack:
harmonyvm.dll!TypeDesc::load_type_desc() Line 135 + 0x16 C++
harmonyvm.dll!type_info_get_class(TypeDesc * tih=0x095ff2f8) Line 2013 +
0x8 C++
jitrino.dll!Jitrino::DrlVMCompilationInterface::getTypeFromDrlVMTypeHandle(TypeDesc
* typeHandle=0x095ff2f8, bool isManagedPointer=false) Line 520 + 0xc C++
jitrino.dll!Jitrino::DrlVMMethodSignatureDesc::getReturnType() Line 331
C++
jitrino.dll!Jitrino::JavaByteCodeTranslator::invokeinterface(unsigned int
constPoolIndex=489, unsigned int count=1) Line 2101 + 0xd C++
jitrino.dll!Jitrino::JavaByteCodeParserCallback::parseByteCode(const
unsigned char * byteCodes=0x0470c5f8, unsigned int off=31) Line 617 + 0x36
C++
jitrino.dll!Jitrino::ByteCodeParser::parse(Jitrino::ByteCodeParserCallback
* cb=0x0012739c) Line 70 + 0x1a C++
and the body JavaByteCodeTranslator::invokeinterface has special handling
for this situation:
if (returnType == NULL) {
// This means that it was not resolved successfully but it can
be resolved later
// inside the callee (with some "magic" custom class loader for
example)
// Or respective exception will be thrown there (in the callee)
at the attempt to create (new)
// an object of unresolved type
returnType = typeManager.getNullObjectType();
}
So the method will be compiled and passed to VM.
Are you proposing to reject compilation here if some VM flag (exception
flag) is set?
--
Mikhail Fursov