Skip to content

Commit

Permalink
Merge pull request #9071 from dsouzai/condyPrimitiveAOT
Browse files Browse the repository at this point in the history
Abort ILGen for non supported features in AOT
  • Loading branch information
andrewcraik committed Apr 3, 2020
2 parents ead872f + c33a120 commit 763c464
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
32 changes: 31 additions & 1 deletion runtime/compiler/exceptions/AOTFailure.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corp. and others
* Copyright (c) 2000, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -60,6 +60,36 @@ class AOTHasInvokeSpecialInInterface : public virtual TR::RecoverableILGenExcept
virtual const char* what() const throw() { return "AOT Has Invoke Special in Interface"; }
};

/**
* AOT Has Constant Dynamic exception type.
*
* Thrown when a method that has a constant dynamic is AOT Compiled.
*/
class AOTHasConstantDynamic : public virtual TR::RecoverableILGenException
{
virtual const char* what() const throw() { return "AOT Has Constant Dynamic"; }
};

/**
* AOT Has Method Handle Constant exception type.
*
* Thrown when a method that has a method handle constant is AOT Compiled.
*/
class AOTHasMethodHandleConstant : public virtual TR::RecoverableILGenException
{
virtual const char* what() const throw() { return "AOT Has Method Handle Constant"; }
};

/**
* AOT Has Method Type Constant exception type.
*
* Thrown when a method that has a method type constant is AOT Compiled.
*/
class AOTHasMethodTypeConstant : public virtual TR::RecoverableILGenException
{
virtual const char* what() const throw() { return "AOT Has Method Type Constant"; }
};

/**
* AOT Relocation Failure exception type.
*
Expand Down
19 changes: 19 additions & 0 deletions runtime/compiler/ilgen/Walker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5469,6 +5469,13 @@ TR_J9ByteCodeIlGenerator::loadFromCP(TR::DataType type, int32_t cpIndex)
case TR::Address:
if (method()->isConstantDynamic(cpIndex))
{
if (comp()->compileRelocatableCode())
{
if (comp()->getOption(TR_TraceILGen))
traceMsg(comp(), " Constant Dynamic not supported in AOT.\n");
comp()->failCompilation<J9::AOTHasConstantDynamic>("Constant Dynamic not supported in AOT.");
}

bool isCondyUnresolved = _methodSymbol->getResolvedMethod()->isUnresolvedConstantDynamic(cpIndex);
J9UTF8 *returnTypeUtf8 = (J9UTF8 *)_methodSymbol->getResolvedMethod()->getConstantDynamicTypeFromCP(cpIndex);
int returnTypeUtf8Length = J9UTF8_LENGTH(returnTypeUtf8);
Expand Down Expand Up @@ -5691,11 +5698,23 @@ TR_J9ByteCodeIlGenerator::loadFromCP(TR::DataType type, int32_t cpIndex)
}
else if (method()->isMethodHandleConstant(cpIndex))
{
if (comp()->compileRelocatableCode())
{
if (comp()->getOption(TR_TraceILGen))
traceMsg(comp(), " Method Handle Constant not supported in AOT.\n");
comp()->failCompilation<J9::AOTHasMethodHandleConstant>("Method Handle Constant not supported in AOT.");
}
loadSymbol(TR::aload, symRefTab()->findOrCreateMethodHandleSymbol(_methodSymbol, cpIndex));
}
else
{
TR_ASSERT(method()->isMethodTypeConstant(cpIndex), "Address-type CP entry %d must be class, string, methodHandle, or methodType", cpIndex);
if (comp()->compileRelocatableCode())
{
if (comp()->getOption(TR_TraceILGen))
traceMsg(comp(), " Method Type Constant not supported in AOT.\n");
comp()->failCompilation<J9::AOTHasMethodTypeConstant>("Method Type Constant not supported in AOT.");
}
loadSymbol(TR::aload, symRefTab()->findOrCreateMethodTypeSymbol(_methodSymbol, cpIndex));
}
break;
Expand Down

0 comments on commit 763c464

Please sign in to comment.