@@ -567,7 +567,7 @@ protected RubyDynamicObject clone(RubyDynamicObject object, Object freeze,
567
567
}
568
568
569
569
// Default behavior - is just to copy the frozen state of the original object
570
- if (forceFrozen (freeze ) || (copyFrozen && rubyLibrary .isFrozen (object ))) {
570
+ if (forceFrozen (freeze ) || (copyFrozen && rubyLibrary .isFrozen (object ))) { // Profiled through lazy usage of rubyLibraryFreeze
571
571
rubyLibraryFreeze .freeze (newObject );
572
572
}
573
573
@@ -857,14 +857,13 @@ protected Object freeze(Object self,
857
857
protected Object freezeDynamicObject (Object self ,
858
858
@ CachedLibrary ("self" ) RubyLibrary rubyLibrary ,
859
859
@ CachedLibrary (limit = "1" ) RubyLibrary rubyLibraryMetaClass ,
860
- @ Cached ConditionProfile singletonProfile ,
860
+ @ Cached ConditionProfile singletonClassUnfrozenProfile ,
861
861
@ Cached MetaClassNode metaClassNode ) {
862
862
final RubyClass metaClass = metaClassNode .execute (self );
863
- if (singletonProfile .profile (metaClass .isSingleton &&
864
- !(RubyGuards .isRubyClass (self ) && ((RubyClass ) self ).isSingleton ))) {
865
- if (!rubyLibraryMetaClass .isFrozen (metaClass )) {
866
- rubyLibraryMetaClass .freeze (metaClass );
867
- }
863
+ if (singletonClassUnfrozenProfile .profile (metaClass .isSingleton &&
864
+ !(RubyGuards .isRubyClass (self ) && ((RubyClass ) self ).isSingleton ) &&
865
+ !rubyLibraryMetaClass .isFrozen (metaClass ))) {
866
+ rubyLibraryMetaClass .freeze (metaClass );
868
867
}
869
868
rubyLibrary .freeze (self );
870
869
return self ;
0 commit comments