@@ -2933,58 +2933,6 @@ function evaluateConstantOffset(compiler: Compiler, expression: Expression): i32
2933
2933
return value ;
2934
2934
}
2935
2935
2936
- /** Compiles a memory allocation for an instance of the specified class. */
2937
- export function compileAllocate (
2938
- compiler : Compiler ,
2939
- classInstance : Class ,
2940
- reportNode : Node
2941
- ) : ExpressionRef {
2942
- var program = compiler . program ;
2943
- assert ( classInstance . program == program ) ;
2944
- var module = compiler . module ;
2945
- var options = compiler . options ;
2946
-
2947
- // __gc_allocate(size, markFn)
2948
- if ( program . hasGC && classInstance . type . isManaged ( program ) ) {
2949
- let allocateInstance = assert ( program . gcAllocateInstance ) ;
2950
- if ( ! compiler . compileFunction ( allocateInstance ) ) return module . createUnreachable ( ) ;
2951
- compiler . currentType = classInstance . type ;
2952
- return module . createCall (
2953
- allocateInstance . internalName , [
2954
- options . isWasm64
2955
- ? module . createI64 ( classInstance . currentMemoryOffset )
2956
- : module . createI32 ( classInstance . currentMemoryOffset ) ,
2957
- module . createI32 (
2958
- ensureGCHook ( compiler , classInstance )
2959
- )
2960
- ] ,
2961
- options . nativeSizeType
2962
- ) ;
2963
-
2964
- // memory.allocate(size)
2965
- } else {
2966
- let allocateInstance = program . memoryAllocateInstance ;
2967
- if ( ! allocateInstance ) {
2968
- program . error (
2969
- DiagnosticCode . Cannot_find_name_0 ,
2970
- reportNode . range , "memory.allocate"
2971
- ) ;
2972
- return module . createUnreachable ( ) ;
2973
- }
2974
- if ( ! compiler . compileFunction ( allocateInstance ) ) return module . createUnreachable ( ) ;
2975
-
2976
- compiler . currentType = classInstance . type ;
2977
- return module . createCall (
2978
- allocateInstance . internalName , [
2979
- options . isWasm64
2980
- ? module . createI64 ( classInstance . currentMemoryOffset )
2981
- : module . createI32 ( classInstance . currentMemoryOffset )
2982
- ] ,
2983
- options . nativeSizeType
2984
- ) ;
2985
- }
2986
- }
2987
-
2988
2936
/** Compiles an abort wired to the conditionally imported 'abort' function. */
2989
2937
export function compileAbort (
2990
2938
compiler : Compiler ,
0 commit comments