hotspot/test/runtime/Final/TestPutField.jasm
author zmajo
Wed, 06 Jul 2016 11:16:36 +0200
changeset 39699 7a2a49fd5ee0
permissions -rw-r--r--
8160527: Check for final instance field updates can be omitted Summary: Disable final field resolution in the constant pool cache. Correct error message printed at field resolution. New tests. Reviewed-by: jrose, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39699
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     1
/*
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     4
 *
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     8
 *
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    13
 * accompanied this code).
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    14
 *
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    18
 *
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    21
 * questions.
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    22
 *
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    23
 */
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    24
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    25
public class TestPutField
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    26
version 53:0
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    27
{
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    28
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    29
final Field test_field:"I";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    30
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    31
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    32
public Method <init>:"()V"
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    33
       stack 2 locals 1
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    34
{
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    35
	aload_0;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    36
	dup;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    37
	invokespecial Method java/lang/Object.<init>:"()V";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    38
	bipush 13;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    39
        putfield Field test_field:"I";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    40
        return;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    41
}
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    42
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    43
public Method aMethod:"()I"
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    44
       stack 2 locals 2
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    45
{
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    46
	aload_0;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    47
	getfield Field test_field:"I";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    48
	istore_1;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    49
	aload_0;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    50
	bipush 14;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    51
        putfield Field test_field:"I";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    52
	iload_1;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    53
        ireturn;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    54
}
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    55
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    56
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    57
public static Method test:"()V"
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    58
       stack 2 locals 2
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    59
{
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    60
	new class TestPutField;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    61
	astore_0;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    62
	aload_0;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    63
	invokespecial Method <init>:"()V";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    64
	getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    65
	astore_1;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    66
	aload_1;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    67
	aload_0;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    68
	invokevirtual Method aMethod:"()I";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    69
	invokevirtual Method java/io/PrintStream.println:"(I)V";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    70
	aload_1;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    71
	aload_0;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    72
	getfield Field test_field:"I";	
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    73
	invokevirtual Method java/io/PrintStream.println:"(I)V";
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    74
        return;
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    75
}
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    76
7a2a49fd5ee0 8160527: Check for final instance field updates can be omitted
zmajo
parents:
diff changeset
    77
}