Move and rename jet.runtime.SharedVar -> kotlin.jvm.internal.Ref
This commit is contained in:
@@ -3230,8 +3230,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
else {
|
||||
v.load(index, OBJECT_TYPE);
|
||||
generateInitializer.fun(variableDescriptor);
|
||||
v.putfield(sharedVarType.getInternalName(), "ref",
|
||||
sharedVarType == JET_SHARED_VAR_TYPE ? "Ljava/lang/Object;" : varType.getDescriptor());
|
||||
v.putfield(sharedVarType.getInternalName(), "element",
|
||||
sharedVarType.equals(OBJECT_REF_TYPE) ? "Ljava/lang/Object;" : varType.getDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -934,7 +934,7 @@ public abstract class StackValue {
|
||||
v.load(index, OBJECT_TYPE);
|
||||
Type refType = refType(this.type);
|
||||
Type sharedType = sharedTypeForType(this.type);
|
||||
v.visitFieldInsn(GETFIELD, sharedType.getInternalName(), "ref", refType.getDescriptor());
|
||||
v.visitFieldInsn(GETFIELD, sharedType.getInternalName(), "element", refType.getDescriptor());
|
||||
coerceFrom(refType, v);
|
||||
coerceTo(type, v);
|
||||
if (isReleaseOnPut) {
|
||||
@@ -950,7 +950,7 @@ public abstract class StackValue {
|
||||
AsmUtil.swap(v, sharedTypeForType(this.type), topOfStackType);
|
||||
Type refType = refType(this.type);
|
||||
Type sharedType = sharedTypeForType(this.type);
|
||||
v.visitFieldInsn(PUTFIELD, sharedType.getInternalName(), "ref", refType.getDescriptor());
|
||||
v.visitFieldInsn(PUTFIELD, sharedType.getInternalName(), "element", refType.getDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,32 +958,23 @@ public abstract class StackValue {
|
||||
switch (type.getSort()) {
|
||||
case Type.OBJECT:
|
||||
case Type.ARRAY:
|
||||
return JET_SHARED_VAR_TYPE;
|
||||
|
||||
return OBJECT_REF_TYPE;
|
||||
case Type.BYTE:
|
||||
return JET_SHARED_BYTE_TYPE;
|
||||
|
||||
return Type.getObjectType("kotlin/jvm/internal/Ref$ByteRef");
|
||||
case Type.SHORT:
|
||||
return JET_SHARED_SHORT_TYPE;
|
||||
|
||||
return Type.getObjectType("kotlin/jvm/internal/Ref$ShortRef");
|
||||
case Type.CHAR:
|
||||
return JET_SHARED_CHAR_TYPE;
|
||||
|
||||
return Type.getObjectType("kotlin/jvm/internal/Ref$CharRef");
|
||||
case Type.INT:
|
||||
return JET_SHARED_INT_TYPE;
|
||||
|
||||
return Type.getObjectType("kotlin/jvm/internal/Ref$IntRef");
|
||||
case Type.LONG:
|
||||
return JET_SHARED_LONG_TYPE;
|
||||
|
||||
return Type.getObjectType("kotlin/jvm/internal/Ref$LongRef");
|
||||
case Type.BOOLEAN:
|
||||
return JET_SHARED_BOOLEAN_TYPE;
|
||||
|
||||
return Type.getObjectType("kotlin/jvm/internal/Ref$BooleanRef");
|
||||
case Type.FLOAT:
|
||||
return JET_SHARED_FLOAT_TYPE;
|
||||
|
||||
return Type.getObjectType("kotlin/jvm/internal/Ref$FloatRef");
|
||||
case Type.DOUBLE:
|
||||
return JET_SHARED_DOUBLE_TYPE;
|
||||
|
||||
return Type.getObjectType("kotlin/jvm/internal/Ref$DoubleRef");
|
||||
default:
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -1011,7 +1002,7 @@ public abstract class StackValue {
|
||||
public void put(Type type, InstructionAdapter v) {
|
||||
Type sharedType = sharedTypeForType(this.type);
|
||||
Type refType = refType(this.type);
|
||||
v.visitFieldInsn(GETFIELD, sharedType.getInternalName(), "ref", refType.getDescriptor());
|
||||
v.visitFieldInsn(GETFIELD, sharedType.getInternalName(), "element", refType.getDescriptor());
|
||||
coerceFrom(refType, v);
|
||||
coerceTo(type, v);
|
||||
}
|
||||
@@ -1019,7 +1010,7 @@ public abstract class StackValue {
|
||||
@Override
|
||||
public void store(Type topOfStackType, InstructionAdapter v) {
|
||||
coerceFrom(topOfStackType, v);
|
||||
v.visitFieldInsn(PUTFIELD, sharedTypeForType(type).getInternalName(), "ref", refType(type).getDescriptor());
|
||||
v.visitFieldInsn(PUTFIELD, sharedTypeForType(type).getInternalName(), "element", refType(type).getDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-9
@@ -33,16 +33,8 @@ public class AsmTypeConstants {
|
||||
public static final Type JET_FUNCTION0_TYPE = Type.getObjectType("jet/Function0");
|
||||
public static final Type JET_FUNCTION1_TYPE = Type.getObjectType("jet/Function1");
|
||||
public static final Type JET_INT_RANGE_TYPE = Type.getObjectType("jet/IntRange");
|
||||
public static final Type JET_SHARED_VAR_TYPE = Type.getObjectType("jet/runtime/SharedVar$Object");
|
||||
public static final Type JET_SHARED_INT_TYPE = Type.getObjectType("jet/runtime/SharedVar$Int");
|
||||
public static final Type JET_SHARED_DOUBLE_TYPE = Type.getObjectType("jet/runtime/SharedVar$Double");
|
||||
public static final Type JET_SHARED_FLOAT_TYPE = Type.getObjectType("jet/runtime/SharedVar$Float");
|
||||
public static final Type JET_SHARED_BYTE_TYPE = Type.getObjectType("jet/runtime/SharedVar$Byte");
|
||||
public static final Type JET_SHARED_SHORT_TYPE = Type.getObjectType("jet/runtime/SharedVar$Short");
|
||||
public static final Type JET_SHARED_CHAR_TYPE = Type.getObjectType("jet/runtime/SharedVar$Char");
|
||||
public static final Type JET_SHARED_LONG_TYPE = Type.getObjectType("jet/runtime/SharedVar$Long");
|
||||
public static final Type JET_SHARED_BOOLEAN_TYPE = Type.getObjectType("jet/runtime/SharedVar$Boolean");
|
||||
|
||||
public static final Type OBJECT_REF_TYPE = Type.getObjectType("kotlin/jvm/internal/Ref$ObjectRef");
|
||||
|
||||
public static Type getType(@NotNull Class<?> javaClass) {
|
||||
Type type = TYPES_MAP.get(javaClass);
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package jet.runtime;
|
||||
|
||||
public final class SharedVar {
|
||||
public static final class Object<T> {
|
||||
public T ref;
|
||||
}
|
||||
|
||||
public static final class Byte {
|
||||
public byte ref;
|
||||
}
|
||||
|
||||
public static final class Short {
|
||||
public short ref;
|
||||
}
|
||||
|
||||
public static final class Int {
|
||||
public int ref;
|
||||
}
|
||||
|
||||
public static final class Long {
|
||||
public long ref;
|
||||
}
|
||||
|
||||
public static final class Float {
|
||||
public float ref;
|
||||
}
|
||||
|
||||
public static final class Double {
|
||||
public double ref;
|
||||
}
|
||||
|
||||
public static final class Char {
|
||||
public char ref;
|
||||
}
|
||||
|
||||
public static final class Boolean {
|
||||
public boolean ref;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kotlin.jvm.internal;
|
||||
|
||||
public class Ref {
|
||||
private Ref() {}
|
||||
|
||||
public static final class ObjectRef<T> {
|
||||
public T element;
|
||||
}
|
||||
|
||||
public static final class ByteRef {
|
||||
public byte element;
|
||||
}
|
||||
|
||||
public static final class ShortRef {
|
||||
public short element;
|
||||
}
|
||||
|
||||
public static final class IntRef {
|
||||
public int element;
|
||||
}
|
||||
|
||||
public static final class LongRef {
|
||||
public long element;
|
||||
}
|
||||
|
||||
public static final class FloatRef {
|
||||
public float element;
|
||||
}
|
||||
|
||||
public static final class DoubleRef {
|
||||
public double element;
|
||||
}
|
||||
|
||||
public static final class CharRef {
|
||||
public char element;
|
||||
}
|
||||
|
||||
public static final class BooleanRef {
|
||||
public boolean element;
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,4 @@ fun firstFun() {
|
||||
|
||||
// INVOCATION_COUNT: 0
|
||||
// EXIST: { lookupString:"Int", tailText:" (jet)" }
|
||||
// ABSENT: { lookupString:"Int", tailText:" (jet.runtime.SharedVar)" }
|
||||
// ABSENT: { lookupString:"IntRef", tailText:" (kotlin.internal.Ref)" }
|
||||
|
||||
Reference in New Issue
Block a user