hotspot/src/cpu/s390/vm/stubRoutines_s390.hpp
author lucy
Fri, 20 Jan 2017 15:17:46 +0100
changeset 46279 9b0c98f422e9
parent 42065 6032b31e3719
child 46315 a796c32af782
permissions -rw-r--r--
8175267: [s390] cleanup stub code "handler_for_unsafe_access" Reviewed-by: dholmes, goetz, mdoerr
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
#ifndef CPU_S390_VM_STUBROUTINES_ZARCH_64_64_HPP
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    27
#define CPU_S390_VM_STUBROUTINES_ZARCH_64_64_HPP
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    28
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    29
// This file holds the platform specific parts of the StubRoutines
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
// definition. See stubRoutines.hpp for a description on how to extend it.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
enum { // Platform dependent constants.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
  // TODO: May be able to shrink this a lot
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
  code_size1 = 20000,      // Simply increase if too small (assembler will crash if too small).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
  code_size2 = 20000       // Simply increase if too small (assembler will crash if too small).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
// MethodHandles adapters
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
enum method_handles_platform_dependent_constants {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
  method_handles_adapters_code_size = 5000
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
#define CRC32_COLUMN_SIZE 256
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
#define CRC32_BYFOUR
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
#ifdef CRC32_BYFOUR
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
  #define CRC32_TABLES 8
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
#else
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
  #define CRC32_TABLES 1
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
#endif
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
// Comapct string intrinsics: Translate table for string inflate intrinsic. Used by trot instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
#define TROT_ALIGNMENT   8  // Required by instruction,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
                            // guaranteed by jlong table element type.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
#define TROT_COLUMN_SIZE (256*sizeof(jchar)/sizeof(jlong))
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
class zarch {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
 friend class StubGenerator;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
  enum { nof_instance_allocators = 10 };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    64
  // allocator lock values
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
  enum {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    66
    unlocked = 0,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    67
    locked   = 1
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    68
  };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    69
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    70
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    71
  static int _atomic_memory_operation_lock;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    72
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    73
  static address _partial_subtype_check;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    74
  static juint   _crc_table[CRC32_TABLES][CRC32_COLUMN_SIZE];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    75
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    76
  // Comapct string intrinsics: Translate table for string inflate intrinsic. Used by trot instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    77
  static address _trot_table_addr;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    78
  static jlong   _trot_table[TROT_COLUMN_SIZE];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    79
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    80
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    81
  // Global lock for everyone who needs to use atomic_compare_and_exchange
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    82
  // or atomic_increment -- should probably use more locks for more
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    83
  // scalability -- for instance one for each eden space or group of.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    84
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    85
  // Address of the lock for atomic_compare_and_exchange.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    86
  static int* atomic_memory_operation_lock_addr() { return &_atomic_memory_operation_lock; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    87
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    88
  // Accessor and mutator for _atomic_memory_operation_lock.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    89
  static int atomic_memory_operation_lock() { return _atomic_memory_operation_lock; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    90
  static void set_atomic_memory_operation_lock(int value) { _atomic_memory_operation_lock = value; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    91
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    92
  static address partial_subtype_check()                  { return _partial_subtype_check; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    93
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    94
  static void generate_load_crc_table_addr(MacroAssembler* masm, Register table);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    95
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    96
  // Comapct string intrinsics: Translate table for string inflate intrinsic. Used by trot instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    97
  static void generate_load_trot_table_addr(MacroAssembler* masm, Register table);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    98
};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    99
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   100
#endif // CPU_S390_VM_STUBROUTINES_ZARCH_64_64_HPP