Re: [go-nuts] [generics] Why is constraint optional?

2020-06-17 Thread eric fang

>
> It seems annoying to force 
> everyone to write interface{} all the time when it is normally not 
> needed. 
>

I agree, omitting interface{} should not cause much trouble to the parser.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6fb167e0-29e8-4299-88d1-273720ee88d4o%40googlegroups.com.


[go-nuts] Re: Failed to build gollvm in a docker container

2020-05-26 Thread eric fang
I have been building Gollvm in a container, I can build it successfully no 
matter on amd64 and arm64. But the ld.gold error message really exists on 
both platforms.

在 2020年5月26日星期二 UTC+8上午10:14:43,Yuan Ting写道:
>
> I tried to build gollvm in a docker container (the image is based on 
> ubuntu 20.04, and the host OS is MacOS catalina). I configured llvm by
>
> SHELL=/bin/sh cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 
> -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_RTTI=On -DLLVM_USE_LINKER=gold -G 
> Ninja ../llvm
>
> and then build and install gollvm by 
>
> ninja gollvm && ninja install-gollvm
>
> after a while, I encountered
>
> ...
>
> error: At most two relocations per offset are supported
>
> error: At most two relocations per offset are supported
>
> error: At most two relocations per offset are supported
>
> [212/1279] Creating 
> /root/llvm-project/build-debug/tools/gollvm/libgo/tmp-sigtab.go
>
> FAILED: tools/gollvm/libgo/tmp-sigtab.go
>
> cd /root/llvm-project/build-debug/tools/gollvm/libgo && GOARCH=amd64 
> GOOS=linux /bin/sh 
> /root/llvm-project/llvm/tools/gollvm/libgo/capturescript.sh 
> /root/llvm-project/llvm/tools/gollvm/gofrontend/libgo/mksigtab.sh 
> /root/llvm-project/build-debug/tools/gollvm/libgo/tmp-sigtab.go
>
> error: no SHELL setting
>
> [214/1279] Creating 
> /root/llvm-project/build-debug/tools/gollvm/libgo/tmp-sysinfo.go
>
> ninja: build stopped: subcommand failed.
>
>
> By add SHELL=/bin/sh, the errors above seems to be skipped but another 
> period of time: 
>
>
> ...
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libgo_c_piclib.dir/__/gofrontend/libgo/go/syscall/errno.c.o:
>  
> failed to match split-stack sequence at section 4 offset 0
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libgo_c_piclib.dir/__/gofrontend/libgo/go/syscall/errno.c.o:
>  
> failed to match split-stack sequence at section 6 offset 0
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libgo_c_piclib.dir/__/gofrontend/libgo/go/syscall/signame.c.o:
>  
> failed to match split-stack sequence at section 5 offset 0
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libbacktrace_piclib.dir/libbacktrace/backtrace.c.o:
>  
> failed to match split-stack sequence at section 4 offset 0
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libbacktrace_piclib.dir/libbacktrace/backtrace.c.o:
>  
> failed to match split-stack sequence at section 6 offset 0
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libbacktrace_piclib.dir/libbacktrace/dwarf.c.o: 
> failed to match split-stack sequence at section 18 offset 0
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libbacktrace_piclib.dir/libbacktrace/dwarf.c.o: 
> failed to match split-stack sequence at section 79 offset 0
>
> ...
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libffi_piclib.dir/libffi/src/x86/ffi64.c.o: 
> failed to match split-stack sequence at section 22 offset 0
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libffi_piclib.dir/libffi/src/x86/ffi64.c.o: 
> failed to match split-stack sequence at section 26 offset 0
>
> /usr/bin/ld.gold: error: 
> tools/gollvm/libgo/CMakeFiles/libffi_piclib.dir/libffi/src/x86/ffiw64.c.o: 
> failed to match split-stack sequence at section 16 offset 0
>
> collect2: error: ld returned 1 exit status
>
> [901/1066] Linking C static library tools/gollvm/libgo/libgo.a
>
> ninja: build stopped: subcommand failed.
>
>
> I'm not sure the error is caused by the container environment or my 
> configurations/other prerequisites.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/aa55577b-f8c7-4672-8bc8-e20b4a6f83f1%40googlegroups.com.


[go-nuts] Re: How to dump cfg for method ?

2020-05-21 Thread eric fang
Does anyone know this? Or this is an unimplemented feature ?

