hotspot/src/cpu/s390/vm/icBuffer_s390.cpp
author redestad
Mon, 03 Jul 2017 09:01:34 +0200
changeset 46608 b0da00b77053
parent 42065 6032b31e3719
permissions -rw-r--r--
8183232: Avoid resolving method_kind in AbstractInterpreter::can_be_compiled Reviewed-by: coleenp, mdoerr, neliasso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     1
/*
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     3
 * Copyright (c) 2016 SAP SE. All rights reserved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     5
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     9
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    14
 * accompanied this code).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    15
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    19
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    22
 * questions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    23
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    24
 */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    25
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    26
#include "precompiled.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    27
#include "asm/macroAssembler.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    28
#include "code/icBuffer.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    29
#include "gc/shared/collectedHeap.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
#include "interpreter/bytecodes.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
#include "memory/resourceArea.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
#include "nativeInst_s390.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
#include "oops/oop.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
#define __ masm.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
int InlineCacheBuffer::ic_stub_code_size() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
  return MacroAssembler::load_const_size() + Assembler::z_brul_size();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
void InlineCacheBuffer::assemble_ic_buffer_code(address code_begin, void* cached_oop, address entry_point) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
  ResourceMark rm;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
  CodeBuffer code(code_begin, ic_stub_code_size());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
  MacroAssembler masm(&code);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
  // Note: even though the code contains an embedded oop, we do not need reloc info
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
  // because
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
  // (1) the oop is old (i.e., doesn't matter for scavenges)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
  // (2) these ICStubs are removed *before* a GC happens, so the roots disappear.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
  // Load the oop,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
  __ load_const(Z_method, (address) cached_oop); // inline cache reg = Z_method
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
  // and do a tail-call (pc-relative).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
  __ z_brul((address) entry_point);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
  __ flush();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
address InlineCacheBuffer::ic_buffer_entry_point(address code_begin) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
  NativeMovConstReg* move = nativeMovConstReg_at(code_begin);   // Creation also verifies the object.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
  return MacroAssembler::get_target_addr_pcrel(move->next_instruction_address());
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
void* InlineCacheBuffer::ic_buffer_cached_value(address code_begin) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
  NativeMovConstReg* move = nativeMovConstReg_at(code_begin);   // Creation also verifies the object.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    64
  return (void*)move->data();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
}