equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
62 final MethodType accessModeTypeUncached(AccessMode accessMode) { |
62 final MethodType accessModeTypeUncached(AccessMode accessMode) { |
63 return accessMode.at.accessModeType(receiverType, {#if[Object]?fieldType:$type$.class}); |
63 return accessMode.at.accessModeType(receiverType, {#if[Object]?fieldType:$type$.class}); |
64 } |
64 } |
65 |
65 |
66 @Override |
66 @Override |
67 final boolean internalEquals(VarHandle vh) { |
|
68 FieldInstanceReadOnly that = (FieldInstanceReadOnly) vh; |
|
69 return fieldOffset == that.fieldOffset; |
|
70 } |
|
71 |
|
72 @Override |
|
73 final int internalHashCode() { |
|
74 return Long.hashCode(fieldOffset); |
|
75 } |
|
76 |
|
77 @Override |
|
78 public Optional<VarHandleDesc> describeConstable() { |
67 public Optional<VarHandleDesc> describeConstable() { |
79 var receiverTypeRef = receiverType.describeConstable(); |
68 var receiverTypeRef = receiverType.describeConstable(); |
80 var fieldTypeRef = {#if[Object]?fieldType:$type$.class}.describeConstable(); |
69 var fieldTypeRef = {#if[Object]?fieldType:$type$.class}.describeConstable(); |
81 if (!receiverTypeRef.isPresent() || !fieldTypeRef.isPresent()) |
70 if (!receiverTypeRef.isPresent() || !fieldTypeRef.isPresent()) |
82 return Optional.empty(); |
71 return Optional.empty(); |
345 this.base = base; |
334 this.base = base; |
346 this.fieldOffset = fieldOffset; |
335 this.fieldOffset = fieldOffset; |
347 #if[Object] |
336 #if[Object] |
348 this.fieldType = fieldType; |
337 this.fieldType = fieldType; |
349 #end[Object] |
338 #end[Object] |
350 } |
|
351 |
|
352 @Override |
|
353 final boolean internalEquals(VarHandle vh) { |
|
354 FieldStaticReadOnly that = (FieldStaticReadOnly) vh; |
|
355 return base == that.base && fieldOffset == that.fieldOffset; |
|
356 } |
|
357 |
|
358 @Override |
|
359 final int internalHashCode() { |
|
360 return 31 * Long.hashCode(fieldOffset) + base.hashCode(); |
|
361 } |
339 } |
362 |
340 |
363 @Override |
341 @Override |
364 public Optional<VarHandleDesc> describeConstable() { |
342 public Optional<VarHandleDesc> describeConstable() { |
365 var fieldTypeRef = {#if[Object]?fieldType:$type$.class}.describeConstable(); |
343 var fieldTypeRef = {#if[Object]?fieldType:$type$.class}.describeConstable(); |
635 this.ashift = ashift; |
613 this.ashift = ashift; |
636 #if[Object] |
614 #if[Object] |
637 this.arrayType = {#if[Object]?arrayType:$type$[].class}; |
615 this.arrayType = {#if[Object]?arrayType:$type$[].class}; |
638 this.componentType = arrayType.getComponentType(); |
616 this.componentType = arrayType.getComponentType(); |
639 #end[Object] |
617 #end[Object] |
640 } |
|
641 |
|
642 @Override |
|
643 final boolean internalEquals(VarHandle vh) { |
|
644 // Equality of access mode types of AccessMode.GET is sufficient for |
|
645 // equality checks |
|
646 return true; |
|
647 } |
|
648 |
|
649 @Override |
|
650 final int internalHashCode() { |
|
651 // The hash code of the access mode types of AccessMode.GET is |
|
652 // sufficient for hash code generation |
|
653 return 0; |
|
654 } |
618 } |
655 |
619 |
656 @Override |
620 @Override |
657 public Optional<VarHandleDesc> describeConstable() { |
621 public Optional<VarHandleDesc> describeConstable() { |
658 var arrayTypeRef = {#if[Object]?arrayType:$type$[].class}.describeConstable(); |
622 var arrayTypeRef = {#if[Object]?arrayType:$type$[].class}.describeConstable(); |