summaryrefslogtreecommitdiff
path: root/compiler/optimizing/pc_relative_fixups_x86.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2018-06-22 02:16:08 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-06-22 02:16:08 -0700
commit5f7748b6ec5b51afe8314f2c169f99a1f93a2053 (patch)
tree25879b7002fd0601f9ed0ac9b6ef0b7d84134f55 /compiler/optimizing/pc_relative_fixups_x86.cc
parent0ad09c4b396d37f57eecca8b1f841fb99a1a0baf (diff)
parent077cc1c59c32f08c752c603bf991160c22eae9bb (diff)
Merge "Implement Integer.valueOf() intrinsic for PIC." am: ccfc88af4a am: 8e73527acf
am: 077cc1c59c Change-Id: If3a8ed8679e4fa8ef851b0c92e303473ef74a910
Diffstat (limited to 'compiler/optimizing/pc_relative_fixups_x86.cc')
-rw-r--r--compiler/optimizing/pc_relative_fixups_x86.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/compiler/optimizing/pc_relative_fixups_x86.cc b/compiler/optimizing/pc_relative_fixups_x86.cc
index 9049457da5b..05ec765b197 100644
--- a/compiler/optimizing/pc_relative_fixups_x86.cc
+++ b/compiler/optimizing/pc_relative_fixups_x86.cc
@@ -193,18 +193,19 @@ class PCRelativeHandlerVisitor : public HGraphVisitor {
}
void HandleInvoke(HInvoke* invoke) {
- // If this is an invoke-static/-direct with PC-relative dex cache array
- // addressing, we need the PC-relative address base.
HInvokeStaticOrDirect* invoke_static_or_direct = invoke->AsInvokeStaticOrDirect();
- // We can't add a pointer to the constant area if we already have a current
- // method pointer. This may arise when sharpening doesn't remove the current
- // method pointer from the invoke.
- if (invoke_static_or_direct != nullptr &&
- invoke_static_or_direct->HasCurrentMethodInput()) {
+
+ // We can't add the method address if we already have a current method pointer.
+ // This may arise when sharpening doesn't remove the current method pointer from the invoke.
+ if (invoke_static_or_direct != nullptr && invoke_static_or_direct->HasCurrentMethodInput()) {
+ // Note: This happens only for recursive calls (including compiling an intrinsic
+ // by faking a call to itself; we use kRuntimeCall for this case).
DCHECK(!invoke_static_or_direct->HasPcRelativeMethodLoadKind());
return;
}
+ // If this is an invoke-static/-direct with PC-relative addressing (within boot image
+ // or using .bss or .data.bimg.rel.ro), we need the PC-relative address base.
bool base_added = false;
if (invoke_static_or_direct != nullptr &&
invoke_static_or_direct->HasPcRelativeMethodLoadKind() &&
@@ -224,7 +225,6 @@ class PCRelativeHandlerVisitor : public HGraphVisitor {
}
}
- // These intrinsics need the constant area.
switch (invoke->GetIntrinsic()) {
case Intrinsics::kMathAbsDouble:
case Intrinsics::kMathAbsFloat:
@@ -235,7 +235,15 @@ class PCRelativeHandlerVisitor : public HGraphVisitor {
LOG(FATAL) << "Unreachable min/max/abs: intrinsics should have been lowered "
"to IR nodes by instruction simplifier";
UNREACHABLE();
+ case Intrinsics::kIntegerValueOf:
+ // This intrinsic can be call free if it loads the address of the boot image object.
+ // If we're compiling PIC, we need the address base for loading from .data.bimg.rel.ro.
+ if (!codegen_->GetCompilerOptions().GetCompilePic()) {
+ break;
+ }
+ FALLTHROUGH_INTENDED;
case Intrinsics::kMathRoundFloat:
+ // This intrinsic needs the constant area.
if (!base_added) {
DCHECK(invoke_static_or_direct != nullptr);
DCHECK(!invoke_static_or_direct->HasCurrentMethodInput());