在 2020年5月19日星期二 UTC+8下午7:49:53,eric fang写道:
>
> How to generate the cfg of the following Replace method ? I used this 
> command "GOSSAFUNC=Replace:* go tool compile main.go" but it doesn't work. 
> Thanks.
>
> package main
>
> type byteReplacer [256]byte
>
> func (r *byteReplacer) Replace(s string) string {
> var buf []byte // lazily allocated
> for i := 0; i < len(s); i++ {
> b := s[i]
> if r[b] != b {
> if buf == nil {
> buf = []byte(s)
> }
> buf[i] = r[b]
> }
> }
> if buf == nil {
> return s
> }
> return string(buf)
> }
>
> func main() {
> }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0213048f-b1f8-468b-887d-769df058037e%40googlegroups.com.


[go-nuts] How to dump cfg for method ?

2020-05-19 Thread eric fang
How to generate the cfg of the following Replace method ? I used this 
command "GOSSAFUNC=Replace:* go tool compile main.go" but it doesn't work. 
Thanks.

package main

type byteReplacer [256]byte

func (r *byteReplacer) Replace(s string) string {
var buf []byte // lazily allocated
for i := 0; i < len(s); i++ {
b := s[i]
if r[b] != b {
if buf == nil {
buf = []byte(s)
}
buf[i] = r[b]
}
}
if buf == nil {
return s
}
return string(buf)
}

func main() {
}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5f599008-15aa-4a5f-b5fb-e9d899ffc315%40googlegroups.com.


Re: [go-nuts] Build fails when following build instructions

2020-05-06 Thread eric fang
well done. Expect it to be merged. Thanks.

在 2020年5月6日星期三 UTC+8下午7:18:21,Than McIntosh写道:
>
> >This seems to be the synchronization problem of gollvm and llvm, I am 
> fixing it today, if you have not done it, I can help.
>
> Thanks, I have started a CL for this -- it is at 
> https://go-review.googlesource.com/c/gollvm/+/232497 if you want to look 
> it over. Not quite done yet, still a few things to wrap up.
>
> Cheers, Than
>
>
>
> On Wed, May 6, 2020 at 5:46 AM eric fang > 
> wrote:
>
> This seems to be the synchronization problem of gollvm and llvm, I am 
> fixing it today, if you have not done it, I can help.
>
> 在 2020年5月5日星期二 UTC+8下午8:30:14,Than McIntosh写道:
>
> OK, thanks for that.  I will investigate, this looks unrelated to the 
> previous problem. Stay tuned.
>
> Cheers, Than
>
>
> On Tue, May 5, 2020 at 5:32 AM Martins Eglitis  
> wrote:
>
> Hi,
>
> I am getting further now. This is what I am getting now:
>
> -- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 
> -- Native target architecture is X86
> -- Threads enabled.
> -- Doxygen disabled.
> -- Go bindings disabled.
> -- Ninja version: 1.10.0
> -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
> -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
> -- OCaml bindings disabled.
> -- LLVM host triple: x86_64-unknown-linux-gnu
> -- LLVM default target triple: x86_64-unknown-linux-gnu
> -- Building with -fPIC
> -- Constructing LLVMBuild project information
> -- Targeting X86
> -- starting libgo configuration.
> -- Libgo: creating stdlib package targets
> -- Libgo: generating check targets
> -- libgo configuration complete.
> -- starting gotools configuration.
> -- gotools: generating check targets
> -- gotools configuration complete.
> -- Registering Bye as a pass plugin (static build: OFF)
> -- Failed to find LLVM FileCheck
> -- Version: 0.0.0
> -- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
> -- Performing Test HAVE_POSIX_REGEX -- success
> -- Performing Test HAVE_STEADY_CLOCK -- success
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/gopher/workarea/build-debug
> [1/1288] Linking CXX static library lib/libLLVMFrontendOpenMP.a
> [2/1288] Linking CXX static library lib/libLLVMAggressiveInstCombine.a
> [3/1288] Linking CXX static library lib/libLLVMLinker.a
> [4/1288] Linking CXX static library lib/libLLVMVectorize.a
> [5/1288] Building CXX object 
> tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o
> FAILED: tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o 
> /usr/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE 
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
> -Itools/gollvm/passes 
> -I/home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes -Iinclude 
> -I/home/gopher/workarea/llvm-project/llvm/include -fcf-protection=none -fPIC 
> -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
> -Wno-unused-parameter -Wwrite-strings -Wcast-qual 
> -Wno-missing-field-initializers -pedantic -Wno-long-long 
> -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess 
> -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment 
> -fdiagnostics-color -g-fno-exceptions -fno-rtti -std=c++14 -MD -MT 
> tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o -MF 
> tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o.d -o 
> tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o -c 
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp: In 
> function 'bool gollvm::passes::hasPointer(llvm::Type*)':
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp:34:14: 
> error: 'VectorTyID' is not a member of 'llvm::Type'
>34 |   case Type::VectorTyID:
>   |  ^~
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp:35:26: 
> error: 'class llvm::Type' has no member named 'getVectorElementType'; did you 
> mean 'getPointerElementType'?
>35 | return hasPointer(T->getVectorElementType());
>   |  ^~~~
>   |  getPointerElementType
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp: In 
> function 'void getPtrBitmapForTypeHelper(llvm::Type*, const 
> llvm::DataLayout&, uint64_t, llvm::BitVector&)':
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp:69:14: 
> error: 'VectorTyID' is not a member of '

