Exemplo n.º 1
0
static bool
ifaceeq1(void *data1, void *data2, Type *t)
{
	uintptr size;
	Alg *alg;
	Eface err;
	bool eq;

	alg = t->alg;
	size = t->size;

	if(alg->equal == runtime·noequal) {
		// calling noequal will panic too,
		// but we can print a better error.
		runtime·newErrorString(runtime·catstring(runtime·gostringnocopy((byte*)"comparing uncomparable type "), *t->string), &err);
		runtime·panic(err);
	}

	eq = 0;
	if(size <= sizeof(data1))
		alg->equal(&eq, size, &data1, &data2);
	else
		alg->equal(&eq, size, data1, data2);
	return eq;
}
Exemplo n.º 2
0
String
runtime·signame(int32 sig)
{
	if(sig < 0 || sig >= NSIG)
		return runtime·emptystring;
	return runtime·gostringnocopy((byte*)runtime·sigtab[sig].name);
}
Exemplo n.º 3
0
void
runtime·getgoroot(String out)
{
	byte *p;

	p = runtime·getenv("GOROOT");
	out = runtime·gostringnocopy(p);
	FLUSH(&out);
}
Exemplo n.º 4
0
void
runtime·cstringToGo(byte* str, String s)
{
	s.str = 0;
	s.len = 0;
	FLUSH(&s);
#line 104 "/home/14/ren/source/golang/go/src/pkg/runtime/string.goc"

	s = runtime·gostringnocopy(str);
	FLUSH(&s);
}
Exemplo n.º 5
0
static void
dofunc(Sym *sym)
{
	Func *f;

	switch(sym->symtype) {
	case 't':
	case 'T':
	case 'l':
	case 'L':
		if(runtime·strcmp(sym->name, (byte*)"etext") == 0)
			break;
		if(func == nil) {
			nfunc++;
			break;
		}
		f = &func[nfunc++];
		f->name = runtime·gostringnocopy(sym->name);
		f->entry = sym->value;
		if(sym->symtype == 'L' || sym->symtype == 'l')
			f->frame = -sizeof(uintptr);
		break;
	case 'm':
		if(nfunc > 0 && func != nil)
			func[nfunc-1].frame += sym->value;
		break;
	case 'p':
		if(nfunc > 0 && func != nil) {
			f = &func[nfunc-1];
			// args counts 32-bit words.
			// sym->value is the arg's offset.
			// don't know width of this arg, so assume it is 64 bits.
			if(f->args < sym->value/4 + 2)
				f->args = sym->value/4 + 2;
		}
		break;
	case 'f':
		if(fname == nil) {
			if(sym->value >= nfname) {
				if(sym->value >= 0x10000) {
					runtime·printf("invalid symbol file index %p\n", sym->value);
					runtime·throw("mangled symbol table");
				}
				nfname = sym->value+1;
			}
			break;
		}
		fname[sym->value] = sym->name;
		break;
	}
}
Exemplo n.º 6
0
static void
dofunc(Sym *sym)
{
	Func *f;

	switch(sym->symtype) {
	case 't':
	case 'T':
	case 'l':
	case 'L':
		if(runtime·strcmp(sym->name, (byte*)"etext") == 0)
			break;
		if(func == nil) {
			nfunc++;
			break;
		}
		f = &func[nfunc++];
		f->name = runtime·gostringnocopy(sym->name);
		f->entry = sym->value + (uint64)reloffset;
		if(sym->symtype == 'L' || sym->symtype == 'l')
			f->frame = -sizeof(uintptr);
		break;
	case 'm':
		if(nfunc <= 0 || func == nil)
			break;
		if(runtime·strcmp(sym->name, (byte*)".frame") == 0)
			func[nfunc-1].frame = sym->value;
		else if(runtime·strcmp(sym->name, (byte*)".locals") == 0)
			func[nfunc-1].locals = sym->value;
		else if(runtime·strcmp(sym->name, (byte*)".args") == 0)
			func[nfunc-1].args = sym->value;
		else {
			runtime·printf("invalid 'm' symbol named '%s'\n", sym->name);
			runtime·throw("mangled symbol table");
		}
		break;
	case 'f':
		if(fname == nil) {
			if(sym->value >= nfname) {
				if(sym->value >= 0x10000) {
					runtime·printf("invalid symbol file index %p\n", sym->value);
					runtime·throw("mangled symbol table");
				}
				nfname = sym->value+1;
			}
			break;
		}
		fname[sym->value] = sym->name;
		break;
	}
}
Exemplo n.º 7
0
String
runtime·signame(int32 sig)
{
	int8 *s;

	switch(sig) {
	case SIGINT:
		s = "SIGINT: interrupt";
		break;
	default:
		return runtime·emptystring;
	}
	return runtime·gostringnocopy((byte*)s);
}
Exemplo n.º 8
0
void
runtime·getgoroot(String out)
{
	out.str = 0;
	out.len = 0;
	FLUSH(&out);
#line 58 "/home/14/ren/source/golang/go/src/pkg/runtime/runtime1.goc"

	byte *p;

	p = runtime·getenv("GOROOT");
	out = runtime·gostringnocopy(p);
	FLUSH(&out);
}
Exemplo n.º 9
0
void
runtime·getgoroot(String out)
{
	out.str = 0;
	out.len = 0;
	FLUSH(&out);
#line 58 "C:\Users\ADMINI~1\AppData\Local\Temp\2\makerelease686069423\go\src\pkg\runtime\runtime1.goc"

	byte *p;

	p = runtime·getenv("GOROOT");
	out = runtime·gostringnocopy(p);
	FLUSH(&out);
}
Exemplo n.º 10
0
void
runtime·goenvs_unix(void)
{
	String *s;
	int32 i, n;

	for(n=0; argv[argc+1+n] != 0; n++)
		;

	s = runtime·malloc(n*sizeof s[0]);
	for(i=0; i<n; i++)
		s[i] = runtime·gostringnocopy(argv[argc+1+i]);
	syscall·envs.array = (byte*)s;
	syscall·envs.len = n;
	syscall·envs.cap = n;
}
Exemplo n.º 11
0
void
runtime·goargs(void)
{
	String *s;
	int32 i;

	// for windows implementation see "os" package
	if(Windows)
		return;

	s = runtime·malloc(argc*sizeof s[0]);
	for(i=0; i<argc; i++)
		s[i] = runtime·gostringnocopy(argv[i]);
	os·Args.array = (byte*)s;
	os·Args.len = argc;
	os·Args.cap = argc;
}
Exemplo n.º 12
0
static uintptr 
ifacehash1 ( void *data , Type *t , uintptr h ) 
{ 
Alg *alg; 
uintptr size; 
Eface err; 
#line 464 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
if ( t == nil ) 
return 0; 
#line 467 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
alg = t->alg; 
size = t->size; 
if ( alg->hash == runtime·nohash ) { 
#line 472 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "hash of unhashable type " ) , *t->string ) , &err ) ; 
runtime·panic ( err ) ; 
} 
if ( size <= sizeof ( data ) ) 
alg->hash ( &h , size , &data ) ; 
else 
alg->hash ( &h , size , data ) ; 
return h; 
} 
Exemplo n.º 13
0
static bool 
ifaceeq1 ( void *data1 , void *data2 , Type *t ) 
{ 
uintptr size; 
Alg *alg; 
Eface err; 
bool eq; 
#line 504 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
alg = t->alg; 
size = t->size; 
#line 507 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
if ( alg->equal == runtime·noequal ) { 
#line 510 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "comparing uncomparable type " ) , *t->string ) , &err ) ; 
runtime·panic ( err ) ; 
} 
#line 514 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
eq = 0; 
if ( size <= sizeof ( data1 ) ) 
alg->equal ( &eq , size , &data1 , &data2 ) ; 
else 
alg->equal ( &eq , size , data1 , data2 ) ; 
return eq; 
} 
Exemplo n.º 14
0
static uintptr
ifacehash1(void *data, Type *t, uintptr h)
{
	Alg *alg;
	uintptr size;
	Eface err;

	if(t == nil)
		return 0;

	alg = t->alg;
	size = t->size;
	if(alg->hash == runtime·nohash) {
		// calling nohash will panic too,
		// but we can print a better error.
		runtime·newErrorString(runtime·catstring(runtime·gostringnocopy((byte*)"hash of unhashable type "), *t->string), &err);
		runtime·panic(err);
	}
	if(size <= sizeof(data))
		alg->hash(&h, size, &data);
	else
		alg->hash(&h, size, data);
	return h;
}
Exemplo n.º 15
0
static bool 
ifaceeq1 ( void *data1 , void *data2 , Type *t ) 
{ 
uintptr size; 
Alg *alg; 
Eface err; 
bool eq; 
#line 533 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
alg = t->alg; 
size = t->size; 
#line 536 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
if ( alg->equal == runtime·noequal ) { 
#line 539 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "comparing uncomparable type " ) , *t->string ) , &err ) ; 
runtime·panic ( err ) ; 
} 
#line 543 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
eq = 0; 
if ( size <= sizeof ( data1 ) ) 
alg->equal ( &eq , size , &data1 , &data2 ) ; 
else 
alg->equal ( &eq , size , data1 , data2 ) ; 
return eq; 
} 
Exemplo n.º 16
0
void 
runtime·cstringToGo ( byte *str , String s ) 
{ 
s = runtime·gostringnocopy ( str ) ; 
FLUSH ( &s ) ; 
}