<commit_before>// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// See malloc.h for overview.
//
// TODO(rsc): double-check stats.

#include "runtime.h"
#include "arch_GOARCH.h"
#include "malloc.h"
#include "type.h"
#include "typekind.h"
#include "race.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"

// Mark mheap as 'no pointers', it does not contain interesting pointers but occupies ~45K.
#pragma dataflag NOPTR
MHeap runtime·mheap;
#pragma dataflag NOPTR
MStats runtime·memstats;

void* runtime·cmallocgc(uintptr size, Type *typ, uint32 flag, void **ret);

void*
runtime·mallocgc(uintptr size, Type *typ, uint32 flag)
{
	void *ret;

	// Call into the Go version of mallocgc.
	// TODO: maybe someday we can get rid of this.  It is
	// probably the only location where we run Go code on the M stack.
	runtime·cmallocgc(size, typ, flag, &ret);
	return ret;
}

void*
runtime·malloc(uintptr size)
{
	return runtime·mallocgc(size, nil, FlagNoInvokeGC);
}

// Free the object whose base pointer is v.
void
runtime·free(void *v)
{
	int32 sizeclass;
	MSpan *s;
	MCache *c;
	uintptr size;<commit_msg>runtime: fix cmallocgc's C prototype<commit_after>// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// See malloc.h for overview.
//
// TODO(rsc): double-check stats.

#include "runtime.h"
#include "arch_GOARCH.h"
#include "malloc.h"
#include "type.h"
#include "typekind.h"
#include "race.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"

// Mark mheap as 'no pointers', it does not contain interesting pointers but occupies ~45K.
#pragma dataflag NOPTR
MHeap runtime·mheap;
#pragma dataflag NOPTR
MStats runtime·memstats;

void runtime·cmallocgc(uintptr size, Type *typ, uint32 flag, void **ret);

void*
runtime·mallocgc(uintptr size, Type *typ, uint32 flag)
{
	void *ret;

	// Call into the Go version of mallocgc.
	// TODO: maybe someday we can get rid of this.  It is
	// probably the only location where we run Go code on the M stack.
	runtime·cmallocgc(size, typ, flag, &ret);
	return ret;
}

void*
runtime·malloc(uintptr size)
{
	return runtime·mallocgc(size, nil, FlagNoInvokeGC);
}

// Free the object whose base pointer is v.
void
runtime·free(void *v)
{
	int32 sizeclass;
	MSpan *s;
	MCache *c;
	uintptr size;
{'fraction_non_alphanumeric': 0.11939690301548492, 'fraction_numerical': 0.009779951100244499, 'mean_word_length': 4.041067761806982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3795016', 'n_tokens_mistral': 863, 'n_tokens_neox': 830, 'n_words': 315}