Re: [go-nuts] Build fails when following build instructions

2020-05-06 Thread eric fang
This seems to be the synchronization problem of gollvm and llvm, I am 
fixing it today, if you have not done it, I can help.

在 2020年5月5日星期二 UTC+8下午8:30:14,Than McIntosh写道:
>
> OK, thanks for that.  I will investigate, this looks unrelated to the 
> previous problem. Stay tuned.
>
> Cheers, Than
>
>
> On Tue, May 5, 2020 at 5:32 AM Martins Eglitis  > wrote:
>
> Hi,
>
> I am getting further now. This is what I am getting now:
>
> -- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 
> -- Native target architecture is X86
> -- Threads enabled.
> -- Doxygen disabled.
> -- Go bindings disabled.
> -- Ninja version: 1.10.0
> -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
> -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
> -- OCaml bindings disabled.
> -- LLVM host triple: x86_64-unknown-linux-gnu
> -- LLVM default target triple: x86_64-unknown-linux-gnu
> -- Building with -fPIC
> -- Constructing LLVMBuild project information
> -- Targeting X86
> -- starting libgo configuration.
> -- Libgo: creating stdlib package targets
> -- Libgo: generating check targets
> -- libgo configuration complete.
> -- starting gotools configuration.
> -- gotools: generating check targets
> -- gotools configuration complete.
> -- Registering Bye as a pass plugin (static build: OFF)
> -- Failed to find LLVM FileCheck
> -- Version: 0.0.0
> -- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
> -- Performing Test HAVE_POSIX_REGEX -- success
> -- Performing Test HAVE_STEADY_CLOCK -- success
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/gopher/workarea/build-debug
> [1/1288] Linking CXX static library lib/libLLVMFrontendOpenMP.a
> [2/1288] Linking CXX static library lib/libLLVMAggressiveInstCombine.a
> [3/1288] Linking CXX static library lib/libLLVMLinker.a
> [4/1288] Linking CXX static library lib/libLLVMVectorize.a
> [5/1288] Building CXX object 
> tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o
> FAILED: tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o 
> /usr/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE 
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
> -Itools/gollvm/passes 
> -I/home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes -Iinclude 
> -I/home/gopher/workarea/llvm-project/llvm/include -fcf-protection=none -fPIC 
> -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
> -Wno-unused-parameter -Wwrite-strings -Wcast-qual 
> -Wno-missing-field-initializers -pedantic -Wno-long-long 
> -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess 
> -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment 
> -fdiagnostics-color -g-fno-exceptions -fno-rtti -std=c++14 -MD -MT 
> tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o -MF 
> tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o.d -o 
> tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/Util.cpp.o -c 
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp: In 
> function 'bool gollvm::passes::hasPointer(llvm::Type*)':
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp:34:14: 
> error: 'VectorTyID' is not a member of 'llvm::Type'
>34 |   case Type::VectorTyID:
>   |  ^~
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp:35:26: 
> error: 'class llvm::Type' has no member named 'getVectorElementType'; did you 
> mean 'getPointerElementType'?
>35 | return hasPointer(T->getVectorElementType());
>   |  ^~~~
>   |  getPointerElementType
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp: In 
> function 'void getPtrBitmapForTypeHelper(llvm::Type*, const 
> llvm::DataLayout&, uint64_t, llvm::BitVector&)':
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp:69:14: 
> error: 'VectorTyID' is not a member of 'llvm::Type'
>69 |   case Type::VectorTyID: {
>   |  ^~
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp:70:19: 
> error: 'class llvm::Type' has no member named 'getVectorElementType'; did you 
> mean 'getPointerElementType'?
>70 | Type *ET = T->getVectorElementType();
>   |   ^~~~
>   |   getPointerElementType
> /home/gopher/workarea/llvm-project/llvm/tools/gollvm/passes/Util.cpp:71:33: 
> error: 'class llvm::Type' has no member named 'getVectorNumElements'; did you 
> mean 'getStructNumElements'?
>71 | for (unsigned i = 0, n = T->getVectorNumElements(); i < n; ++i) {
>   | ^~~~
>   | getStructNumElements
> [6/1288] Linking CXX static library 

Re: [go-nuts] How to build gollvm on arm platform

2019-10-25 Thread eric fang

>
> The way that I had imagined this working was that either each 
> testpoint has a loop over the various supported ABI flavors (and checks 
> output for each flavor)
>
Yes, for those common test cases, I just did this.
 

> or we have separate testpoints for each ABI 
> (e.g. TEST(BackendCABIOracleTests, X8664_RecursiveCall1) or equivalent. 
>
For those test cases that will generate different results on different 
platforms, I use this way. 

It would be nice if FcnTestHarness could be extended to accept a "target 
> ABI" parameter
>
I have done this extention.
 

 I'm porting the unit test cases of x86 to arm64. As the difference between 
> x86 abi and arm64 abi, for the same go code snippet, the generated llvm IRs 
> maybe different. 
>
How do you get the correct IR result of a unit test? Such as unit 
>> test TEST(BackendCABIOracleTests, RecursiveCall1). Is there any quick way?
>>
> Maybe I didn't say my question clearly. I want to know how to get the 
correct LLVM IR result of a piece of go code. Are they handwritten? Is 
there a simpler way to get it?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b754ef40-386e-40ad-bcf1-718a03d5e476%40googlegroups.com.


Re: [go-nuts] How to build gollvm on arm platform

2019-10-25 Thread eric fang
Hi Than,

I'm porting the unit test cases of x86 to arm64. As the difference between 
x86 abi and arm64 abi, for the same go code snippet, the generated llvm IRs 
maybe different. 
How do you get the correct IR result of a unit test? Such as unit 
test TEST(BackendCABIOracleTests, RecursiveCall1). Is there any quick way?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/bcd0ea2c-d1e3-43f7-88ea-0c8de78f96f6%40googlegroups.com.


Re: [go-nuts] ptrace arm64

2019-10-18 Thread eric fang
Hi Ian, go-delve for arm64 (https://github.com/go-delve/delve/issues/1715) 
also encountered this problem, I want to fix this problem. 
unix.PtraceGetRegsArm64 may be not work on Linux arm64 since version 
2.6.34, because PTRACE_GETREGS has been replaced with PTRACE_GETREGSET, no 
longer support PTRACE_GETREGS. PTRACE_GETREGSET needs to work with 
different NT_XXX values, and the current API unix.PtraceGetRegSetArm64 
obviously does not have such scalability. So I think we may need to add a 
new API, such as unix.PtraceGetRegSetArm64(pid int, addr int, regsout 
*PtraceRegsArm64). What do you think?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/825e7ae7-6c2f-4cbc-9712-756288477cd4%40googlegroups.com.


Re: [go-nuts] How to build gollvm on arm platform

2019-09-18 Thread eric fang
Hi Than, I think here should be the right place to handle this case, and I 
have corrected the code. I should use BlockLIRBuilder instead of 
BinstructionLIRBuilder. I have implemented a prototype of the code and at 
present everything is normal. Next I will start writing some unit test 
cases. There are some places that are not easy to extend. For example, in 
the constructor of class Llvm_backend, calling convention is hard coded, 
and the unit test needs to get an Llvm_backend instance through the 
go_get_backend function in the file bridge/go-llvm.cpp. I am thinking about 
how to deal with this.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4283a098-d922-4a52-ae61-cd3c8d1880b1%40googlegroups.com.


Re: [go-nuts] How to build gollvm on arm platform

2019-09-17 Thread eric fang
Hi Than,

I got another question for you. For indirect parameters, arm-aapcs abi 
requires to do a copy of the parameter on stack, and then pass the address  
of the copied parameter to callee. I tried to do a memcpy of the indirect 
parameter in function Llvm_backend::genCallMarshallArgs, but failed to 
build. The code are as follow:

git diff
diff --git a/bridge/go-llvm-materialize.cpp b/bridge/go-llvm-materialize.cpp
index 3985153..bc8c147 100644
--- a/bridge/go-llvm-materialize.cpp
+++ b/bridge/go-llvm-materialize.cpp
@@ -1194,7 +1194,22 @@ Llvm_backend::genCallMarshallArgs(const 
std::vector _args,
 llvm::Type *pt = 
llvm::PointerType::get(vt->getPointerElementType(), 0);
 val = builder.CreateAddrSpaceCast(val, pt, castname);
   }
-  state.llargs.push_back(val);
+
+//  BlockLIRBuilder bbuilder(state.callerFcn->function(), this);
+  TypeManager *tm = state.oracle->tm();
+  Btype *bty = fnarg->btype();
+  uint64_t sz = tm->typeSize(bty);
+  uint64_t algn = tm->typeAlignment(bty);
+  std::string tname(namegen("arm64indtpara.actual"));
+  llvm::Value *tmpV = state.callerFcn->createTemporary(bty, tname);
+  llvm::CallInst *cpyVal = builder.CreateMemCpy(tmpV, algn, val, algn, 
sz);
+  state.llargs.push_back(cpyVal);
+//  llvm::CallInst *cpyVal = builder.CreateMemCpy(tmpV, algn, val, 
algn, sz);
+//   std::vector instructions = 
bbuilder.instructions();
+//   for (auto i : instructions)
+// state.llargs.push_back(i);
+
+//  state.llargs.push_back(val);
   continue;
 }

Any suggestions on how and where to implement this situation? I found that 
here we need to know a little bit about the LLVM backend, but I almost knew 
nothing about it.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e57b56e7-9dd0-4939-a15f-bde319bdf036%40googlegroups.com.


Re: [go-nuts] How to build gollvm on arm platform

2019-08-20 Thread eric fang
Hi Than,

I got it, thanks for your detailed explanation. And I'm also thinking about 
how to write test cases, the cabi-testgen project would be a great help, I 
will keep you informed if there are other questions or updates, thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/56ba9fab-0b7b-42a5-84f6-c88d045bffd5%40googlegroups.com.


Re: [go-nuts] How to build gollvm on arm platform

2019-08-20 Thread eric fang
Hi Than,

I'm trying to implement the abi part for arm64, and got two questions for 
you:

1, function CABIOracle::canPassDirectly in 
gollvm/bridge/go-llvm-cabi-oracle.cpp, I'm not quite understand the first 
if statement:
  if (regsInt + regsSSE == 1)
   return true;
  Why not consider whether there are enough available registers here?

2, I plan to abstract the CABIOracle class into a base class, and each 
architecture implements an inheritance class based on this class. But there 
are some auxiliary classes and structures (like class CABIParamInfo and 
EightByteInfo etc.) in this file that are also x86 specific. I haven't 
figured out how to handle these yet, maybe some of them are also reusable. 
Do you think this design is reasonable? Any suggestions? I should submit a 
prototype patch, which would be more convenient to discuss, but I have not 
implemented it yet. . .

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/702e3129-b72a-411d-80fe-70e9daae207d%40googlegroups.com.


Re: [go-nuts] How to build gollvm on arm platform

2019-07-17 Thread eric fang
Hi Than,

Thanks for your help, "check-gollvm" is exactly what I'm looking for. But 
on x86-64, there are two test failures, as the log is very long, we just 
put some key info here.
[152/189] Checking Go package go/internal/gccgoimporter
FAILED: tools/gollvm/libgo/CMakeFiles/check_libgo_go_internal_gccgoimporter
--- FAIL: TestObjImporter (0.08s)
importer_test.go:134: could not find version number in gollvm version 1 
(experimental) [LLVM version 9]
FAIL
[189/189] Checking cmd/go tool
FAILED: tools/gollvm/gotools/CMakeFiles/check_go_tool
(see the attached log file)

I still don't know how to run the benchmark tests in the standard library 
and "go1" benchmarks, can you give me more details, thanks.
I didn't find a cmake target for benchmark tests, and I tried the following 
commands but not work:
$ go version
go version go1.12.2 gollvm LLVM 9.0.0svn linux/amd64
$ cd gollvm-workarea/llvm/tools/gollvm/gofrontend/libgo/go/bytes
$ go test -bench . 
bytes.go:10:2: use of internal package internal/bytealg not allowed

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4adbc960-7281-4dd1-bc0b-6e9b69d4203c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


cmd_go-testlog
Description: Binary data


Re: [go-nuts] How to build gollvm on arm platform

2019-07-15 Thread eric fang
Hi,

Another three questions about test and benchmark.

1, Currently I can build all unit test executable files by "% ninja 
GoBackendUnitTests", but in order to run all tests, I have to run the  test 
executable files under all the directories. Do we have a single command to 
perform all unit tests?

2, How to perform unit tests of std libraries with the "go" binary ? For 
example, in main Go, we can perform unit tests in src/bytes package with 
command "% go test -run . bytes", in gollvm, can we do the same thing?

3, How to perform benchmark tests of std libraries ? Can I perform a 
benchmark test of std bytes package by executing "% go test -bench . bytes" 
command somewhere ?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/90359448-63ae-4539-9931-b4d88351f4d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to build gollvm on arm platform

2019-07-09 Thread eric fang
Thank you for your answer, this makes sense.

在 2019年7月9日星期二 UTC+8下午9:15:52,Than McIntosh写道:
>
> Hi,
>
> This is a good question, and I think it points out that the name of this 
> command line flag ("-enable-gc") is not ideal. It should really be 
> something more like "-enable-precise-stack-scan=".
>
> The garbage collector used by gollvm is substantially the same as the one 
> used by the main Go compiler. The main difference is that by default gollvm 
> uses conservative stack scanning -- chunks of stack memory are scanned 
> assuming that everything that might be a live heap pointer is indeed a live 
> heap pointer. When you build with "-enable-gc=true" it turns on machinery 
> in the compiler to enable precise stack scanning, meaning that the compiler 
> emits stack maps and then the runtime uses those maps to look at only life 
> heap pointers during scanning.
>
> There are some other small differences between Gollvm and GC garbage 
> collection (notably the representation of the global roots list) but in 
> general they are using pretty much the same collector.
>
> Thanks, Than
>
>
>
> On Tue, Jul 9, 2019 at 8:13 AM eric fang  > wrote:
>
>> Hi Than, when I read the code, I found enable_gc_ is false by default, 
>> the description of option "-enable-gc=" is "Enable stack map 
>> generation". I guess gollvm should have implemented garbage collection. My 
>> question are:
>> 1,  what kind of gc does gollvm currently implement, and what is the 
>> difference between this gc and the one in main Go?
>>
>> 2, What effect does this option (-enable-gc) have on gollvm gc?
>>
>> Thanks!
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golan...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/186b9cda-eff5-4a09-b4eb-53350d76244c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/186b9cda-eff5-4a09-b4eb-53350d76244c%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5b8d8024-3809-4736-b35f-437b3f5e0790%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to build gollvm on arm platform

2019-07-09 Thread eric fang
Hi Than, when I read the code, I found enable_gc_ is false by default, the 
description of option "-enable-gc=" is "Enable stack map 
generation". I guess gollvm should have implemented garbage collection. My 
question are:
1,  what kind of gc does gollvm currently implement, and what is the 
difference between this gc and the one in main Go?

2, What effect does this option (-enable-gc) have on gollvm gc?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/186b9cda-eff5-4a09-b4eb-53350d76244c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to build gollvm on arm platform

2019-06-28 Thread eric fang
Hi Than, 
Thanks for your guide, this certainly helps.  I don't have any specific 
questions at the moment. Thanks again.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8d184055-5cb2-4375-9f92-ed20fc5de4d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How to build gollvm on arm platform

2019-06-25 Thread eric fang

>
> >>I'll write down a more specific list of tips and pointers to the code 
> later today; stay tuned. 
>

Hi Than, I'm also very interested in this work and look forward to your 
update.

 I'm reading the gollvm code, but I haven't figured out the relationship 
between the various modules (llvm, gofrontend, libbacktrace, libffi ... ) , 
and the direction of the data flow and control flow. I was also confused by 
cmake.
Could you give me a general introduction about how gollvm combines these 
components and compile, assemble, and link go source files as an executable 
? I think this will help me have a holistic understanding of the entire 
gollm project. Thanks !

In the process of looking at the code, I found that I spent a lot of time 
in the gofrontend project. For enabling arm64, is there some work to do in 
this sub-project?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/76979ef8-a194-49a2-974e-0753d4247d58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.