Skip to content

Commit

Permalink
Merge branch 'master' into unsigned_gen
Browse files Browse the repository at this point in the history
  • Loading branch information
wbh123456 committed Nov 11, 2019
2 parents 83b926a + 40e485f commit 2782668
Show file tree
Hide file tree
Showing 345 changed files with 5,522 additions and 3,805 deletions.
3 changes: 0 additions & 3 deletions .appveyor.yml
Expand Up @@ -30,9 +30,6 @@ environment:
TEST_RESULT_DIR: '%APPVEYOR_BUILD_FOLDER%\test_results'
GTEST_OUTPUT: 'xml:%TEST_RESULT_DIR%\'

install:
- cinst winflexbison

before_build:
- del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
- set PATH=C:\Python37;%PATH%
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -41,7 +41,6 @@ matrix:
addons:
apt:
packages:
- bison
- clang-3.8
- libclang-3.8-dev
- llvm-3.8
Expand Down
2 changes: 1 addition & 1 deletion buildenv/jenkins/jobs/builds/Build-aix_ppc-64
Expand Up @@ -36,7 +36,7 @@ pipeline {

dir('build') {
echo 'Configure...'
sh '''cmake -Wdev -DCMAKE_XL_CreateExportList="/usr/vac/bin/CreateExportList -X64" -DOMR_JIT=OFF -DOMR_JITBUILDER=OFF -DOMR_TEST_COMPILER=OFF -DOMR_DDR=OFF -C../cmake/caches/Travis.cmake ..'''
sh '''cmake -Wdev -DCMAKE_XL_CreateExportList="/usr/vac/bin/CreateExportList -X64" -DOMR_DDR=OFF -C../cmake/caches/Travis.cmake ..'''

echo 'Compile...'
sh '''make -j8'''
Expand Down
2 changes: 1 addition & 1 deletion buildenv/jenkins/jobs/pull-requests/PullRequest-aix_ppc-64
Expand Up @@ -22,7 +22,7 @@ pipeline {

dir('build') {
echo 'Configure...'
sh '''cmake -Wdev -DCMAKE_XL_CreateExportList="/usr/vac/bin/CreateExportList -X64" -DOMR_JIT=OFF -DOMR_JITBUILDER=OFF -DOMR_TEST_COMPILER=OFF -DOMR_DDR=OFF -C../cmake/caches/Travis.cmake ..'''
sh '''cmake -Wdev -DCMAKE_XL_CreateExportList="/usr/vac/bin/CreateExportList -X64" -DOMR_DDR=OFF -C../cmake/caches/Travis.cmake ..'''

echo 'Compile...'
sh '''make -j4'''
Expand Down
1 change: 1 addition & 0 deletions cmake/config.cmake
Expand Up @@ -166,6 +166,7 @@ if(OMR_THR_YIELD_ALG)
endif()
#TODO set to disabled. Stuff fails to compile when its on
set(OMR_THR_TRACING OFF CACHE BOOL "TODO: Document")
set(OMR_THR_MCS_LOCKS OFF CACHE BOOL "Enable the usage of the MCS lock in the OMR thread monitor.")

#TODO this should maybe be a OMRTHREAD_LIB string variable?
set(OMRTHREAD_WIN32_DEFAULT OFF)
Expand Down
87 changes: 0 additions & 87 deletions cmake/modules/FindLEX.cmake

This file was deleted.

100 changes: 0 additions & 100 deletions cmake/modules/FindYACC.cmake

This file was deleted.

4 changes: 4 additions & 0 deletions cmake/modules/OmrCompilerSupport.cmake
Expand Up @@ -280,11 +280,15 @@ macro(set_tr_compile_options)
# Prepend leading '-D' only if required
if(def MATCHES "^-D")
set(TR_ASM_FLAGS "${TR_ASM_FLAGS} ${def}")
list(APPEND SPP_FLAGS "${def}")
else()
set(TR_ASM_FLAGS "${TR_ASM_FLAGS} -D${def}")
list(APPEND SPP_FLAGS "-D${def}")
endif()
endforeach()

set(SPP_FLAGS ${SPP_FLAGS} PARENT_SCOPE)

# We need special handling on x86 because we could be gnu or NASM assembler
if(OMR_ARCH_X86)
make_gnu_asm_defines(gnu_defines ${TR_COMPILE_DEFINITIONS})
Expand Down
101 changes: 98 additions & 3 deletions compiler/aarch64/codegen/ARM64BinaryEncoding.cpp
Expand Up @@ -25,7 +25,9 @@
#include "codegen/ARM64ConditionCode.hpp"
#include "codegen/ARM64Instruction.hpp"
#include "codegen/CodeGenerator.hpp"
#include "codegen/InstOpCode.hpp"
#include "codegen/InstructionDelegate.hpp"
#include "codegen/Linkage.hpp"
#include "codegen/Relocation.hpp"
#include "runtime/CodeCacheManager.hpp"

Expand Down Expand Up @@ -73,14 +75,16 @@ uint8_t *TR::ARM64ImmSymInstruction::generateBinaryEncoding()

if (cg()->comp()->isRecursiveMethodTarget(sym))
{
intptrj_t jitToJitStart = (intptrj_t)cg()->getCodeStart();
// how many bytes to skip loading interp->jit argument
jitToJitStart += ((*(int32_t *)(jitToJitStart - 4)) >> 16) & 0xFFFF;
intptrj_t jitToJitStart = cg()->getLinkage()->entryPointFromCompiledMethod();

TR_ASSERT_FATAL(jitToJitStart, "Unknown compiled method entry point. Entry point should be available by now.");

TR_ASSERT_FATAL(TR::Compiler->target.cpu.isTargetWithinUnconditionalBranchImmediateRange(jitToJitStart, (intptrj_t)cursor),
"Target address is out of range");

intptrj_t distance = jitToJitStart - (intptrj_t)cursor;
insertImmediateField(toARM64Cursor(cursor), distance);
setAddrImmediate(jitToJitStart);
}
else if (label != NULL)
{
Expand All @@ -104,6 +108,7 @@ uint8_t *TR::ARM64ImmSymInstruction::generateBinaryEncoding()

intptrj_t distance = destination - (intptrj_t)cursor;
insertImmediateField(toARM64Cursor(cursor), distance);
setAddrImmediate(destination);

cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
Expand Down Expand Up @@ -506,6 +511,26 @@ int32_t TR::ARM64MemSrc1Instruction::estimateBinaryLength(int32_t currentEstimat
return(currentEstimate + getEstimatedBinaryLength());
}

uint8_t *TR::ARM64Trg1MemSrc1Instruction::generateBinaryEncoding()
{
uint8_t *instructionStart = cg()->getBinaryBufferCursor();
uint8_t *cursor = instructionStart;
cursor = getOpCode().copyBinaryToBuffer(instructionStart);
insertTargetRegister(toARM64Cursor(cursor));
insertSource1Register(toARM64Cursor(cursor));
cursor = getMemoryReference()->generateBinaryEncoding(this, cursor, cg());
setBinaryLength(cursor - instructionStart);
setBinaryEncoding(instructionStart);
cg()->addAccumulatedInstructionLengthError(getEstimatedBinaryLength() - getBinaryLength());
return cursor;
}

int32_t TR::ARM64Trg1MemSrc1Instruction::estimateBinaryLength(int32_t currentEstimate)
{
setEstimatedBinaryLength(getMemoryReference()->estimateBinaryLength(getOpCodeValue()));
return currentEstimate + getEstimatedBinaryLength();
}

uint8_t *TR::ARM64Src1Instruction::generateBinaryEncoding()
{
uint8_t *instructionStart = cg()->getBinaryBufferCursor();
Expand All @@ -530,3 +555,73 @@ uint8_t *TR::ARM64Src2Instruction::generateBinaryEncoding()
setBinaryEncoding(instructionStart);
return cursor;
}

#ifdef J9_PROJECT_SPECIFIC
uint8_t *TR::ARM64VirtualGuardNOPInstruction::generateBinaryEncoding()
{
uint8_t *cursor = cg()->getBinaryBufferCursor();
TR::LabelSymbol *label = getLabelSymbol();
int32_t length = 0;
TR::Instruction *guardForPatching = cg()->getVirtualGuardForPatching(this);

// a previous guard is patching to the same destination and we can recycle the patch
// point so setup the patching location to use this previous guard and generate no
// instructions ourselves
if ((guardForPatching != this) &&
// AOT needs an explicit nop, even if there are patchable instructions at this site because
// 1) Those instructions might have AOT data relocations (and therefore will be incorrectly patched again)
// 2) We might want to re-enable the code path and unpatch, in which case we would have to know what the old instruction was
!cg()->comp()->compileRelocatableCode())
{
_site->setLocation(guardForPatching->getBinaryEncoding());
setBinaryLength(0);
setBinaryEncoding(cursor);
if (label->getCodeLocation() == NULL)
{
cg()->addRelocation(new (cg()->trHeapMemory()) TR::LabelAbsoluteRelocation((uint8_t *) (&_site->getDestination()), label));
}
else
{
_site->setDestination(label->getCodeLocation());
}
cg()->addAccumulatedInstructionLengthError(getEstimatedBinaryLength() - getBinaryLength());
return cursor;
}

// We need to revisit this to improve it to support empty patching

_site->setLocation(cursor);
if (label->getCodeLocation() == NULL)
{
_site->setDestination(cursor);
cg()->addRelocation(new (cg()->trHeapMemory()) TR::LabelAbsoluteRelocation((uint8_t *) (&_site->getDestination()), label));

#ifdef DEBUG
if (debug("traceVGNOP"))
printf("####> virtual location = %p, label (relocation) = %p\n", cursor, label);
#endif
}
else
{
_site->setDestination(label->getCodeLocation());
#ifdef DEBUG
if (debug("traceVGNOP"))
printf("####> virtual location = %p, label location = %p\n", cursor, label->getCodeLocation());
#endif
}

setBinaryEncoding(cursor);
TR::InstOpCode opCode(TR::InstOpCode::nop);
opCode.copyBinaryToBuffer(cursor);
length = ARM64_INSTRUCTION_LENGTH;
setBinaryLength(length);
return cursor+length;
}

int32_t TR::ARM64VirtualGuardNOPInstruction::estimateBinaryLength(int32_t currentEstimate)
{
// This is a conservative estimation for reserving NOP space.
setEstimatedBinaryLength(ARM64_INSTRUCTION_LENGTH);
return currentEstimate+ARM64_INSTRUCTION_LENGTH;
}
#endif

0 comments on commit 2782668

Please sign in to comment.